Skip to content

Commit e0284d4

Browse files
authored
chore: update to angular RC4 and other update other packages (#843)
* chore: update angular-cli version * tests are passing * use straight jasmine functions * remove deprecated methods * remove use of new Provider(...) * fix tests that relied on returning a promise * debugging ios8
1 parent a18fd7c commit e0284d4

32 files changed

+872
-1075
lines changed

package.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@
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": {
4646
"add-stream": "^1.0.0",
47-
"angular-cli": "^1.0.0-beta.6",
47+
"angular-cli": "^1.0.0-beta.9",
4848
"broccoli-autoprefixer": "^4.1.0",
4949
"broccoli-funnel": "^1.0.1",
5050
"broccoli-merge-trees": "^1.1.1",
@@ -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
}

scripts/ci/build-and-test.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
set -e
2+
set -ex
33

44
echo "======= Starting build-and-test.sh ========================================"
55

@@ -22,8 +22,20 @@ if is_lint; then
2222
elif is_circular_deps_check; then
2323
npm run check-circular-deps
2424
elif is_e2e; then
25+
# Start up the e2e app. This will take some time.
26+
echo "Starting e2e app"
2527
MD_APP=e2e ng serve &
26-
sleep 20
28+
sleep 1
29+
30+
# Wait until the dist/ directory is created, indicating that the e2e app is ready.
31+
# Use the presence of `button.js` to determine whether the compiled output is ready to be served.
32+
echo "Waiting for e2e app to start"
33+
while [ ! -f ./dist/components/button/button.js ]; do
34+
sleep 2
35+
done
36+
37+
# Run the e2e tests on the served e2e app.
38+
echo "Starting e2e tests"
2739
ng e2e
2840
else
2941
karma start test/karma.conf.js --single-run --no-auto-watch --reporters='dots'

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import {
2-
it,
3-
describe,
4-
beforeEach,
5-
beforeEachProviders,
2+
addProviders,
63
inject,
74
async,
85
fakeAsync,
96
tick,
107
} from '@angular/core/testing';
118
import {NgControl, disableDeprecatedForms, provideForms} from '@angular/forms';
129
import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing';
13-
import {Component, DebugElement, provide} from '@angular/core';
10+
import {Component, DebugElement} from '@angular/core';
1411
import {By} from '@angular/platform-browser';
1512
import {
1613
MD_BUTTON_TOGGLE_DIRECTIVES,
@@ -28,14 +25,16 @@ describe('MdButtonToggle', () => {
2825
let builder: TestComponentBuilder;
2926
let dispatcher: MdUniqueSelectionDispatcher;
3027

31-
beforeEachProviders(() => [
32-
disableDeprecatedForms(),
33-
provideForms(),
34-
provide(MdUniqueSelectionDispatcher, {useFactory: () => {
35-
dispatcher = new MdUniqueSelectionDispatcher();
36-
return dispatcher;
37-
}})
38-
]);
28+
beforeEach(() => {
29+
addProviders([
30+
disableDeprecatedForms(),
31+
provideForms(),
32+
{provide: MdUniqueSelectionDispatcher, useFactory: () => {
33+
dispatcher = new MdUniqueSelectionDispatcher();
34+
return dispatcher;
35+
}}
36+
]);
37+
});
3938

4039
beforeEach(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
4140
builder = tcb;

src/components/button-toggle/button-toggle.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ import {
88
OnInit,
99
Optional,
1010
Output,
11-
Provider,
1211
QueryList,
1312
ViewEncapsulation,
1413
forwardRef
1514
} from '@angular/core';
16-
// TODO(iveysaur): Update to @angular/forms when we have rc.2
1715
import {
1816
NG_VALUE_ACCESSOR,
1917
ControlValueAccessor,
@@ -32,11 +30,11 @@ export type ToggleType = 'checkbox' | 'radio';
3230
* Provider Expression that allows md-button-toggle-group to register as a ControlValueAccessor.
3331
* This allows it to support [(ngModel)].
3432
*/
35-
export const MD_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR = new Provider(
36-
NG_VALUE_ACCESSOR, {
37-
useExisting: forwardRef(() => MdButtonToggleGroup),
38-
multi: true
39-
});
33+
export const MD_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR: any = {
34+
provide: NG_VALUE_ACCESSOR,
35+
useExisting: forwardRef(() => MdButtonToggleGroup),
36+
multi: true
37+
};
4038

4139
var _uniqueIdCounter = 0;
4240

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: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import {
2-
it,
3-
beforeEach,
4-
beforeEachProviders,
2+
addProviders,
53
inject,
64
async,
75
fakeAsync,
@@ -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

@@ -29,10 +26,12 @@ describe('MdCheckbox', () => {
2926
let builder: TestComponentBuilder;
3027
let fixture: ComponentFixture<any>;
3128

32-
beforeEachProviders(() => [
33-
disableDeprecatedForms(),
34-
provideForms(),
35-
]);
29+
beforeEach(() => {
30+
addProviders([
31+
disableDeprecatedForms(),
32+
provideForms(),
33+
]);
34+
});
3635

3736
beforeEach(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
3837
builder = tcb;
@@ -215,21 +214,14 @@ describe('MdCheckbox', () => {
215214
expect(testComponent.onCheckboxClick).toHaveBeenCalledTimes(1);
216215
});
217216

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-
217+
it('should emit a change event when the `checked` value changes', async(() => {
228218
testComponent.isChecked = true;
229219
fixture.detectChanges();
230220

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

234226
describe('state transition css classes', () => {
235227
it('should transition unchecked -> checked -> unchecked', () => {
@@ -509,6 +501,7 @@ class SingleCheckbox {
509501
parentElementClicked: boolean = false;
510502
parentElementKeyedUp: boolean = false;
511503
lastKeydownEvent: Event = null;
504+
changeCount: number = 0;
512505

513506
onCheckboxClick(event: Event) {}
514507
}

src/components/checkbox/checkbox.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
EventEmitter,
66
Input,
77
Output,
8-
Provider,
98
Renderer,
109
ViewEncapsulation,
1110
forwardRef,
@@ -22,11 +21,11 @@ let nextId = 0;
2221
* Provider Expression that allows md-checkbox to register as a ControlValueAccessor. This allows it
2322
* to support [(ngModel)].
2423
*/
25-
export const MD_CHECKBOX_CONTROL_VALUE_ACCESSOR = new Provider(
26-
NG_VALUE_ACCESSOR, {
27-
useExisting: forwardRef(() => MdCheckbox),
28-
multi: true
29-
});
24+
export const MD_CHECKBOX_CONTROL_VALUE_ACCESSOR: any = {
25+
provide: NG_VALUE_ACCESSOR,
26+
useExisting: forwardRef(() => MdCheckbox),
27+
multi: true
28+
};
3029

3130
/**
3231
* Represents the different states that require custom transitions between them.

0 commit comments

Comments
 (0)