Skip to content

Commit

Permalink
chore: fix test compilation errors (angular#8560)
Browse files Browse the repository at this point in the history
Fixes some more test compilation issues after removing the `extendObject`.
  • Loading branch information
crisbeto authored and jelbourn committed Nov 20, 2017
1 parent 7bcb0d8 commit 40d6bcb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
14 changes: 5 additions & 9 deletions src/lib/menu/menu.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
MatMenuItem,
} from './index';
import {MENU_PANEL_TOP_PADDING} from './menu-trigger';
import {extendObject, MatRipple} from '@angular/material/core';
import {MatRipple} from '@angular/material/core';
import {
dispatchKeyboardEvent,
dispatchMouseEvent,
Expand Down Expand Up @@ -438,11 +438,11 @@ describe('MatMenu', () => {
*/
class OverlapSubject<T extends TestableMenu> {
readonly fixture: ComponentFixture<T>;
readonly trigger: any;
readonly trigger: HTMLElement;

constructor(ctor: {new(): T; }, inputs: {[key: string]: any} = {}) {
this.fixture = TestBed.createComponent(ctor);
extendObject(this.fixture.componentInstance, inputs);
Object.keys(inputs).forEach(key => this.fixture.componentInstance[key] = inputs[key]);
this.fixture.detectChanges();
this.trigger = this.fixture.componentInstance.triggerEl.nativeElement;
}
Expand All @@ -452,11 +452,6 @@ describe('MatMenu', () => {
this.fixture.detectChanges();
}

updateTriggerStyle(style: any) {
return extendObject(this.trigger.style, style);
}


get overlayRect() {
return this.overlayPane.getBoundingClientRect();
}
Expand Down Expand Up @@ -507,7 +502,8 @@ describe('MatMenu', () => {
it('supports above position fall back', () => {
// Push trigger to the bottom part of viewport, so it doesn't have space to open
// in its default "below" position below the trigger.
subject.updateTriggerStyle({position: 'fixed', bottom: '0'});
subject.trigger.style.position = 'fixed';
subject.trigger.style.bottom = '0';
subject.openMenu();

// Since the menu is above the trigger, the overlay bottom should be the trigger top.
Expand Down
3 changes: 1 addition & 2 deletions src/lib/select/select.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import {
} from '@angular/forms';
import {
ErrorStateMatcher,
extendObject,
FloatPlaceholderType,
MAT_PLACEHOLDER_GLOBAL_OPTIONS,
MatOption,
Expand Down Expand Up @@ -3984,7 +3983,7 @@ class NgModelCompareWithSelect {
compareByReference(f1: any, f2: any) { return f1 === f2; }

setFoodByCopy(newValue: {value: string, viewValue: string}) {
this.selectedFood = extendObject({}, newValue);
this.selectedFood = {...{}, ...newValue};
}
}

Expand Down

0 comments on commit 40d6bcb

Please sign in to comment.