mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
chore: remove FakeViewportRuler (#9386)
Now that all tests have been moved away from the `FakeViewportRuler`, we can safely get rid of it. In general we should avoid stubbing out the window dimensions, because it can be unreliable and it doesn't work well when something is positioned using `bottom` and `right`.
This commit is contained in:
committed by
Jeremy Elbourn
parent
c44f4aa2ce
commit
b491f7afab
@@ -1,24 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
/** @docs-private */
|
||||
export class FakeViewportRuler {
|
||||
getViewportRect() {
|
||||
return {
|
||||
left: 0, top: 0, width: 1014, height: 686, bottom: 686, right: 1014
|
||||
};
|
||||
}
|
||||
|
||||
getViewportSize() {
|
||||
return {width: 1014, height: 686};
|
||||
}
|
||||
|
||||
getViewportScrollPosition() {
|
||||
return {top: 0, left: 0};
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,4 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
|
||||
|
||||
export * from './public-api';
|
||||
|
||||
@@ -10,5 +10,4 @@ export * from './dispatch-events';
|
||||
export * from './event-objects';
|
||||
export * from './type-in-element';
|
||||
export * from './wrapped-error-message';
|
||||
export * from './fake-viewport-ruler';
|
||||
export * from './mock-ng-zone';
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {Component, DebugElement} from '@angular/core';
|
||||
import {By} from '@angular/platform-browser';
|
||||
import {ViewportRuler} from '@angular/cdk/scrolling';
|
||||
import {FakeViewportRuler} from '@angular/cdk/testing';
|
||||
import {MatButtonModule} from './index';
|
||||
import {MatRipple} from '@angular/material/core';
|
||||
|
||||
@@ -13,9 +11,6 @@ describe('MatButton', () => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [MatButtonModule],
|
||||
declarations: [TestApp],
|
||||
providers: [
|
||||
{provide: ViewportRuler, useClass: FakeViewportRuler},
|
||||
]
|
||||
});
|
||||
|
||||
TestBed.compileComponents();
|
||||
|
||||
@@ -2,8 +2,7 @@ import {async, ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/t
|
||||
import {FormControl, FormsModule, NgModel, ReactiveFormsModule} from '@angular/forms';
|
||||
import {Component, DebugElement} from '@angular/core';
|
||||
import {By} from '@angular/platform-browser';
|
||||
import {ViewportRuler} from '@angular/cdk/scrolling';
|
||||
import {dispatchFakeEvent, FakeViewportRuler} from '@angular/cdk/testing';
|
||||
import {dispatchFakeEvent} from '@angular/cdk/testing';
|
||||
import {RIPPLE_FADE_IN_DURATION, RIPPLE_FADE_OUT_DURATION} from '@angular/material/core';
|
||||
import {MatRadioButton, MatRadioChange, MatRadioGroup, MatRadioModule} from './index';
|
||||
|
||||
@@ -20,9 +19,6 @@ describe('MatRadio', () => {
|
||||
StandaloneRadioButtons,
|
||||
InterleavedRadioGroup,
|
||||
TranscludingWrapper
|
||||
],
|
||||
providers: [
|
||||
{provide: ViewportRuler, useClass: FakeViewportRuler}
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user