Skip to content

Commit

Permalink
Merge branch 'main' into 2906-login-loop
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianjoel committed Oct 20, 2023
2 parents 12496b0 + d7b2f94 commit ef1d88a
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 77 deletions.
134 changes: 67 additions & 67 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"qrcode": "^1.5.3",
"rxjs": "^7.8.1",
"tinycolor2": "1.4.2",
"tinymce": "^5.10.7",
"tinymce": "^5.10.8",
"ts-dedent": "^2.2.0",
"tslib": "^2.3.0",
"tsparticles": "~1.42.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
::ng-deep mark {
color: inherit;
background: none;
font-weight: 400;
font-weight: bolder;
}

::ng-deep :not(h3, h3 > span) > mark {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ <h2 *ngIf="isCreating">{{ 'New election' | translate }}</h2>
</ng-container>

<!-- New Ballot button -->
<div class="new-ballot-button" *ngIf="assignment && hasPerms('createPoll')">
<div
class="new-ballot-button"
*ngIf="assignment && assignment.candidatesAsUsers.length && hasPerms('createPoll')"
>
<button mat-stroked-button (click)="openDialog()">
<mat-icon>add</mat-icon>
<span>{{ 'New ballot' | translate }}</span>
Expand Down Expand Up @@ -162,7 +165,7 @@ <h3>{{ 'Candidates' | translate }}</h3>
>
<!-- implicit item references into the component using ng-template slot -->
<ng-template let-item>
<div class="single-candidate-line">
<div [ngClass]="{ 'single-candidate-line': true, 'deleted-candidate': !item.user }">
<span>{{ item.getTitle() }}</span>
<span *ngIf="hasPerms('manage')">
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
margin: auto 0;
}
}
.deleted-candidate {
color: slategrey;
}
}

.add-candidates {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@
</span>

<span *ngIf="showSequential">
<span *ngIf="motion.submitters.length">&middot;</span>
<span *ngIf="motion.submitters.length">&middot;&thinsp;</span>
<span>{{ 'Sequential number' | translate }}</span>
{{ motion.id }}
{{ motion.sequential_number }}
</span>
</div>

Expand Down
43 changes: 40 additions & 3 deletions client/src/app/site/services/color.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,53 @@
import { TestBed } from '@angular/core/testing';

import { ColorService } from './color.service';
import { HtmlColor } from '../../domain/definitions/key-types';
import { Color, ColorService } from './color.service';

xdescribe(`ColorService`, () => {
describe(`ColorService`, () => {
let service: ColorService;

beforeEach(() => {
TestBed.configureTestingModule({});
TestBed.configureTestingModule({
providers: [ColorService]
});
service = TestBed.inject(ColorService);
});

it(`should be created`, () => {
expect(service).toBeTruthy();
});

it(`parse html color to color`, () => {
const value: HtmlColor = `#aa11ff`;
expect(service.parseHtmlColorToColor(value)).toEqual(new Color(value));
});

it(`parse html color and check color parts`, () => {
const value: HtmlColor = `#aa11ff`;
expect(service.parseHtmlColorToColor(value).blue).toEqual(parseInt(`ff`, 16).toString());
expect(service.parseHtmlColorToColor(value).green).toEqual(parseInt(`11`, 16).toString());
expect(service.parseHtmlColorToColor(value).red).toEqual(parseInt(`aa`, 16).toString());
expect(service.parseHtmlColorToColor(value).value).toEqual(value);
});

it(`get random color`, () => {
expect(service.getRandomHtmlColor()).toMatch(/#[0-9abcdef]{6}/);
});

it(`generate color palette`, () => {
expect(service.generateColorPaletteByHex(`aa11ff`).length).toBe(14);
});

it(`create color object`, () => {
expect(service.createColorObject(`aa11ff`, `test-color`)).toEqual({
name: `test-color`,
hex: `#aa11ff`,
darkContrast: false
});
});

it(`is light from hex`, () => {
expect(service.isLightFromHex(`#110011`)).toBe(false);
expect(service.isLightFromHex(`#ffeeff`)).toBe(true);
});
});
Loading

0 comments on commit ef1d88a

Please sign in to comment.