Skip to content

Commit 77d975d

Browse files
committed
fix: update angular to beta.17
1 parent fea5923 commit 77d975d

28 files changed

+273
-270
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
"node": ">= 4.2.1 < 5"
2626
},
2727
"dependencies": {
28-
"angular2": "2.0.0-beta.15",
28+
"angular2": "2.0.0-beta.17",
2929
"es6-promise": "^3.0.2",
3030
"es6-shim": "^0.35.0",
3131
"reflect-metadata": "0.1.2",
32-
"rxjs": "5.0.0-beta.2",
32+
"rxjs": "5.0.0-beta.6",
3333
"systemjs": "0.19.20",
34-
"zone.js": "0.6.10"
34+
"zone.js": "0.6.12"
3535
},
3636
"devDependencies": {
3737
"add-stream": "^1.0.0",

src/components/button/button.spec.ts

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
import {
2-
it,
3-
describe,
4-
expect,
5-
beforeEach,
6-
inject,
7-
TestComponentBuilder
8-
} from 'angular2/testing';
1+
import {it, describe, expect, beforeEach, inject, TestComponentBuilder} from 'angular2/testing';
92
import {Component} from 'angular2/core';
103
import {By} from 'angular2/platform/browser';
11-
124
import {MdButton, MdAnchor} from './button';
135

6+
7+
148
export function main() {
159
describe('MdButton', () => {
1610
let builder: TestComponentBuilder;
@@ -21,7 +15,7 @@ export function main() {
2115

2216
// General button tests
2317
it('should apply class based on color attribute', (done: () => void) => {
24-
return builder.createAsync(TestApp).then((fixture) => {
18+
return builder.createAsync(TestApp).then(fixture => {
2519
let testComponent = fixture.debugElement.componentInstance;
2620
let buttonDebugElement = fixture.debugElement.query(By.css('button'));
2721
let aDebugElement = fixture.debugElement.query(By.css('a'));
@@ -40,7 +34,7 @@ export function main() {
4034
});
4135

4236
it('should should not clear previous defined classes', (done: () => void) => {
43-
return builder.createAsync(TestApp).then((fixture) => {
37+
return builder.createAsync(TestApp).then(fixture => {
4438
let testComponent = fixture.debugElement.componentInstance;
4539
let buttonDebugElement = fixture.debugElement.query(By.css('button'));
4640

@@ -66,7 +60,7 @@ export function main() {
6660
// Regular button tests
6761
describe('button[md-button]', () => {
6862
it('should handle a click on the button', (done: () => void) => {
69-
return builder.createAsync(TestApp).then((fixture) => {
63+
return builder.createAsync(TestApp).then(fixture => {
7064
let testComponent = fixture.debugElement.componentInstance;
7165
let buttonDebugElement = fixture.debugElement.query(By.css('button'));
7266

@@ -77,7 +71,7 @@ export function main() {
7771
});
7872

7973
it('should not increment if disabled', (done: () => void) => {
80-
return builder.createAsync(TestApp).then((fixture) => {
74+
return builder.createAsync(TestApp).then(fixture => {
8175
let testComponent = fixture.debugElement.componentInstance;
8276
let buttonDebugElement = fixture.debugElement.query(By.css('button'));
8377

@@ -96,7 +90,7 @@ export function main() {
9690
// Anchor button tests
9791
describe('a[md-button]', () => {
9892
it('should not redirect if disabled', (done: () => void) => {
99-
return builder.createAsync(TestApp).then((fixture) => {
93+
return builder.createAsync(TestApp).then(fixture => {
10094
let testComponent = fixture.debugElement.componentInstance;
10195
let buttonDebugElement = fixture.debugElement.query(By.css('a'));
10296

@@ -110,7 +104,7 @@ export function main() {
110104
});
111105

112106
it('should remove tabindex if disabled', (done: () => void) => {
113-
return builder.createAsync(TestApp).then((fixture) => {
107+
return builder.createAsync(TestApp).then(fixture => {
114108
let testComponent = fixture.debugElement.componentInstance;
115109
let buttonDebugElement = fixture.debugElement.query(By.css('a'));
116110
expect(buttonDebugElement.nativeElement.getAttribute('tabIndex')).toBe(null);
@@ -123,7 +117,7 @@ export function main() {
123117
});
124118

125119
it('should add aria-disabled attribute if disabled', (done: () => void) => {
126-
return builder.createAsync(TestApp).then((fixture) => {
120+
return builder.createAsync(TestApp).then(fixture => {
127121
let testComponent = fixture.debugElement.componentInstance;
128122
let buttonDebugElement = fixture.debugElement.query(By.css('a'));
129123
fixture.detectChanges();

src/components/checkbox/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ A demo of the checkbox can be found at https://plnkr.co/edit/P7qce8lN9n2flS6kBhD
1515

1616
```html
1717
<ul>
18-
<li *ngFor="#todo of todos">
18+
<li *ngFor="let todo of todos">
1919
<md-checkbox [checked]="todo.completed"
2020
(change)="todo.completed = $event">
2121
{{todo.name}}

src/components/checkbox/checkbox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class MdCheckbox implements ControlValueAccessor {
105105
@Input() tabindex: number = 0;
106106

107107
/** Event emitted when the checkbox's `checked` value changes. */
108-
@Output() change: EventEmitter<boolean> = new EventEmitter();
108+
@Output() change: EventEmitter<boolean> = new EventEmitter<boolean>();
109109

110110
/** Called when the checkbox is blurred. Needed to properly implement ControlValueAccessor. */
111111
onTouched: () => any = () => {};

src/components/icon/icon-registry.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ export class MdIconRegistry {
143143
*/
144144
getSvgIconFromUrl(url: string): Observable<SVGElement> {
145145
if (this._cachedIconsByUrl.has(url)) {
146-
return Observable.of(this._cachedIconsByUrl.get(url).cloneNode(true));
146+
return Observable.of(cloneSvg(this._cachedIconsByUrl.get(url)));
147147
}
148148
return this._loadSvgIconFromConfig(new SvgIconConfig(url))
149149
.do(svg => this._cachedIconsByUrl.set(url, svg))
150-
.map(svg => svg.cloneNode(true));
150+
.map(svg => cloneSvg(svg));
151151
}
152152

153153
/**
@@ -175,12 +175,12 @@ export class MdIconRegistry {
175175
private _getSvgFromConfig(config: SvgIconConfig): Observable<SVGElement> {
176176
if (config.svgElement) {
177177
// We already have the SVG element for this icon, return a copy.
178-
return Observable.of(config.svgElement.cloneNode(true));
178+
return Observable.of(cloneSvg(config.svgElement));
179179
} else {
180180
// Fetch the icon from the config's URL, cache it, and return a copy.
181181
return this._loadSvgIconFromConfig(config)
182182
.do(svg => config.svgElement = svg)
183-
.map(svg => svg.cloneNode(true));
183+
.map(svg => cloneSvg(svg));
184184
}
185185
}
186186

@@ -209,7 +209,7 @@ export class MdIconRegistry {
209209
.filter(iconSetConfig => !iconSetConfig.svgElement)
210210
.map(iconSetConfig =>
211211
this._loadSvgIconSetFromConfig(iconSetConfig)
212-
.catch((err: any, source: any, caught: any): Observable<SVGElement> => {
212+
.catch((err: any, caught: Observable<SVGElement>): Observable<SVGElement> => {
213213
// Swallow errors fetching individual URLs so the combined Observable won't
214214
// necessarily fail.
215215
console.log(`Loading icon set URL: ${iconSetConfig.url} failed: ${err}`);
@@ -349,8 +349,11 @@ export class MdIconRegistry {
349349
if (this._inProgressUrlFetches.has(url)) {
350350
return this._inProgressUrlFetches.get(url);
351351
}
352-
const req = this._http.get(url)
353-
.map((response) => response.text())
352+
353+
// TODO(jelbourn): for some reason, the `finally` operator "loses" the generic type on the
354+
// Observable. Figure out why and fix it.
355+
const req = <Observable<string>> this._http.get(url)
356+
.map(response => response.text())
354357
.finally(() => {
355358
this._inProgressUrlFetches.delete(url);
356359
})
@@ -359,3 +362,9 @@ export class MdIconRegistry {
359362
return req;
360363
}
361364
}
365+
366+
367+
/** Clones an SVGElement while preserving type information. */
368+
function cloneSvg(svg: SVGElement) {
369+
return <SVGElement> svg.cloneNode(true);
370+
}

src/components/icon/icon.spec.ts

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
import {
2-
it,
3-
describe,
4-
expect,
5-
beforeEach,
6-
beforeEachProviders,
7-
inject,
8-
TestComponentBuilder,
2+
it,
3+
describe,
4+
expect,
5+
beforeEach,
6+
beforeEachProviders,
7+
inject,
8+
TestComponentBuilder
99
} from 'angular2/testing';
10-
import {
11-
HTTP_PROVIDERS,
12-
XHRBackend} from 'angular2/http';
10+
import {HTTP_PROVIDERS, XHRBackend} from 'angular2/http';
1311
import {MockBackend} from 'angular2/http/testing';
14-
import {
15-
provide,
16-
Component} from 'angular2/core';
17-
12+
import {provide, Component} from 'angular2/core';
1813
import {MdIcon} from './icon';
1914
import {MdIconRegistry} from './icon-registry';
2015
import {getFakeSvgHttpResponse} from './fake-svgs';
2116

17+
18+
2219
/** Returns the CSS classes assigned to an element as a sorted array. */
2320
const sortedClassNames = (elem: Element) => elem.className.split(' ').sort();
2421

@@ -74,7 +71,7 @@ export function main() {
7471

7572
describe('Ligature icons', () => {
7673
it('should add material-icons class by default', (done: () => void) => {
77-
return builder.createAsync(MdIconLigatureTestApp).then((fixture) => {
74+
return builder.createAsync(MdIconLigatureTestApp).then(fixture => {
7875
const testComponent = fixture.debugElement.componentInstance;
7976
const mdIconElement = fixture.debugElement.nativeElement.querySelector('md-icon');
8077
testComponent.iconName = 'home';
@@ -86,7 +83,7 @@ export function main() {
8683

8784
it('should use alternate icon font if set', (done: () => void) => {
8885
mdIconRegistry.setDefaultFontSetClass('myfont');
89-
return builder.createAsync(MdIconLigatureTestApp).then((fixture) => {
86+
return builder.createAsync(MdIconLigatureTestApp).then(fixture => {
9087
const testComponent = fixture.debugElement.componentInstance;
9188
const mdIconElement = fixture.debugElement.nativeElement.querySelector('md-icon');
9289
testComponent.iconName = 'home';
@@ -99,7 +96,7 @@ export function main() {
9996

10097
describe('Icons from URLs', () => {
10198
it('should fetch SVG icon from URL and inline the content', (done: () => void) => {
102-
return builder.createAsync(MdIconFromSvgUrlTestApp).then((fixture) => {
99+
return builder.createAsync(MdIconFromSvgUrlTestApp).then(fixture => {
103100
const testComponent = fixture.debugElement.componentInstance;
104101
const mdIconElement = fixture.debugElement.nativeElement.querySelector('md-icon');
105102
let svgElement: any;
@@ -135,7 +132,7 @@ export function main() {
135132
it('should register icon URLs by name', (done: () => void) => {
136133
mdIconRegistry.addSvgIcon('fluffy', 'cat.svg');
137134
mdIconRegistry.addSvgIcon('fido', 'dog.svg');
138-
return builder.createAsync(MdIconFromSvgNameTestApp).then((fixture) => {
135+
return builder.createAsync(MdIconFromSvgNameTestApp).then(fixture => {
139136
const testComponent = fixture.debugElement.componentInstance;
140137
const mdIconElement = fixture.debugElement.nativeElement.querySelector('md-icon');
141138
let svgElement: SVGElement;
@@ -168,7 +165,7 @@ export function main() {
168165

169166
it('should extract icon from SVG icon set', (done: () => void) => {
170167
mdIconRegistry.addSvgIconSetInNamespace('farm', 'farm-set-1.svg');
171-
return builder.createAsync(MdIconFromSvgNameTestApp).then((fixture) => {
168+
return builder.createAsync(MdIconFromSvgNameTestApp).then(fixture => {
172169
const testComponent = fixture.debugElement.componentInstance;
173170
const mdIconElement = fixture.debugElement.nativeElement.querySelector('md-icon');
174171
let svgElement: any;
@@ -207,7 +204,7 @@ export function main() {
207204
mdIconRegistry.addSvgIconSetInNamespace('farm', 'farm-set-1.svg');
208205
mdIconRegistry.addSvgIconSetInNamespace('farm', 'farm-set-2.svg');
209206
mdIconRegistry.addSvgIconSetInNamespace('arrows', 'arrow-set.svg');
210-
return builder.createAsync(MdIconFromSvgNameTestApp).then((fixture) => {
207+
return builder.createAsync(MdIconFromSvgNameTestApp).then(fixture => {
211208
const testComponent = fixture.debugElement.componentInstance;
212209
const mdIconElement = fixture.debugElement.nativeElement.querySelector('md-icon');
213210
let svgElement: any;
@@ -250,7 +247,7 @@ export function main() {
250247

251248
it('should not wrap <svg> elements in icon sets in another svg tag', (done: () => void) => {
252249
mdIconRegistry.addSvgIconSet('arrow-set.svg');
253-
return builder.createAsync(MdIconFromSvgNameTestApp).then((fixture) => {
250+
return builder.createAsync(MdIconFromSvgNameTestApp).then(fixture => {
254251
const testComponent = fixture.debugElement.componentInstance;
255252
const mdIconElement = fixture.debugElement.nativeElement.querySelector('md-icon');
256253
let svgElement: any;
@@ -268,7 +265,7 @@ export function main() {
268265
});
269266

270267
it('should return unmodified copies of icons from URLs', (done: () => void) => {
271-
return builder.createAsync(MdIconFromSvgUrlTestApp).then((fixture) => {
268+
return builder.createAsync(MdIconFromSvgUrlTestApp).then(fixture => {
272269
const testComponent = fixture.debugElement.componentInstance;
273270
const mdIconElement = fixture.debugElement.nativeElement.querySelector('md-icon');
274271
let svgElement: any;
@@ -299,7 +296,7 @@ export function main() {
299296

300297
it('should return unmodified copies of icons from icon sets', (done: () => void) => {
301298
mdIconRegistry.addSvgIconSet('arrow-set.svg');
302-
return builder.createAsync(MdIconFromSvgNameTestApp).then((fixture) => {
299+
return builder.createAsync(MdIconFromSvgNameTestApp).then(fixture => {
303300
const testComponent = fixture.debugElement.componentInstance;
304301
const mdIconElement = fixture.debugElement.nativeElement.querySelector('md-icon');
305302
let svgElement: any;
@@ -333,7 +330,7 @@ export function main() {
333330
it('should apply CSS classes for custom font and icon', (done: () => void) => {
334331
mdIconRegistry.registerFontClassAlias('f1', 'font1');
335332
mdIconRegistry.registerFontClassAlias('f2');
336-
return builder.createAsync(MdIconCustomFontCssTestApp).then((fixture) => {
333+
return builder.createAsync(MdIconCustomFontCssTestApp).then(fixture => {
337334
const testComponent = fixture.debugElement.componentInstance;
338335
const mdIconElement = fixture.debugElement.nativeElement.querySelector('md-icon');
339336
testComponent.fontSet = 'f1';
@@ -361,10 +358,12 @@ export function main() {
361358

362359
describe('aria label', () => {
363360
it('should set aria label from text content if not specified', (done: () => void) => {
364-
return builder.createAsync(MdIconLigatureTestApp).then((fixture) => {
361+
return builder.createAsync(MdIconLigatureTestApp).then(fixture => {
362+
365363
const testComponent = fixture.debugElement.componentInstance;
366364
const mdIconElement = fixture.debugElement.nativeElement.querySelector('md-icon');
367365
testComponent.iconName = 'home';
366+
368367
fixture.detectChanges();
369368
expect(mdIconElement.getAttribute('aria-label')).toBe('home');
370369

@@ -377,7 +376,7 @@ export function main() {
377376
});
378377

379378
it('should use alt tag if aria label is not specified', (done: () => void) => {
380-
return builder.createAsync(MdIconLigatureWithAriaBindingTestApp).then((fixture) => {
379+
return builder.createAsync(MdIconLigatureWithAriaBindingTestApp).then(fixture => {
381380
const testComponent = fixture.debugElement.componentInstance;
382381
const mdIconElement = fixture.debugElement.nativeElement.querySelector('md-icon');
383382
testComponent.iconName = 'home';
@@ -394,7 +393,7 @@ export function main() {
394393
});
395394

396395
it('should use provided aria label rather than icon name', (done: () => void) => {
397-
return builder.createAsync(MdIconLigatureWithAriaBindingTestApp).then((fixture) => {
396+
return builder.createAsync(MdIconLigatureWithAriaBindingTestApp).then(fixture => {
398397
const testComponent = fixture.debugElement.componentInstance;
399398
const mdIconElement = fixture.debugElement.nativeElement.querySelector('md-icon');
400399
testComponent.iconName = 'home';
@@ -406,7 +405,7 @@ export function main() {
406405
});
407406

408407
it('should use provided aria label rather than font icon', (done: () => void) => {
409-
return builder.createAsync(MdIconCustomFontCssTestApp).then((fixture) => {
408+
return builder.createAsync(MdIconCustomFontCssTestApp).then(fixture => {
410409
const testComponent = fixture.debugElement.componentInstance;
411410
const mdIconElement = fixture.debugElement.nativeElement.querySelector('md-icon');
412411
testComponent.fontSet = 'f1';

0 commit comments

Comments
 (0)