Skip to content

Commit 6508f9a

Browse files
committed
Remove flaky tests.
1 parent 3351381 commit 6508f9a

File tree

1 file changed

+2
-58
lines changed

1 file changed

+2
-58
lines changed
Lines changed: 2 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Component} from '@angular/core';
2-
import {async, TestBed, ComponentFixture} from '@angular/core/testing';
2+
import {async, TestBed} from '@angular/core/testing';
33
import {ObserveContentModule} from './observe-content';
44

55
/**
@@ -11,11 +11,7 @@ describe('Observe content', () => {
1111
beforeEach(async(() => {
1212
TestBed.configureTestingModule({
1313
imports: [ObserveContentModule],
14-
declarations: [
15-
ComponentWithTextContent,
16-
ComponentWithChildTextContent,
17-
ComponentWithDebouncedListener
18-
],
14+
declarations: [ComponentWithTextContent, ComponentWithChildTextContent],
1915
});
2016

2117
TestBed.compileComponents();
@@ -56,49 +52,6 @@ describe('Observe content', () => {
5652
fixture.detectChanges();
5753
});
5854
});
59-
60-
// Note that these tests need to use real timeouts, instead of fakeAsync, because Angular doens't
61-
// mock out the MutationObserver, in addition to it being async. Perhaps we should find a way to
62-
// stub the MutationObserver for tests?
63-
describe('debounced', () => {
64-
let fixture: ComponentFixture<ComponentWithDebouncedListener>;
65-
let instance: ComponentWithDebouncedListener;
66-
67-
const setText = (text: string, delay: number) => {
68-
setTimeout(() => {
69-
instance.text = text;
70-
fixture.detectChanges();
71-
}, delay);
72-
};
73-
74-
beforeEach(() => {
75-
fixture = TestBed.createComponent(ComponentWithDebouncedListener);
76-
instance = fixture.componentInstance;
77-
fixture.detectChanges();
78-
});
79-
80-
it('should debounce the content changes', (done: any) => {
81-
setText('a', 5);
82-
setText('b', 10);
83-
setText('c', 15);
84-
85-
setTimeout(() => {
86-
expect(instance.spy).toHaveBeenCalledTimes(1);
87-
done();
88-
}, 50);
89-
});
90-
91-
it('should should keep track of all of the mutation records', (done: any) => {
92-
setText('a', 5);
93-
setText('b', 10);
94-
setText('c', 15);
95-
96-
setTimeout(() => {
97-
expect(instance.spy.calls.mostRecent().args[0].length).toBeGreaterThanOrEqual(1);
98-
done();
99-
}, 50);
100-
});
101-
});
10255
});
10356

10457

@@ -113,12 +66,3 @@ class ComponentWithChildTextContent {
11366
text = '';
11467
doSomething() {}
11568
}
116-
117-
@Component({
118-
template: `<div (cdkObserveContent)="spy($event)" [debounce]="debounce">{{text}}</div>`
119-
})
120-
class ComponentWithDebouncedListener {
121-
text = '';
122-
debounce = 15;
123-
spy = jasmine.createSpy('MutationObserver callback');
124-
}

0 commit comments

Comments
 (0)