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:
Kristiyan Kostadinov
2018-01-23 16:44:48 +01:00
committed by Jeremy Elbourn
parent c44f4aa2ce
commit b491f7afab
5 changed files with 1 additions and 37 deletions
-24
View File
@@ -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};
}
}
-2
View File
@@ -6,6 +6,4 @@
* found in the LICENSE file at https://angular.io/license
*/
export * from './public-api';
-1
View File
@@ -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';
-5
View File
@@ -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();
+1 -5
View File
@@ -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}
]
});