|
| 1 | +/// <reference path="../../node_modules/@types/jasmine/index.d.ts" /> |
| 2 | + |
| 3 | +import { DebugElement, Component } from "@angular/core"; |
| 4 | +import { |
| 5 | + async, |
| 6 | + ComponentFixture, |
| 7 | + TestBed |
| 8 | +} from "@angular/core/testing"; |
| 9 | +import { By } from "@angular/platform-browser"; |
| 10 | + |
| 11 | +import { ClickableTile } from "./clickable-tile.component"; |
| 12 | + |
| 13 | +describe("ClickableTile", () => { |
| 14 | + beforeEach(async(() => { |
| 15 | + TestBed.configureTestingModule({ |
| 16 | + declarations: [ClickableTile, ClickableTileTestComponent], |
| 17 | + }).compileComponents(); |
| 18 | + })); |
| 19 | + |
| 20 | + it("should create a ClickableTile", () => { |
| 21 | + let fixture: ComponentFixture<ClickableTile> = TestBed.createComponent(ClickableTile); |
| 22 | + let component: ClickableTile = fixture.componentInstance; |
| 23 | + fixture.detectChanges(); |
| 24 | + |
| 25 | + expect(component).toBeTruthy(); |
| 26 | + }); |
| 27 | + |
| 28 | + it("should create a disabled ClickableTile", () => { |
| 29 | + let fixture: ComponentFixture<ClickableTileTestComponent> = TestBed.createComponent(ClickableTileTestComponent); |
| 30 | + let component: ClickableTileTestComponent = fixture.componentInstance; |
| 31 | + fixture.detectChanges(); |
| 32 | + |
| 33 | + const directiveEl = fixture.debugElement.query(By.directive(ClickableTile)); |
| 34 | + expect(directiveEl).not.toBeNull(); |
| 35 | + expect(directiveEl.attributes["disabled"]).toBeTruthy(); |
| 36 | + expect(directiveEl.attributes["href"]).toBe("https://angular.carbondesignsystem.com/"); |
| 37 | + }); |
| 38 | +}); |
| 39 | + |
| 40 | +@Component({ |
| 41 | + selector: "test-cmp", |
| 42 | + template: ` |
| 43 | + <ibm-clickable-tile disabled="true" href="https://angular.carbondesignsystem.com/"> |
| 44 | + Test Clickable Tile |
| 45 | + </ibm-clickable-tile>`, |
| 46 | + entryComponents: [ClickableTile] |
| 47 | +}) |
| 48 | +class ClickableTileTestComponent {} |
0 commit comments