Skip to content

Commit

Permalink
fix: accept spaces while tagging without dropdown
Browse files Browse the repository at this point in the history
fixes #676
  • Loading branch information
varnastadeus committed Aug 8, 2018
1 parent 75e9ac2 commit 4320098
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ng-select/items-list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,6 @@ function itemsList(cmp: NgSelectComponent): ItemsList {
}

function ngSelect(): NgSelectComponent {
const cmp = new NgSelectComponent({}, null, null, null, null);
const cmp = new NgSelectComponent({}, null, null, null, null, null);
return cmp;
}
4 changes: 3 additions & 1 deletion src/ng-select/ng-select.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1021,9 +1021,11 @@ describe('NgSelectComponent', function () {
});

it('should not open dropdown when isOpen is false', () => {
const open = spyOn(select, 'open');
select.ngOnChanges(<any>{ isOpen: { currentValue: false }});
triggerKeyDownEvent(getNgSelectElement(fixture), KeyCode.Space);
expect(select.isOpen).toBeFalsy();
expect(open).not.toHaveBeenCalled();
});

it('should open empty dropdown if no items', fakeAsync(() => {
Expand Down Expand Up @@ -1848,7 +1850,7 @@ describe('NgSelectComponent', function () {
}));
}));

describe('Show add tag', () => {
describe('show add tag', () => {
let select: NgSelectComponent;
let fixture: ComponentFixture<NgSelectTestCmp>;
beforeEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/ng-select/ng-select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C
}

private _handleSpace($event: KeyboardEvent) {
if (this.isOpen) {
if (this.isOpen || this._manualOpen) {
return;
}
this.open();
Expand Down

0 comments on commit 4320098

Please sign in to comment.