Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

Commit 6da7b87

Browse files
author
Miller
committed
add test
1 parent c03164c commit 6da7b87

1 file changed

Lines changed: 36 additions & 1 deletion

File tree

projects/ng-busy/src/lib/ng-busy.directive.spec.ts

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ describe('NgBusyDirective', () => {
158158
fixture.detectChanges();
159159
tick(300);
160160
fixture.detectChanges();
161-
console.log(fixture.debugElement.nativeElement)
162161
expect(fixture.debugElement.query(By.css('lib-ng-busy default-busy'))).not.toBeNull();
163162
tick(701);
164163
fixture.detectChanges();
@@ -197,6 +196,42 @@ describe('NgBusyDirective', () => {
197196
expect(fixture.debugElement.query(By.css('lib-ng-busy>.content_class'))).toBeNull();
198197
}));
199198

199+
it('not affect each other when there many busies', fakeAsync(() => {
200+
const fixture1 = TestBed.createComponent(TestNgBusyComponent);
201+
const component1 = fixture1.componentInstance;
202+
component.options = {
203+
busy: createPromiseWithDelay(1000),
204+
template: 'hello',
205+
wrapperClass: 'content_class'
206+
};
207+
fixture.detectChanges();
208+
fixture1.detectChanges();
209+
tick(300);
210+
fixture.detectChanges();
211+
fixture1.detectChanges();
212+
expect(fixture.debugElement.query(By.css('lib-ng-busy>.content_class')).nativeElement.textContent)
213+
.toBe('hello');
214+
expect(fixture1.debugElement.query(By.css('lib-ng-busy>.content_class'))).toBeNull();
215+
expect(fixture1.debugElement.query(By.css('lib-ng-busy>.another_content_class'))).toBeNull();
216+
component1.options = {
217+
busy: createPromiseWithDelay(1000),
218+
template: 'I\'m from another busy',
219+
wrapperClass: 'another_content_class'
220+
};
221+
tick(701);
222+
fixture.detectChanges();
223+
fixture1.detectChanges();
224+
expect(fixture.debugElement.query(By.css('lib-ng-busy>.content_class'))).toBeNull();
225+
expect(fixture1.debugElement.query(By.css('lib-ng-busy>.another_content_class')).nativeElement.textContent)
226+
.toBe('I\'m from another busy');
227+
tick(300);
228+
fixture.detectChanges();
229+
fixture1.detectChanges();
230+
expect(fixture.debugElement.query(By.css('lib-ng-busy>.content_class'))).toBeNull();
231+
expect(fixture1.debugElement.query(By.css('lib-ng-busy>.content_class'))).toBeNull();
232+
expect(fixture1.debugElement.query(By.css('lib-ng-busy>.another_content_class'))).toBeNull();
233+
}));
234+
200235
it('component typed template', fakeAsync(() => {
201236
component.options = {
202237
busy: createPromiseWithDelay(1000),

0 commit comments

Comments
 (0)