Skip to content

Commit e2be429

Browse files
committed
Fix tests
1 parent a629bfc commit e2be429

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

src/checkbox/checkbox.component.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,31 @@ import { By } from "@angular/platform-browser";
44
import { DebugElement } from "@angular/core";
55
import { StaticIconModule } from "../icon/static-icon.module";
66

7-
import { CheckboxComponent } from "./checkbox.component";
7+
import { Checkbox } from "./checkbox.component";
88

9-
describe("CheckboxComponent", () => {
10-
let component: CheckboxComponent;
11-
let fixture: ComponentFixture<CheckboxComponent>;
9+
describe("Checkbox", () => {
10+
let component: Checkbox;
11+
let fixture: ComponentFixture<Checkbox>;
1212
let de: DebugElement;
1313
let el: HTMLElement;
1414
let inputElement: HTMLElement;
1515

1616
beforeEach(() => {
1717
TestBed.configureTestingModule({
18-
declarations: [CheckboxComponent],
18+
declarations: [Checkbox],
1919
imports: [BrowserAnimationsModule, StaticIconModule],
2020
providers: []
2121
});
2222

23-
fixture = TestBed.createComponent(CheckboxComponent);
23+
fixture = TestBed.createComponent(Checkbox);
2424
component = fixture.componentInstance;
2525
de = fixture.debugElement.query(By.css("label"));
2626
el = de.nativeElement;
2727
inputElement = fixture.debugElement.query(By.css("input")).nativeElement;
2828
});
2929

3030
it("should work", () => {
31-
expect(component instanceof CheckboxComponent).toBe(true);
31+
expect(component instanceof Checkbox).toBe(true);
3232
});
3333

3434
it("should change state", () => {

src/notification/notification.component.spec.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,22 @@ describe("Notification", () => {
3232
};
3333
fixture.detectChanges();
3434

35-
let notification = fixture.nativeElement.querySelector(".bx--inline-notification");
36-
expect(notification.classList.contains("bx--inline-notification--info")).toBeTruthy();
35+
expect(fixture.nativeElement.classList.contains("bx--inline-notification--info")).toBeTruthy();
3736
});
3837

3938
it("should render danger notification", () => {
4039
const fixture = TestBed.createComponent(Notification);
4140
fixture.componentInstance.notificationObj = {
42-
type: "danger",
41+
type: "error",
4342
title: "sample",
4443
message: "sample message"
4544
};
4645
fixture.detectChanges();
4746

48-
let notification = fixture.nativeElement.querySelector(".bx--inline-notification");
49-
expect(notification.classList.contains("bx--inline-notification--danger")).toBeTruthy();
47+
expect(fixture.nativeElement.classList.contains("bx--inline-notification--error")).toBeTruthy();
5048
});
5149

52-
it("should render info warning", () => {
50+
it("should render info warning notification", () => {
5351
const fixture = TestBed.createComponent(Notification);
5452
fixture.componentInstance.notificationObj = {
5553
type: "warning",
@@ -58,11 +56,10 @@ describe("Notification", () => {
5856
};
5957
fixture.detectChanges();
6058

61-
let notification = fixture.nativeElement.querySelector(".bx--inline-notification");
62-
expect(notification.classList.contains("bx--inline-notification--warning")).toBeTruthy();
59+
expect(fixture.nativeElement.classList.contains("bx--inline-notification--warning")).toBeTruthy();
6360
});
6461

65-
it("should render info success", () => {
62+
it("should render info success notification", () => {
6663
const fixture = TestBed.createComponent(Notification);
6764
fixture.componentInstance.notificationObj = {
6865
type: "success",
@@ -71,8 +68,7 @@ describe("Notification", () => {
7168
};
7269
fixture.detectChanges();
7370

74-
let notification = fixture.nativeElement.querySelector(".bx--inline-notification");
75-
expect(notification.classList.contains("bx--inline-notification--success")).toBeTruthy();
71+
expect(fixture.nativeElement.classList.contains("bx--inline-notification--success")).toBeTruthy();
7672
});
7773

7874
it("should display correct message", () => {

0 commit comments

Comments
 (0)