Skip to content

Commit 1b2c519

Browse files
committed
tests are passing
1 parent fe588d0 commit 1b2c519

File tree

6 files changed

+48
-42
lines changed

6 files changed

+48
-42
lines changed

package.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@
2828
"node": ">= 4.2.1 < 5"
2929
},
3030
"dependencies": {
31-
"@angular/common": "2.0.0-rc.3",
32-
"@angular/compiler": "2.0.0-rc.3",
33-
"@angular/core": "2.0.0-rc.3",
34-
"@angular/http": "2.0.0-rc.3",
35-
"@angular/platform-browser": "2.0.0-rc.3",
36-
"@angular/platform-browser-dynamic": "2.0.0-rc.3",
31+
"@angular/common": "2.0.0-rc.4",
32+
"@angular/compiler": "2.0.0-rc.4",
33+
"@angular/core": "2.0.0-rc.4",
34+
"@angular/http": "2.0.0-rc.4",
35+
"@angular/platform-browser": "2.0.0-rc.4",
36+
"@angular/platform-browser-dynamic": "2.0.0-rc.4",
3737
"@angular/router": "v3.0.0-alpha.8",
3838
"@angular/forms": "^0.1.0",
3939
"core-js": "^2.4.0",
4040
"hammerjs": "^2.0.8",
4141
"rxjs": "5.0.0-beta.6",
42-
"systemjs": "0.19.26",
42+
"systemjs": "0.19.31",
4343
"zone.js": "0.6.12"
4444
},
4545
"devDependencies": {
@@ -56,24 +56,24 @@
5656
"glob": "^6.0.4",
5757
"jasmine-core": "^2.4.1",
5858
"js-yaml": "^3.5.2",
59-
"karma": "^0.13.15",
60-
"karma-browserstack-launcher": "^0.1.7",
61-
"karma-chrome-launcher": "^0.2.3",
62-
"karma-firefox-launcher": "^0.1.7",
63-
"karma-jasmine": "^0.3.8",
64-
"karma-sauce-launcher": "^0.2.14",
65-
"madge": "^0.5.3",
59+
"karma": "^1.1.1",
60+
"karma-browserstack-launcher": "^1.0.1",
61+
"karma-chrome-launcher": "^1.0.1",
62+
"karma-firefox-launcher": "^1.0.0",
63+
"karma-jasmine": "^1.0.2",
64+
"karma-sauce-launcher": "^1.0.0",
65+
"madge": "^0.6.0",
6666
"node-sass": "^3.4.2",
6767
"protractor": "^3.3.0",
6868
"protractor-accessibility-plugin": "0.1.1",
6969
"sass": "^0.5.0",
7070
"strip-ansi": "^3.0.0",
71-
"stylelint": "^6.5.1",
71+
"stylelint": "^6.9.0",
7272
"symlink-or-copy": "^1.0.1",
7373
"ts-node": "^0.7.3",
74-
"tslint": "^3.5.0",
75-
"typescript": "^1.9.0-dev",
76-
"typings": "^1.0.4",
74+
"tslint": "^3.13.0",
75+
"typescript": "^2.0.0",
76+
"typings": "^1.3.1",
7777
"which": "^1.2.4"
7878
}
7979
}

src/components/icon/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
},
2222
"homepage": "https://github.com/angular/material2#readme",
2323
"peerDependencies": {
24-
"@angular/http": "2.0.0-rc.3",
24+
"@angular/http": "2.0.0-rc.4",
2525
"@angular2-material/core": "2.0.0-alpha.6"
2626
}
2727
}

src/components/sidenav/sidenav.spec.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
import {
2-
it,
2+
it, iit,
33
describe,
44
expect,
55
beforeEach,
66
fakeAsync,
7+
async,
78
inject,
8-
injectAsync,
99
tick
1010
} from '@angular/core/testing';
1111
import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing';
1212
import {XHR} from '@angular/compiler';
1313
import {
1414
Component,
15-
Type,
1615
ViewMetadata
1716
} from '@angular/core';
1817

