Skip to content

Commit

Permalink
fix(dropdown): correct TS typings
Browse files Browse the repository at this point in the history
  • Loading branch information
pkozlowski-opensource committed Aug 17, 2017
1 parent f59f0f4 commit 9447f5d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/dropdown/dropdown-config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,15 @@ describe('ngb-dropdown-config', () => {
expect(config.up).toBe(false);
expect(config.autoClose).toBe(true);
});

it('should allow setting "inside" and "outside" value for autoClose', () => {
const config = new NgbDropdownConfig();

// This test looks like having trivial assertions but its goal
// is to prove that we've got TS typings right.
config.autoClose = 'outside';
expect(config.autoClose).toBe('outside');
config.autoClose = 'inside';
expect(config.autoClose).toBe('inside');
});
});
2 changes: 1 addition & 1 deletion src/dropdown/dropdown-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import {Injectable, TemplateRef} from '@angular/core';
@Injectable()
export class NgbDropdownConfig {
up = false;
autoClose = true;
autoClose: boolean | 'outside' | 'inside' = true;
}

0 comments on commit 9447f5d

Please sign in to comment.