Skip to content

Commit

Permalink
feat: allow multiple classes to be set from windowClass
Browse files Browse the repository at this point in the history
  • Loading branch information
fschick committed Mar 19, 2021
1 parent 2297d92 commit d60ee41
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions projects/ngneat/dialog/src/lib/dialog.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,13 @@ describe('DialogComponent', () => {
expect(host).toBeTruthy();
expect(host).toBe(spectator.fixture.nativeElement);
});

it('should set multiple classes from windowClass at host element', () => {
spectator = createComponent(withConfig({ windowClass: ' test-class-1 test-class-2 ' }));

const host = spectator.query('.test-class-1.test-class-2', { root: true });

expect(host).toBeTruthy();
expect(host).toBe(spectator.fixture.nativeElement);
});
});
2 changes: 1 addition & 1 deletion projects/ngneat/dialog/src/lib/dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class DialogComponent implements OnInit, OnDestroy {
this.nodes.forEach(node => host.appendChild(node));

if (config.windowClass) {
host.classList.add(config.windowClass);
host.classList.add(...config.windowClass.split(/\s/).filter(x => x));
}
}

Expand Down

0 comments on commit d60ee41

Please sign in to comment.