@@ -28,14 +27,14 @@ function fakeAsyncAdaptor(fn: () => void) {
2827
/**
2928
* Create a ComponentFixture from the builder. This takes a template and a style for sidenav.
3029
*/
31-
function createFixture(appType: Type, builder: TestComponentBuilder,
30+
function createFixture(appType: any, builder: TestComponentBuilder,
3231
template: string, style: string): ComponentFixture<any> {
3332
let fixture: ComponentFixture<any> = null;
3433
// Remove the styles (which remove the animations/transitions).
3534
builder
3635
.overrideView(MdSidenavLayout, new ViewMetadata({
3736
template: template,
38-
styles: [style],
37+
styles: [style || ''],
3938
directives: [MdSidenav],
4039
}))
4140
.createAsync(appType).then((f: ComponentFixture<any>) => {
@@ -61,6 +60,12 @@ describe('MdSidenav', () => {
6160
let template: string;
6261
let style: string;
6362
let builder: TestComponentBuilder;
63+
let xhr: XHR;
64+
65+
beforeEach(inject([TestComponentBuilder, XHR], (tcb: TestComponentBuilder, x: XHR) => {
66+
builder = tcb;
67+
xhr = x;
68+
}));
6469

6570
/**
6671
* We need to get the template and styles for the sidenav in an Async test.
@@ -69,14 +74,12 @@ describe('MdSidenav', () => {
6974
* We do some style verification so styles have to match.
7075
* But we remove the transitions so we only set the regular `sidenav.css` styling.
7176
*/
72-
beforeEach(injectAsync([TestComponentBuilder, XHR], (tcb: TestComponentBuilder, xhr: XHR) => {
73-
builder = tcb;
74-
77+
beforeEach(async(() => {
7578
return Promise.all([
76-
xhr.get('./components/sidenav/sidenav.html').then((t) => {
79+
xhr.get('./components/sidenav/sidenav.html').then(t => {
7780
template = t;
7881
}),
79-
xhr.get('./components/sidenav/sidenav.css').then((css) => {
82+
xhr.get('./components/sidenav/sidenav.css').then(css => {
8083
style = css;
8184
})
8285
]).catch((err: any) => {

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

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,38 @@ import {Observable} from 'rxjs/Observable';
1616

1717
describe('MdTabGroup', () => {
1818
let builder: TestComponentBuilder;
19-
let fixture: ComponentFixture<SimpleTabsTestApp>;
2019

2120
beforeEach(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
2221
builder = tcb;
2322
}));
2423

2524
describe('basic behavior', () => {
25+
let fixture: ComponentFixture<SimpleTabsTestApp>;
26+
2627
beforeEach(async(() => {
2728
builder.createAsync(SimpleTabsTestApp).then(f => {
2829
fixture = f;
2930
});
3031
}));
3132

3233
it('should default to the first tab', () => {
33-
checkSelectedIndex(1);
34+
checkSelectedIndex(1, fixture);
3435
});
3536

3637
it('should change selected index on click', () => {
3738
let component = fixture.debugElement.componentInstance;
3839
component.selectedIndex = 0;
39-
checkSelectedIndex(0);
40+
checkSelectedIndex(0, fixture);
4041

4142
// select the second tab
4243
let tabLabel = fixture.debugElement.queryAll(By.css('.md-tab-label'))[1];
4344
tabLabel.nativeElement.click();
44-
checkSelectedIndex(1);
45+
checkSelectedIndex(1, fixture);
4546

4647
// select the third tab
4748
tabLabel = fixture.debugElement.queryAll(By.css('.md-tab-label'))[2];
4849
tabLabel.nativeElement.click();
49-
checkSelectedIndex(2);
50+
checkSelectedIndex(2, fixture);
5051
});
5152

5253
it('should support two-way binding for selectedIndex', async(() => {
@@ -128,11 +129,11 @@ describe('MdTabGroup', () => {
128129

129130
spyOn(component, 'handleSelection').and.callThrough();
130131

131-
checkSelectedIndex(1);
132+
checkSelectedIndex(1, fixture);
132133

133134
tabComponent.selectedIndex = 2;
134135

135-
checkSelectedIndex(2);
136+
checkSelectedIndex(2, fixture);
136137
tick();
137138

138139
expect(component.handleSelection).toHaveBeenCalledTimes(1);
@@ -141,6 +142,8 @@ describe('MdTabGroup', () => {
141142
});
142143

143144
describe('async tabs', () => {
145+
let fixture: ComponentFixture<AsyncTabsTestApp>;
146+
144147
beforeEach(async(() => {
145148
builder.createAsync(AsyncTabsTestApp).then(f => fixture = f);
146149
}));
@@ -164,7 +167,7 @@ describe('MdTabGroup', () => {
164167
* Checks that the `selectedIndex` has been updated; checks that the label and body have the
165168
* `md-active` class
166169
*/
167-
function checkSelectedIndex(index: number) {
170+
function checkSelectedIndex(index: number, fixture: ComponentFixture<any>) {
168171
fixture.detectChanges();
169172

170173
let tabComponent: MdTabGroup = fixture.debugElement

src/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"homepage": "https://github.com/angular/material2#readme",
2222
"peerDependencies": {
23-
"@angular/core": "^2.0.0-rc.3",
24-
"@angular/common": "^2.0.0-rc.3"
23+
"@angular/core": "^2.0.0-rc.4",
24+
"@angular/common": "^2.0.0-rc.4"
2525
}
2626
}

src/core/portal/portal.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ describe('Portals', () => {
140140
appFixture.detectChanges();
141141

142142
// Expect the new value to be reflected in the rendered output.
143-
expect(hostContainer.textContent).toContainError('Mango');
143+
expect(hostContainer.textContent).toContain('Mango');
144144
}));
145145

146146
it('should change the attached portal', fakeAsync(() => {
@@ -210,7 +210,7 @@ describe('Portals', () => {
210210

211211
flushMicrotasks();
212212

213-
expect(componentInstance).toBeAnInstanceOf(PizzaMsg);
213+
expect(componentInstance).toEqual(jasmine.any(PizzaMsg));
214214
expect(someDomElement.textContent).toContain('Pizza');
215215

216216
host.detach();
@@ -269,7 +269,7 @@ describe('Portals', () => {
269269
appFixture.detectChanges();
270270

271271
// Expect the new value to be reflected in the rendered output.
272-
expect(someDomElement.textContent).toContainError('Mango');
272+
expect(someDomElement.textContent).toContain('Mango');
273273

274274
host.detach();
275275
expect(someDomElement.innerHTML).toBe('');

0 commit comments

Comments
 (0)