Skip to content

Commit 44a28a2

Browse files
committed
autocomplete changes
1 parent 911e057 commit 44a28a2

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

src/lib/autocomplete/autocomplete.spec.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -345,19 +345,19 @@ describe('MdAutocomplete', () => {
345345

346346
it('should disable input in view when disabled programmatically', () => {
347347
const inputUnderline =
348-
fixture.debugElement.query(By.css('.md-input-underline')).nativeElement;
348+
fixture.debugElement.query(By.css('.mat-input-underline')).nativeElement;
349349

350350
expect(input.disabled)
351351
.toBe(false, `Expected input to start out enabled in view.`);
352-
expect(inputUnderline.classList.contains('md-disabled'))
352+
expect(inputUnderline.classList.contains('mat-disabled'))
353353
.toBe(false, `Expected input underline to start out with normal styles.`);
354354

355355
fixture.componentInstance.stateCtrl.disable();
356356
fixture.detectChanges();
357357

358358
expect(input.disabled)
359359
.toBe(true, `Expected input to be disabled in view when disabled programmatically.`);
360-
expect(inputUnderline.classList.contains('md-disabled'))
360+
expect(inputUnderline.classList.contains('mat-disabled'))
361361
.toBe(true, `Expected input underline to display disabled styles.`);
362362
});
363363

@@ -469,8 +469,8 @@ describe('MdAutocomplete', () => {
469469
fixture.detectChanges();
470470
expect(fixture.componentInstance.trigger.activeOption)
471471
.toBe(fixture.componentInstance.options.first, 'Expected first option to be active.');
472-
expect(optionEls[0].classList).toContain('md-active');
473-
expect(optionEls[1].classList).not.toContain('md-active');
472+
expect(optionEls[0].classList).toContain('mat-active');
473+
expect(optionEls[1].classList).not.toContain('mat-active');
474474

475475
fixture.componentInstance.trigger._handleKeydown(DOWN_ARROW_EVENT);
476476

@@ -479,8 +479,8 @@ describe('MdAutocomplete', () => {
479479
expect(fixture.componentInstance.trigger.activeOption)
480480
.toBe(fixture.componentInstance.options.toArray()[1],
481481
'Expected second option to be active.');
482-
expect(optionEls[0].classList).not.toContain('md-active');
483-
expect(optionEls[1].classList).toContain('md-active');
482+
expect(optionEls[0].classList).not.toContain('mat-active');
483+
expect(optionEls[1].classList).toContain('mat-active');
484484
});
485485
});
486486
});
@@ -498,8 +498,8 @@ describe('MdAutocomplete', () => {
498498
fixture.detectChanges();
499499
expect(fixture.componentInstance.trigger.activeOption)
500500
.toBe(fixture.componentInstance.options.last, 'Expected last option to be active.');
501-
expect(optionEls[10].classList).toContain('md-active');
502-
expect(optionEls[0].classList).not.toContain('md-active');
501+
expect(optionEls[10].classList).toContain('mat-active');
502+
expect(optionEls[0].classList).not.toContain('mat-active');
503503

504504
fixture.componentInstance.trigger._handleKeydown(DOWN_ARROW_EVENT);
505505

@@ -508,8 +508,8 @@ describe('MdAutocomplete', () => {
508508
expect(fixture.componentInstance.trigger.activeOption)
509509
.toBe(fixture.componentInstance.options.first,
510510
'Expected first option to be active.');
511-
expect(optionEls[0].classList).toContain('md-active');
512-
expect(optionEls[10].classList).not.toContain('md-active');
511+
expect(optionEls[0].classList).toContain('mat-active');
512+
expect(optionEls[10].classList).not.toContain('mat-active');
513513
});
514514
});
515515
});
@@ -535,8 +535,8 @@ describe('MdAutocomplete', () => {
535535
expect(fixture.componentInstance.trigger.activeOption)
536536
.toBe(fixture.componentInstance.options.first,
537537
'Expected first option to be active.');
538-
expect(optionEls[0].classList).toContain('md-active');
539-
expect(optionEls[1].classList).not.toContain('md-active');
538+
expect(optionEls[0].classList).toContain('mat-active');
539+
expect(optionEls[1].classList).not.toContain('mat-active');
540540
});
541541
});
542542
});
@@ -607,7 +607,7 @@ describe('MdAutocomplete', () => {
607607

608608
it('should scroll to active options below the fold', async(() => {
609609
fixture.whenStable().then(() => {
610-
const scrollContainer = document.querySelector('.cdk-overlay-pane .md-autocomplete-panel');
610+
const scrollContainer = document.querySelector('.cdk-overlay-pane .mat-autocomplete-panel');
611611

612612
fixture.componentInstance.trigger._handleKeydown(DOWN_ARROW_EVENT);
613613
fixture.detectChanges();
@@ -646,7 +646,7 @@ describe('MdAutocomplete', () => {
646646
fixture.componentInstance.trigger.openPanel();
647647
fixture.detectChanges();
648648

649-
const panel = fixture.debugElement.query(By.css('.md-autocomplete-panel')).nativeElement;
649+
const panel = fixture.debugElement.query(By.css('.mat-autocomplete-panel')).nativeElement;
650650

651651
expect(panel.getAttribute('role'))
652652
.toEqual('listbox', 'Expected role of the panel to be listbox.');
@@ -709,7 +709,7 @@ describe('MdAutocomplete', () => {
709709
fixture.componentInstance.trigger.openPanel();
710710
fixture.detectChanges();
711711

712-
const panel = fixture.debugElement.query(By.css('.md-autocomplete-panel')).nativeElement;
712+
const panel = fixture.debugElement.query(By.css('.mat-autocomplete-panel')).nativeElement;
713713

714714
expect(input.getAttribute('aria-owns'))
715715
.toEqual(panel.getAttribute('id'), 'Expected aria-owns to match attached autocomplete.');
@@ -734,7 +734,7 @@ describe('MdAutocomplete', () => {
734734
fixture.detectChanges();
735735

736736
const inputBottom = input.getBoundingClientRect().bottom;
737-
const panel = overlayContainerElement.querySelector('.md-autocomplete-panel');
737+
const panel = overlayContainerElement.querySelector('.mat-autocomplete-panel');
738738
const panelTop = panel.getBoundingClientRect().top;
739739

740740
// Panel is offset by 6px in styles so that the underline has room to display.
@@ -753,7 +753,7 @@ describe('MdAutocomplete', () => {
753753
fixture.detectChanges();
754754

755755
const inputTop = input.getBoundingClientRect().top;
756-
const panel = overlayContainerElement.querySelector('.md-autocomplete-panel');
756+
const panel = overlayContainerElement.querySelector('.mat-autocomplete-panel');
757757
const panelBottom = panel.getBoundingClientRect().bottom;
758758

759759
// Panel is offset by 24px in styles so that the label has room to display.
@@ -777,7 +777,7 @@ describe('MdAutocomplete', () => {
777777
fixture.detectChanges();
778778

779779
const inputTop = input.getBoundingClientRect().top;
780-
const panel = overlayContainerElement.querySelector('.md-autocomplete-panel');
780+
const panel = overlayContainerElement.querySelector('.mat-autocomplete-panel');
781781
const panelBottom = panel.getBoundingClientRect().bottom;
782782

783783
// Panel is offset by 24px in styles so that the label has room to display.

src/lib/autocomplete/autocomplete.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ export type AutocompletePositionY = 'above' | 'below';
2424
templateUrl: 'autocomplete.html',
2525
styleUrls: ['autocomplete.css'],
2626
encapsulation: ViewEncapsulation.None,
27-
exportAs: 'mdAutocomplete'
27+
exportAs: 'mdAutocomplete',
28+
host: {
29+
'class': 'mat-autocomplete'
30+
}
2831
})
2932
export class MdAutocomplete {
3033

@@ -54,8 +57,8 @@ export class MdAutocomplete {
5457
/** Sets a class on the panel based on its position (used to set y-offset). */
5558
_getPositionClass() {
5659
return {
57-
'md-autocomplete-panel-below': this.positionY === 'below',
58-
'md-autocomplete-panel-above': this.positionY === 'above'
60+
'mat-autocomplete-panel-below': this.positionY === 'below',
61+
'mat-autocomplete-panel-above': this.positionY === 'above'
5962
};
6063
}
6164

0 commit comments

Comments
 (0)