Skip to content

Commit

Permalink
Complete test
Browse files Browse the repository at this point in the history
  • Loading branch information
luisa-beerboom committed Jul 18, 2024
1 parent 2e7683c commit 2c1b5e6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions client/src/app/ui/directives/perms/cml-perms.directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ type TestConditionalType = {
id="complement"
></div>
<div *osCmlPerms="permission; committeeId: conditionals.id; orOML: conditionals.orOML" id="oml"></div>
<ng-container
*osCmlPerms="permission; committeeId: conditionals.id; then: thenTemplate; else elseTemplate"
></ng-container>
<ng-template #thenTemplate>
<div id="then"></div>
</ng-template>
<ng-template #elseTemplate>
<div id="else"></div>
</ng-template>
`
})
class TestComponent extends BasePermsTestComponent<TestConditionalType> {
Expand Down Expand Up @@ -191,4 +200,16 @@ describe(`CmlPermsDirective`, () => {
update();
expect(getElement(`#oml`)).toBeFalsy();
});

it(`check if then and else work`, async () => {
update();
console.log(`BEFORE: THEN:`, getElement(`#then`), `ELSE:`, getElement(`#else`));
// expect(getElement(`#else`)).toBeTruthy();
// expect(getElement(`#then`)).toBeFalsy();
operatorService.changeOperatorPermsForTest([CML.can_manage]);
update();
console.log(`AFTER: THEN:`, getElement(`#then`), `ELSE:`, getElement(`#else`));
expect(getElement(`#else`)).toBeFalsy();
expect(getElement(`#then`)).toBeTruthy();
});
});

0 comments on commit 2c1b5e6

Please sign in to comment.