Skip to content

Commit

Permalink
nit(combobox): changed class names and parameter types.
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsr98 committed Aug 14, 2020
1 parent 065adf1 commit ddff626
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions src/cdk-experimental/combobox/combobox.spec.ts
Expand Up @@ -29,7 +29,7 @@ describe('Combobox', () => {
let comboboxElement: HTMLElement;

let dialog: DebugElement;
let dialogInstance: DialogContent<unknown>;
let dialogInstance: FakeDialogContent<unknown>;
let dialogElement: HTMLElement;

let applyButton: DebugElement;
Expand All @@ -38,7 +38,7 @@ describe('Combobox', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [CdkComboboxModule],
declarations: [ComboboxToggle, DialogContent],
declarations: [ComboboxToggle, FakeDialogContent],
}).compileComponents();
}));

Expand Down Expand Up @@ -73,8 +73,8 @@ describe('Combobox', () => {
dispatchMouseEvent(comboboxElement, 'click');
fixture.detectChanges();

dialog = fixture.debugElement.query(By.directive(DialogContent));
dialogInstance = dialog.injector.get<DialogContent<unknown>>(DialogContent);
dialog = fixture.debugElement.query(By.directive(FakeDialogContent));
dialogInstance = dialog.injector.get<FakeDialogContent<unknown>>(FakeDialogContent);

expect(comboboxElement.getAttribute('aria-owns')).toBe(dialogInstance.dialogId);
expect(comboboxElement.getAttribute('aria-haspopup')).toBe('dialog');
Expand Down Expand Up @@ -106,7 +106,7 @@ describe('Combobox', () => {

expect(comboboxInstance.isOpen()).toBeTrue();

dialog = fixture.debugElement.query(By.directive(DialogContent));
dialog = fixture.debugElement.query(By.directive(FakeDialogContent));
dialogElement = dialog.nativeElement;

expect(document.activeElement).toBe(dialogElement);
Expand Down Expand Up @@ -191,7 +191,7 @@ describe('Combobox', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [CdkComboboxModule],
declarations: [ComboboxToggle, DialogContent],
declarations: [ComboboxToggle, FakeDialogContent],
}).compileComponents();
}));

Expand Down Expand Up @@ -262,7 +262,7 @@ describe('Combobox', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [CdkComboboxModule],
declarations: [ComboboxToggle, DialogContent],
declarations: [ComboboxToggle, FakeDialogContent],
}).compileComponents();
}));

Expand Down Expand Up @@ -405,7 +405,7 @@ let id = 0;
'tabIndex': '-1'
}
})
export class DialogContent<V> implements OnInit {
export class FakeDialogContent<V> implements OnInit {

dialogId = `dialog-${id++}`;
role = 'dialog';
Expand Down
6 changes: 3 additions & 3 deletions src/cdk-experimental/combobox/combobox.ts
Expand Up @@ -43,7 +43,7 @@ const allowedOpenActions = ['focus', 'click', 'downKey', 'toggle'];
'class': 'cdk-combobox',
'(click)': '_handleInteractions("click")',
'(focus)': '_handleInteractions("focus")',
'(keydown)': 'keydown($event)',
'(keydown)': '_keydown($event)',
'(document:click)': '_attemptClose($event)',
'[attr.aria-disabled]': 'disabled',
'[attr.aria-owns]': 'contentId',
Expand Down Expand Up @@ -112,7 +112,7 @@ export class CdkCombobox<T = unknown> implements OnDestroy, AfterContentInit {
this.panelValueChanged.complete();
}

keydown(event: KeyboardEvent) {
_keydown(event: KeyboardEvent) {
const {keyCode} = event;

if (keyCode === DOWN_ARROW && this._openActions.indexOf('downKey') !== -1) {
Expand All @@ -123,7 +123,7 @@ export class CdkCombobox<T = unknown> implements OnDestroy, AfterContentInit {
}
}

_handleInteractions(interaction: string) {
_handleInteractions(interaction: OpenAction) {
if (interaction === 'click') {
if (this._openActions.indexOf('toggle') !== -1) {
this.toggle();
Expand Down

0 comments on commit ddff626

Please sign in to comment.