Skip to content

Commit 02c961b

Browse files
committed
fix: resolve unit test failures
1 parent 1f3301c commit 02c961b

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

src/examples/select-header/select-header-example.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<md-select placeholder="Favorite food" [(ngModel)]="currentDrink" name="food" #select="mdSelect">
1+
<md-select placeholder="Favorite food" [(ngModel)]="selectedValue" name="food" #select="mdSelect">
22
<md-select-header>
33
<input type="search" [(ngModel)]="searchString" role="combobox" [attr.aria-owns]="select.panelId"
44
(ngModelChange)="filterFoods()" placeholder="Search for food"/>

src/lib/select/select.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {
3131
} from '../core/placeholder/placeholder-options';
3232

3333

34-
fdescribe('MdSelect', () => {
34+
describe('MdSelect', () => {
3535
let overlayContainerElement: HTMLElement;
3636
let dir: {value: 'ltr'|'rtl'};
3737
let scrolledSubject = new Subject();
@@ -983,7 +983,7 @@ fdescribe('MdSelect', () => {
983983
trigger.click();
984984
groupFixture.detectChanges();
985985

986-
const scrollContainer = document.querySelector('.cdk-overlay-pane .mat-select-panel');
986+
const scrollContainer = document.querySelector('.cdk-overlay-pane .mat-select-content');
987987

988988
// The selected option should be scrolled to the center of the panel.
989989
// This will be its original offset from the scrollTop - half the panel height + half the

src/lib/select/select.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -802,9 +802,8 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
802802
// we must only adjust for the height difference between the option element
803803
// and the trigger element, then multiply it by -1 to ensure the panel moves
804804
// in the correct direction up the page.
805-
this._offsetY = (SELECT_ITEM_HEIGHT - SELECT_TRIGGER_HEIGHT) / 2 * -1;
806-
// this._offsetY = (SELECT_OPTION_HEIGHT - SELECT_TRIGGER_HEIGHT) / 2 * -1 -
807-
// (this.header ? SELECT_OPTION_HEIGHT : 0);
805+
this._offsetY = (SELECT_ITEM_HEIGHT - SELECT_TRIGGER_HEIGHT) / 2 * -1 -
806+
(this.header ? SELECT_ITEM_HEIGHT : 0);
808807
}
809808

810809
this._checkOverlayWithinViewport(maxScroll);
@@ -958,7 +957,6 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
958957
const panelHeightTop = Math.abs(this._offsetY);
959958
const totalPanelHeight =
960959
Math.min(this._getItemCount() * SELECT_ITEM_HEIGHT, SELECT_PANEL_MAX_HEIGHT);
961-
// Math.min(this.options.length * SELECT_OPTION_HEIGHT, SELECT_PANEL_MAX_HEIGHT);
962960
const panelHeightBottom = totalPanelHeight - panelHeightTop - triggerRect.height;
963961

964962
if (panelHeightBottom > bottomSpaceAvailable) {

0 commit comments

Comments
 (0)