Skip to content

Commit 40d6bcb

Browse files
crisbetojelbourn
authored andcommitted
chore: fix test compilation errors (#8560)
Fixes some more test compilation issues after removing the `extendObject`.
1 parent 7bcb0d8 commit 40d6bcb

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

src/lib/menu/menu.spec.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
MatMenuItem,
2727
} from './index';
2828
import {MENU_PANEL_TOP_PADDING} from './menu-trigger';
29-
import {extendObject, MatRipple} from '@angular/material/core';
29+
import {MatRipple} from '@angular/material/core';
3030
import {
3131
dispatchKeyboardEvent,
3232
dispatchMouseEvent,
@@ -438,11 +438,11 @@ describe('MatMenu', () => {
438438
*/
439439
class OverlapSubject<T extends TestableMenu> {
440440
readonly fixture: ComponentFixture<T>;
441-
readonly trigger: any;
441+
readonly trigger: HTMLElement;
442442

443443
constructor(ctor: {new(): T; }, inputs: {[key: string]: any} = {}) {
444444
this.fixture = TestBed.createComponent(ctor);
445-
extendObject(this.fixture.componentInstance, inputs);
445+
Object.keys(inputs).forEach(key => this.fixture.componentInstance[key] = inputs[key]);
446446
this.fixture.detectChanges();
447447
this.trigger = this.fixture.componentInstance.triggerEl.nativeElement;
448448
}
@@ -452,11 +452,6 @@ describe('MatMenu', () => {
452452
this.fixture.detectChanges();
453453
}
454454

455-
updateTriggerStyle(style: any) {
456-
return extendObject(this.trigger.style, style);
457-
}
458-
459-
460455
get overlayRect() {
461456
return this.overlayPane.getBoundingClientRect();
462457
}
@@ -507,7 +502,8 @@ describe('MatMenu', () => {
507502
it('supports above position fall back', () => {
508503
// Push trigger to the bottom part of viewport, so it doesn't have space to open
509504
// in its default "below" position below the trigger.
510-
subject.updateTriggerStyle({position: 'fixed', bottom: '0'});
505+
subject.trigger.style.position = 'fixed';
506+
subject.trigger.style.bottom = '0';
511507
subject.openMenu();
512508

513509
// Since the menu is above the trigger, the overlay bottom should be the trigger top.

src/lib/select/select.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import {
4040
} from '@angular/forms';
4141
import {
4242
ErrorStateMatcher,
43-
extendObject,
4443
FloatPlaceholderType,
4544
MAT_PLACEHOLDER_GLOBAL_OPTIONS,
4645
MatOption,
@@ -3984,7 +3983,7 @@ class NgModelCompareWithSelect {
39843983
compareByReference(f1: any, f2: any) { return f1 === f2; }
39853984

39863985
setFoodByCopy(newValue: {value: string, viewValue: string}) {
3987-
this.selectedFood = extendObject({}, newValue);
3986+
this.selectedFood = {...{}, ...newValue};
39883987
}
39893988
}
39903989

0 commit comments

Comments
 (0)