Skip to content

Commit 22ae17b

Browse files
gkalpakjasonaden
authored andcommitted
build(aio): upgrade to latest @angular/material and @angular/cdk (#18428)
PR Close #18428
1 parent d546be4 commit 22ae17b

8 files changed

Lines changed: 23 additions & 32 deletions

File tree

‎aio/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@
6565
"private": true,
6666
"dependencies": {
6767
"@angular/animations": "^5.1.0-beta.2",
68-
"@angular/cdk": "^2.0.0-beta.12",
68+
"@angular/cdk": "^5.0.0-rc.1",
6969
"@angular/common": "^5.1.0-beta.2",
7070
"@angular/compiler": "^5.1.0-beta.2",
7171
"@angular/core": "^5.1.0-beta.2",
7272
"@angular/forms": "^5.1.0-beta.2",
7373
"@angular/http": "^5.1.0-beta.2",
74-
"@angular/material": "^2.0.0-beta.12",
74+
"@angular/material": "^5.0.0-rc.1",
7575
"@angular/platform-browser": "^5.1.0-beta.2",
7676
"@angular/platform-browser-dynamic": "^5.1.0-beta.2",
7777
"@angular/platform-server": "^5.1.0-beta.2",

‎aio/src/app/app.component.spec.ts‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { HttpClient } from '@angular/common/http';
66
import { MatProgressBar, MatSidenav } from '@angular/material';
77
import { By } from '@angular/platform-browser';
88

9+
import { Observable } from 'rxjs/Observable';
910
import { of } from 'rxjs/observable/of';
1011

1112
import { AppComponent } from './app.component';
@@ -381,20 +382,27 @@ describe('AppComponent', () => {
381382
checkHostClass('view', '');
382383
});
383384

384-
it('should set the css class of the host container based on the open/closed state of the side nav', () => {
385+
it('should set the css class of the host container based on the open/closed state of the side nav', async () => {
385386
locationService.go('guide/pipes');
386387
fixture.detectChanges();
387388
checkHostClass('sidenav', 'open');
388389

389390
sidenav.close();
390-
sidenav.onClose.next();
391+
await waitForEmit(sidenav.onClose);
391392
fixture.detectChanges();
392393
checkHostClass('sidenav', 'closed');
393394

394395
sidenav.open();
395-
sidenav.onOpen.next();
396+
await waitForEmit(sidenav.onOpen);
396397
fixture.detectChanges();
397398
checkHostClass('sidenav', 'open');
399+
400+
function waitForEmit(emitter: Observable<void>): Promise<void> {
401+
return new Promise(resolve => {
402+
emitter.subscribe(resolve);
403+
fixture.detectChanges();
404+
});
405+
}
398406
});
399407

400408
it('should set the css class of the host container based on the initial deployment mode', () => {

‎aio/src/app/app.component.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ export class AppComponent implements OnInit {
298298
const el = this.hostElement.nativeElement as Element;
299299
this.tocMaxHeightOffset =
300300
el.querySelector('footer').clientHeight +
301-
el.querySelector('mat-toolbar.app-toolbar').clientHeight +
301+
el.querySelector('.app-toolbar').clientHeight +
302302
24; // fudge margin
303303
}
304304

‎aio/src/app/app.module.ts‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ import { MatToolbarModule } from '@angular/material/toolbar';
1313

1414
import { ROUTES } from '@angular/router';
1515

16-
// Temporary fix for MatSidenavModule issue:
17-
// crashes with "missing first" operator when SideNav.mode is "over"
18-
import 'rxjs/add/operator/first';
19-
2016

2117
import { AppComponent } from 'app/app.component';
2218
import { EMBEDDED_COMPONENTS, EmbeddedComponentsMap } from 'app/embed-components/embed-components.service';

‎aio/src/app/shared/custom-icon-registry.ts‎

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,6 @@ interface SvgIconMap {
2727
[iconName: string]: SVGElement;
2828
}
2929

30-
// <hack-alert>
31-
// @angular/material's `MdIconRegitry` currently (v2.0.0-beta.8) requires an instance of `Http`
32-
// (from @angular/http). It is only used to [get some text content][1], so we can create a wrapper
33-
// around `HttpClient` and pretend it is `Http`.
34-
// [1]: https://github.com/angular/material2/blob/2.0.0-beta.8/src/lib/icon/icon-registry.ts#L465-L466
35-
// </hack-alert>
36-
function createFakeHttp(http: HttpClient): any {
37-
return {
38-
get: (url: string) => http.get(url, {responseType: 'text'})
39-
.map(data => ({text: () => data}))
40-
};
41-
}
42-
4330
/**
4431
* A custom replacement for Angular Material's `MdIconRegistry`, which allows
4532
* us to provide preloaded icon SVG sources.
@@ -49,7 +36,7 @@ export class CustomIconRegistry extends MatIconRegistry {
4936
private preloadedSvgElements: SvgIconMap = {};
5037

5138
constructor(http: HttpClient, sanitizer: DomSanitizer, @Inject(SVG_ICONS) svgIcons: SvgIconInfo[]) {
52-
super(createFakeHttp(http), sanitizer);
39+
super(http, sanitizer);
5340
this.loadSvgElements(svgIcons);
5441
}
5542

‎aio/src/app/shared/scroll.service.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class ScrollService {
1717
// at the top (e.g. toolbar) + some margin
1818
get topOffset() {
1919
if (!this._topOffset) {
20-
const toolbar = this.document.querySelector('mat-toolbar.app-toolbar');
20+
const toolbar = this.document.querySelector('.app-toolbar');
2121
this._topOffset = (toolbar && toolbar.clientHeight || 0) + topMargin;
2222
}
2323
return this._topOffset;

‎aio/src/styles/0-base/_typography.scss‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ a {
100100
text-decoration: none;
101101
}
102102

103-
.mat-toolbar-row a {
103+
.app-toolbar a {
104104
font-size: 16px;
105105
font-weight: 400;
106106
color: white;

‎aio/yarn.lock‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
dependencies:
3333
tslib "^1.7.1"
3434

35-
"@angular/cdk@^2.0.0-beta.12":
36-
version "2.0.0-beta.12"
37-
resolved "https://registry.yarnpkg.com/@angular/cdk/-/cdk-2.0.0-beta.12.tgz#3a243cb62b93f4e039120ba70f900dc9e235622e"
35+
"@angular/cdk@^5.0.0-rc.1":
36+
version "5.0.0-rc.1"
37+
resolved "https://registry.yarnpkg.com/@angular/cdk/-/cdk-5.0.0-rc.1.tgz#7d6d937fea50074962db8ce02664b164401d197d"
3838
dependencies:
3939
tslib "^1.7.1"
4040

@@ -140,9 +140,9 @@
140140
dependencies:
141141
tslib "^1.7.1"
142142

143-
"@angular/material@^2.0.0-beta.12":
144-
version "2.0.0-beta.12"
145-
resolved "https://registry.yarnpkg.com/@angular/material/-/material-2.0.0-beta.12.tgz#71b6d0b7b021891e5d0e3688c1d4bd78c7457f58"
143+
"@angular/material@^5.0.0-rc.1":
144+
version "5.0.0-rc.1"
145+
resolved "https://registry.yarnpkg.com/@angular/material/-/material-5.0.0-rc.1.tgz#63456b7568c102b6bb7983a2837cc317350fe270"
146146
dependencies:
147147
tslib "^1.7.1"
148148

0 commit comments

Comments
 (0)