Skip to content

Commit

Permalink
chore(dropdown): Adding tests #984
Browse files Browse the repository at this point in the history
  • Loading branch information
dafo committed May 10, 2018
1 parent cc0eb4b commit 1b7cafd
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/drop-down/drop-down.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const CSS_CLASS_SELECTED = "igx-drop-down__item--selected";
const CSS_CLASS_DISABLED = "igx-drop-down__item--disabled";
const CSS_CLASS_HEADER = "igx-drop-down__header";

fdescribe("IgxDropDown ", () => {
describe("IgxDropDown ", () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
Expand Down Expand Up @@ -529,6 +529,23 @@ fdescribe("IgxDropDown ", () => {
});
});

it("Disabled items cannot be selected", () => {
const fixture = TestBed.createComponent(IgxDropDownTestDisabledComponent);
fixture.detectChanges();
const button = fixture.debugElement.query(By.css("button")).nativeElement;
const list = fixture.componentInstance.dropdownDisabled;
const listItems = list.items;
expect(list).toBeDefined();
expect(list.items.length).toEqual(13);
list.setSelectedItem(0);
button.click();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(list.items[0].isSelected).toEqual(false);
button.click();
});
});

it("Clicking a disabled item is not moving the focus", () => {
const fixture = TestBed.createComponent(IgxDropDownTestDisabledComponent);
fixture.detectChanges();
Expand Down

0 comments on commit 1b7cafd

Please sign in to comment.