Skip to content

chore(ripple): remove TestComponentBuilder #1033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 15, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 20 additions & 34 deletions src/core/ripple/ripple.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import {
TestBed,
inject,
async,
TestComponentBuilder,
ComponentFixture,
} from '@angular/core/testing';
import {TestBed, ComponentFixture} from '@angular/core/testing';
import {Component, ViewChild} from '@angular/core';
import {MdRipple, MdRippleModule} from './ripple';


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

describe('MdRipple', () => {
let builder: TestComponentBuilder;
let fixture: ComponentFixture<any>;
let rippleElement: HTMLElement;
let rippleBackground: Element;
let originalBodyMargin: string;

beforeEach(async(() => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [MdRippleModule],
declarations: [BasicRippleContainer, RippleContainerWithInputBindings],
});
}));
});

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

beforeEach(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
builder = tcb;
}));

describe('basic ripple', () => {
beforeEach(async(() => {
builder.createAsync(BasicRippleContainer).then(f => {
fixture = f;
fixture.detectChanges();
beforeEach(() => {
fixture = TestBed.createComponent(BasicRippleContainer);
fixture.detectChanges();

rippleElement = fixture.debugElement.nativeElement.querySelector('[md-ripple]');
rippleBackground = rippleElement.querySelector('.md-ripple-background');
expect(rippleBackground).toBeTruthy();
});
}));
rippleElement = fixture.debugElement.nativeElement.querySelector('[md-ripple]');
rippleBackground = rippleElement.querySelector('.md-ripple-background');
expect(rippleBackground).toBeTruthy();
});

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

beforeEach(async(() => {
builder.createAsync(RippleContainerWithInputBindings).then(f => {
fixture = f;
fixture.detectChanges();
beforeEach(() => {
fixture = TestBed.createComponent(RippleContainerWithInputBindings);
fixture.detectChanges();

controller = fixture.debugElement.componentInstance;
rippleComponent = controller.ripple;
rippleElement = fixture.debugElement.nativeElement.querySelector('[md-ripple]');
rippleBackground = rippleElement.querySelector('.md-ripple-background');
expect(rippleBackground).toBeTruthy();
});
}));
controller = fixture.debugElement.componentInstance;
rippleComponent = controller.ripple;
rippleElement = fixture.debugElement.nativeElement.querySelector('[md-ripple]');
rippleBackground = rippleElement.querySelector('.md-ripple-background');
expect(rippleBackground).toBeTruthy();
});

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