Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
griest024 authored and xelaint committed Dec 15, 2023
1 parent ff686e8 commit f6ff2db
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions libs/design/toast/src/toast/toast.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,28 @@ import {
TestBed,
} from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { of } from 'rxjs';

import { DaffStatus } from '@daffodil/design';
import {
DaffStatus,
DaffStatusEnum,
} from '@daffodil/design';
import { DaffToast } from '@daffodil/design/toast';

import { DaffToastComponent } from './toast.component';

@Component ({
template: `<daff-toast [status]="status"></daff-toast>`,
template: `
<daff-toast
[status]="status"
[toast]="toast"
></daff-toast>
`,
})

class WrapperComponent {
status: DaffStatus;
toast: DaffToast;
}

describe('DaffToastComponent', () => {
Expand All @@ -40,6 +51,11 @@ describe('DaffToastComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(WrapperComponent);
wrapper = fixture.componentInstance;
wrapper.toast = {
title: 'title',
dismiss: () => {},
dismissalStream: of(),
};
de = fixture.debugElement.query(By.css('daff-toast'));
component = de.componentInstance;
fixture.detectChanges();
Expand All @@ -63,7 +79,7 @@ describe('DaffToastComponent', () => {
});

it('should add the class of the defined status to the host element', () => {
wrapper.status = 'warn';
wrapper.status = DaffStatusEnum.Warn;
fixture.detectChanges();

expect(de.nativeElement.classList.contains('daff-warn')).toEqual(true);
Expand Down

0 comments on commit f6ff2db

Please sign in to comment.