Skip to content

Commit

Permalink
Merge branch 'dropdown-poc' into combo
Browse files Browse the repository at this point in the history
  • Loading branch information
Lipata committed May 14, 2018
2 parents 70e3e53 + fdcc6d1 commit 5c6fe06
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 7 additions & 0 deletions demos/app/drop-down/sample.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ export class DropDownSampleComponent implements OnInit {
}
this.items.push(item);
}

// this.items = [
// { field: "Nav1" },
// { field: "Nav2" },
// { field: "Nav3" },
// { field: "Nav4" }
// ];
}

constructor() {
Expand Down
4 changes: 0 additions & 4 deletions src/drop-down/drop-down.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,14 +473,10 @@ describe("IgxDropDown ", () => {
fixture.whenStable().then(() => {
fixture.detectChanges();
const currentItem = fixture.debugElement.queryAll(By.css(".igx-drop-down__item"))[0];
// tslint:disable-next-line:no-debugger
debugger;
currentItem.triggerEventHandler("keydown.ArrowDown", jasmine.createSpyObj("mockEvt", ["stopPropagation", "preventDefault"]));
return fixture.whenStable();
}).then(() => {
fixture.detectChanges();
// tslint:disable-next-line:no-debugger
debugger;
expect(list.items[3].isFocused).toBeTruthy();
const currentItem = fixture.debugElement.queryAll(By.css(".igx-drop-down__item"))[0];
currentItem.triggerEventHandler("keydown.ArrowUp", jasmine.createSpyObj("mockEvt", ["stopPropagation", "preventDefault"]));
Expand Down
6 changes: 3 additions & 3 deletions src/drop-down/drop-down.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export class IgxDropDownComponent implements IToggleView, OnInit {

focusLast() {
if (this._focusedItem) {
const focusedItemIndex = (this.items.length - 1);
const focusedItemIndex = (this.items.length);
const lastItemIndex = this.getNearestSiblingFocusableItemIndex(focusedItemIndex, Direction.Up);
if (lastItemIndex !== -1) {
this.changeFocusedItem(this.items[lastItemIndex], this._focusedItem);
Expand Down Expand Up @@ -295,7 +295,7 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
if (this._focusedItem) {
this._focusedItem.isFocused = true;
} else if (this.allowItemsFocus) {
const firstItemIndex = this.getNearestSiblingFocusableItemIndex(0, Direction.Down);
const firstItemIndex = this.getNearestSiblingFocusableItemIndex(-1, Direction.Down);
if (firstItemIndex !== -1) {
this.changeFocusedItem(this.items[firstItemIndex]);
}
Expand Down Expand Up @@ -354,7 +354,7 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
}

index += direction;
if (index >= 0 && index < this.items.length - 1) {
if (index >= 0 && index < this.items.length) {
return index;
} else {
return -1;
Expand Down

0 comments on commit 5c6fe06

Please sign in to comment.