Created
September 24, 2019 14:03
-
-
Save adrianfaciu/4d829197c7b6f424bb89c3501e50fa0c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { TestBed, async, ComponentFixture } from "@angular/core/testing"; | |
import { Component } from "@angular/core"; | |
import { By } from "@angular/platform-browser"; | |
@Component({ | |
selector: "dh-app-div", | |
template: ` | |
<span *ngFor="let item of foo | keyvalue"> | |
{{ item }} | |
</span> | |
` | |
}) | |
export class TestComponent { | |
foo = { | |
bar: 123 | |
}; | |
} | |
fdescribe("GeneralDialogComponent", () => { | |
let fixture: ComponentFixture<TestComponent>; | |
let cmp: TestComponent; | |
beforeEach(async(() => { | |
TestBed.configureTestingModule({ | |
declarations: [TestComponent] | |
}).compileComponents(); | |
})); | |
beforeEach(() => { | |
fixture = TestBed.createComponent(TestComponent); | |
cmp = fixture.componentInstance; | |
fixture.detectChanges(); | |
}); | |
it("should create", () => { | |
expect(cmp).toBeDefined(); | |
}); | |
it("has items", () => { | |
const elements = fixture.debugElement.queryAll(By.css("span")); | |
expect(elements.length).toBe(1); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment