Skip to content

Instantly share code, notes, and snippets.

@adrianfaciu
Created September 24, 2019 14:03
Show Gist options
  • Save adrianfaciu/4d829197c7b6f424bb89c3501e50fa0c to your computer and use it in GitHub Desktop.
Save adrianfaciu/4d829197c7b6f424bb89c3501e50fa0c to your computer and use it in GitHub Desktop.
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