Skip to content

Commit

Permalink
test(BlockUIContentComponent): Add test coverage for non-delay (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuuurt13 committed Oct 21, 2019
1 parent a9f59b6 commit 20f785d
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { } from 'jasmine';
import { ComponentFixture, TestBed, fakeAsync } from '@angular/core/testing';
import { NgModule, Component, DebugElement } from '@angular/core';
import { By } from '@angular/platform-browser';

import { Observable } from 'rxjs';
import { BlockUIModule } from '../../block-ui.module';
import { BlockUIContentComponent } from '../block-ui-content/block-ui-content.component';
import { BlockUI } from '../../decorators/block-ui.decorator';
Expand Down Expand Up @@ -142,6 +142,26 @@ describe('block-ui-content component', () => {
jasmine.clock().tick(1);
expect(nativeElement.innerText).toBe(updatedMessage);
});

it('blockUI.start() is synchronous (issue #107)', () => {
function method() {
testCmp.blockUI.start();
}

const observable = Observable.create((observer: any) => {
observer.next('test');
});

testCmp.blockUI.start();

observable.subscribe(() => {
testCmp.blockUI.stop();
method();
});

let blockWrapper = cf.debugElement.query(By.css('div.block-ui-wrapper'));
expect(blockWrapper.classes.active).toBeTruthy();
});
});

describe('block-ui-content custom Component template', () => {
Expand Down

0 comments on commit 20f785d

Please sign in to comment.