Skip to content

Commit f9ef754

Browse files
committed
test(igx-combo): initial tests, #1260
1 parent 27cf8c8 commit f9ef754

File tree

1 file changed

+50
-3
lines changed

1 file changed

+50
-3
lines changed

src/combo/combo.component.spec.ts

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,49 @@
11
import { Component, ContentChildren, DebugElement, ViewChild } from "@angular/core";
2-
import { async, ComponentFixture, TestBed} from "@angular/core/testing";
2+
import { async, ComponentFixture, TestBed } from "@angular/core/testing";
33
import { By } from "@angular/platform-browser";
44
import { IgxComboComponent, IgxComboModule } from "./combo.component";
55

6+
const selectedItemClass = ".igx-combo__item--selected";
7+
const citiesData = [
8+
"New York",
9+
"Sofia",
10+
"Istanbul",
11+
"Paris",
12+
"Hamburg",
13+
"Berlin",
14+
"London",
15+
"Oslo",
16+
"Los Angeles",
17+
"Rome",
18+
"Madrid",
19+
"Ottawa",
20+
"Prague"];
21+
const employeeData = [
22+
{ ID: 1, Name: "Casey Houston", JobTitle: "Vice President", HireDate: "2017-06-19T11:43:07.714Z" },
23+
{ ID: 2, Name: "Gilberto Todd", JobTitle: "Director", HireDate: "2015-12-18T11:23:17.714Z" },
24+
{ ID: 3, Name: "Tanya Bennett", JobTitle: "Director", HireDate: "2005-11-18T11:23:17.714Z" },
25+
{ ID: 4, Name: "Jack Simon", JobTitle: "Software Developer", HireDate: "2008-12-18T11:23:17.714Z" },
26+
{ ID: 5, Name: "Celia Martinez", JobTitle: "Senior Software Developer", HireDate: "2007-12-19T11:23:17.714Z" },
27+
{ ID: 6, Name: "Erma Walsh", JobTitle: "CEO", HireDate: "2016-12-18T11:23:17.714Z" },
28+
{ ID: 7, Name: "Debra Morton", JobTitle: "Associate Software Developer", HireDate: "2005-11-19T11:23:17.714Z" },
29+
{ ID: 8, Name: "Erika Wells", JobTitle: "Software Development Team Lead", HireDate: "2005-10-14T11:23:17.714Z" },
30+
{ ID: 9, Name: "Leslie Hansen", JobTitle: "Associate Software Developer", HireDate: "2013-10-10T11:23:17.714Z" },
31+
{ ID: 10, Name: "Eduardo Ramirez", JobTitle: "Manager", HireDate: "2011-11-28T11:23:17.714Z" }
32+
];
33+
634
describe("Combo", () => {
735
beforeEach(async(() => {
836
TestBed.configureTestingModule({
9-
declarations: [/*BasicComboComponent*/],
37+
declarations: [IgxComboTestComponent],
1038
imports: [IgxComboModule]
1139
}).compileComponents();
1240
}));
1341

1442
// General
1543
it("Combo's input textbox should be read-only", () => {
16-
// TO DO
44+
const fixture = TestBed.createComponent(IgxComboTestComponent);
45+
fixture.detectChanges();
46+
const inputElement = fixture.debugElement.query(By.css("input[name=\"comboButton\"]"));
1747
});
1848

1949
// Rendering
@@ -160,3 +190,20 @@ describe("Combo", () => {
160190
// TO DO
161191
});
162192
});
193+
194+
@Component({
195+
template: `
196+
<igx-combo #combo
197+
[data]="citiesData"
198+
[width]="'800px'"
199+
[height]="'600px'"
200+
>
201+
</igx-combo>
202+
`
203+
})
204+
class IgxComboTestComponent {
205+
206+
@ViewChild("combo", { read: IgxComboComponent})
207+
public dropdown: IgxComboComponent;
208+
209+
}

0 commit comments

Comments
 (0)