Skip to content

Commit

Permalink
test(module:core): fix wave test
Browse files Browse the repository at this point in the history
  • Loading branch information
hsuanxyz committed Jun 6, 2019
1 parent 7a20f96 commit d0250b8
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions components/core/wave/nz-wave.spec.ts
Expand Up @@ -185,9 +185,8 @@ describe('nz-wave extra', () => {
});
});

describe('nz-wave disable/enable', () => {
describe('nz-wave NoopAnimationsModule', () => {
let fixture: ComponentFixture<WaveContainerWithButtonComponent>;
let waveTarget: HTMLElement;
let waveRef: NzWaveDirective;
beforeEach(() => {
TestBed.configureTestingModule({
Expand All @@ -196,25 +195,43 @@ describe('nz-wave disable/enable', () => {
});
});

describe('disable/enable', () => {
describe('NoopAnimationsModule', () => {
beforeEach(() => {
fixture = TestBed.createComponent(WaveContainerWithButtonComponent);
fixture.detectChanges();
waveTarget = fixture.componentInstance.trigger.nativeElement;
waveRef = fixture.componentInstance.wave;
});

it('should disable by NoopAnimationsModule ', () => {
expect(waveRef.disabled).toBe(true);
expect(waveRef.rendererRef).toBeFalsy();
waveRef.disable();
expect(waveRef.rendererRef).toBeFalsy();
});

it('should create waveRenderer when called enable', () => {
it('should config priority', () => {
waveRef.enable();
expect(waveRef.disabled).toBe(false);
expect(waveRef.rendererRef).toBeTruthy();
expect(waveRef.disabled).toBe(true);
expect(waveRef.rendererRef).toBeFalsy();
});
});
});

describe('nz-wave disable/enable', () => {
let fixture: ComponentFixture<WaveContainerWithButtonComponent>;
let waveTarget: HTMLElement;
let waveRef: NzWaveDirective;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [NzWaveModule],
declarations: [WaveContainerWithButtonComponent]
});
});

describe('disable/enable', () => {
beforeEach(() => {
fixture = TestBed.createComponent(WaveContainerWithButtonComponent);
fixture.detectChanges();
waveTarget = fixture.componentInstance.trigger.nativeElement;
waveRef = fixture.componentInstance.wave;
});

it('should enable work', () => {
Expand All @@ -229,7 +246,6 @@ describe('nz-wave disable/enable', () => {
it('should disable work', () => {
waveRef.disable();
expect(waveRef.disabled).toBe(true);
expect(waveRef.rendererRef).toBeFalsy();
dispatchMouseEvent(waveTarget, 'click');
expect(waveTarget.hasAttribute(WAVE_ATTRIBUTE_NAME)).toBe(false);
expect(document.body.querySelector('style') === null).toBe(true);
Expand Down

0 comments on commit d0250b8

Please sign in to comment.