Skip to content

Commit dc8eb24

Browse files
authored
chore(ripple): remove TestComponentBuilder (#1033)
* chore(ripple): remove TestComponentBuilder * remove async
1 parent 84572bb commit dc8eb24

File tree

1 file changed

+20
-34
lines changed

1 file changed

+20
-34
lines changed

src/core/ripple/ripple.spec.ts

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
import {
2-
TestBed,
3-
inject,
4-
async,
5-
TestComponentBuilder,
6-
ComponentFixture,
7-
} from '@angular/core/testing';
1+
import {TestBed, ComponentFixture} from '@angular/core/testing';
82
import {Component, ViewChild} from '@angular/core';
93
import {MdRipple, MdRippleModule} from './ripple';
104

5+
116
/** Creates a DOM event to indicate that a CSS transition for the given property ended. */
127
const createTransitionEndEvent = (propertyName: string) => {
138
// The "new" TransitionEvent constructor isn't available in anything except Firefox:
@@ -61,18 +56,17 @@ const pxStringToFloat = (s: string) => {
6156
};
6257

6358
describe('MdRipple', () => {
64-
let builder: TestComponentBuilder;
6559
let fixture: ComponentFixture<any>;
6660
let rippleElement: HTMLElement;
6761
let rippleBackground: Element;
6862
let originalBodyMargin: string;
6963

70-
beforeEach(async(() => {
64+
beforeEach(() => {
7165
TestBed.configureTestingModule({
7266
imports: [MdRippleModule],
7367
declarations: [BasicRippleContainer, RippleContainerWithInputBindings],
7468
});
75-
}));
69+
});
7670

7771
beforeEach(() => {
7872
// Set body margin to 0 during tests so it doesn't mess up position calculations.
@@ -84,21 +78,15 @@ describe('MdRipple', () => {
8478
document.body.style.margin = originalBodyMargin;
8579
});
8680

87-
beforeEach(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
88-
builder = tcb;
89-
}));
90-
9181
describe('basic ripple', () => {
92-
beforeEach(async(() => {
93-
builder.createAsync(BasicRippleContainer).then(f => {
94-
fixture = f;
95-
fixture.detectChanges();
82+
beforeEach(() => {
83+
fixture = TestBed.createComponent(BasicRippleContainer);
84+
fixture.detectChanges();
9685

97-
rippleElement = fixture.debugElement.nativeElement.querySelector('[md-ripple]');
98-
rippleBackground = rippleElement.querySelector('.md-ripple-background');
99-
expect(rippleBackground).toBeTruthy();
100-
});
101-
}));
86+
rippleElement = fixture.debugElement.nativeElement.querySelector('[md-ripple]');
87+
rippleBackground = rippleElement.querySelector('.md-ripple-background');
88+
expect(rippleBackground).toBeTruthy();
89+
});
10290

10391
it('shows background when parent receives mousedown event', () => {
10492
expect(rippleBackground.classList).not.toContain('md-ripple-active');
@@ -198,18 +186,16 @@ describe('MdRipple', () => {
198186
let controller: RippleContainerWithInputBindings;
199187
let rippleComponent: MdRipple;
200188

201-
beforeEach(async(() => {
202-
builder.createAsync(RippleContainerWithInputBindings).then(f => {
203-
fixture = f;
204-
fixture.detectChanges();
189+
beforeEach(() => {
190+
fixture = TestBed.createComponent(RippleContainerWithInputBindings);
191+
fixture.detectChanges();
205192

206-
controller = fixture.debugElement.componentInstance;
207-
rippleComponent = controller.ripple;
208-
rippleElement = fixture.debugElement.nativeElement.querySelector('[md-ripple]');
209-
rippleBackground = rippleElement.querySelector('.md-ripple-background');
210-
expect(rippleBackground).toBeTruthy();
211-
});
212-
}));
193+
controller = fixture.debugElement.componentInstance;
194+
rippleComponent = controller.ripple;
195+
rippleElement = fixture.debugElement.nativeElement.querySelector('[md-ripple]');
196+
rippleBackground = rippleElement.querySelector('.md-ripple-background');
197+
expect(rippleBackground).toBeTruthy();
198+
});
213199

214200
it('sets ripple background color', () => {
215201
// This depends on the exact color format that getComputedStyle returns; for example, alpha

0 commit comments

Comments
 (0)