Skip to content

Commit 0a5ed02

Browse files
committed
use straight jasmine functions
1 parent 1b2c519 commit 0a5ed02

File tree

20 files changed

+12
-93
lines changed

20 files changed

+12
-93
lines changed

src/components/button/button.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {it, describe, expect, beforeEach, inject} from '@angular/core/testing';
1+
import {inject} from '@angular/core/testing';
22
import {TestComponentBuilder} from '@angular/compiler/testing';
33
import {Component} from '@angular/core';
44
import {By} from '@angular/platform-browser';

src/components/checkbox/checkbox.spec.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import {
2-
it,
3-
beforeEach,
42
beforeEachProviders,
53
inject,
64
async,
@@ -19,7 +17,6 @@ import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing'
1917
import {Component, DebugElement} from '@angular/core';
2018
import {By} from '@angular/platform-browser';
2119
import {MdCheckbox, MdCheckboxChange} from './checkbox';
22-
import {PromiseCompleter} from '@angular2-material/core/async/promise-completer';
2320

2421

2522

@@ -215,21 +212,14 @@ describe('MdCheckbox', () => {
215212
expect(testComponent.onCheckboxClick).toHaveBeenCalledTimes(1);
216213
});
217214

218-
it('should emit a change event when the `checked` value changes', () => {
219-
// TODO(jelbourn): this *should* work with async(), but fixture.whenStable currently doesn't
220-
// know to look at pending macro tasks.
221-
// See https://github.com/angular/angular/issues/8389
222-
// As a short-term solution, use a promise (which jasmine knows how to understand).
223-
let promiseCompleter = new PromiseCompleter();
224-
checkboxInstance.change.subscribe(() => {
225-
promiseCompleter.resolve();
226-
});
227-
215+
it('should emit a change event when the `checked` value changes', async(() => {
228216
testComponent.isChecked = true;
229217
fixture.detectChanges();
230218

231-
return promiseCompleter.promise;
232-
});
219+
fixture.whenStable().then(() => {
220+
expect(fixture.componentInstance.changeCount).toBe(1);
221+
});
222+
}));
233223

234224
describe('state transition css classes', () => {
235225
it('should transition unchecked -> checked -> unchecked', () => {
@@ -509,6 +499,7 @@ class SingleCheckbox {
509499
parentElementClicked: boolean = false;
510500
parentElementKeyedUp: boolean = false;
511501
lastKeydownEvent: Event = null;
502+
changeCount: number = 0;
512503

513504
onCheckboxClick(event: Event) {}
514505
}

src/components/grid-list/grid-list.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
import {
2-
it,
3-
describe,
4-
expect,
5-
beforeEach,
62
inject,
73
fakeAsync,
84
tick

src/components/icon/icon.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
import {
2-
it,
3-
describe,
4-
expect,
5-
beforeEach,
62
beforeEachProviders,
73
inject,
84
} from '@angular/core/testing';

src/components/input/input.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
import {
2-
describe,
3-
it,
4-
expect,
5-
beforeEach,
62
beforeEachProviders,
73
fakeAsync,
84
inject,

src/components/list/list.spec.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import {
2-
it,
3-
describe,
4-
expect,
5-
beforeEach,
6-
inject,
7-
} from '@angular/core/testing';
1+
import {inject} from '@angular/core/testing';
82
import {TestComponentBuilder} from '@angular/compiler/testing';
93
import {Component} from '@angular/core';
104
import {By} from '@angular/platform-browser';

src/components/menu/menu.spec.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import {
2-
it,
3-
describe,
4-
expect,
5-
beforeEach,
6-
inject,
7-
} from '@angular/core/testing';
1+
import {inject} from '@angular/core/testing';
82
import {TestComponentBuilder} from '@angular/compiler/testing';
93
import {Component} from '@angular/core';
104

src/components/progress-bar/progress-bar.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {beforeEach, describe, expect, inject, it} from '@angular/core/testing';
1+
import {inject} from '@angular/core/testing';
22
import {TestComponentBuilder} from '@angular/compiler/testing';
33
import {Component} from '@angular/core';
44
import {By} from '@angular/platform-browser';

src/components/progress-circle/progress-circle.spec.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import {
2-
it,
3-
describe,
4-
expect,
5-
beforeEach,
6-
inject,
7-
} from '@angular/core/testing';
1+
import {inject} from '@angular/core/testing';
82
import {TestComponentBuilder} from '@angular/compiler/testing';
93
import {Component, DebugElement} from '@angular/core';
104
import {By} from '@angular/platform-browser';

src/components/radio/radio.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
import {
2-
it,
3-
describe,
4-
beforeEach,
52
beforeEachProviders,
63
inject,
74
async,

src/components/sidenav/sidenav.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
import {
2-
it, iit,
3-
describe,
4-
expect,
5-
beforeEach,
62
fakeAsync,
73
async,
84
inject,

src/components/slide-toggle/slide-toggle.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
import {
2-
it,
3-
describe,
4-
expect,
5-
beforeEach,
62
beforeEachProviders,
73
inject,
84
async

src/components/tabs/tab-group.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import {
2-
it,
3-
expect,
4-
beforeEach,
52
inject,
6-
describe,
73
async,
84
fakeAsync,
95
tick

src/components/toolbar/toolbar.spec.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import {Component} from '@angular/core';
2-
import {
3-
it,
4-
describe,
5-
expect,
6-
beforeEach,
7-
inject,
8-
} from '@angular/core/testing';
2+
import {inject} from '@angular/core/testing';
93
import {TestComponentBuilder} from '@angular/compiler/testing';
104
import {By} from '@angular/platform-browser';
115
import {MdToolbar} from './toolbar';

src/core/a11y/live-announcer.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
import {
2-
it,
3-
describe,
4-
expect,
5-
beforeEach,
62
inject,
73
fakeAsync,
84
flushMicrotasks,

src/core/overlay/overlay-directives.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
import {
2-
it,
3-
describe,
4-
expect,
5-
beforeEach,
62
inject,
73
async,
84
fakeAsync,

src/core/overlay/overlay.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
import {
2-
it,
3-
describe,
4-
expect,
5-
beforeEach,
62
inject,
73
fakeAsync,
84
flushMicrotasks,

src/core/overlay/position/global-position-strategy.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
import {
2-
it,
3-
describe,
4-
expect,
5-
beforeEach,
62
inject,
73
fakeAsync,
84
flushMicrotasks,

src/core/overlay/position/viewport-ruler.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {it, describe, expect, beforeEach} from '@angular/core/testing';
21
import {ViewportRuler} from './viewport-ruler';
32

43

src/core/portal/portal.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
import {
2-
it,
3-
describe,
4-
expect,
5-
beforeEach,
62
inject,
73
fakeAsync,
84
flushMicrotasks

0 commit comments

Comments
 (0)