From 13ef5d6c7d00b306319e60b07b1a6f98510c5dff Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Tue, 7 Jul 2020 14:13:37 +0300 Subject: [PATCH] build(docs-infra): update @angular/material to 10.0.1 (#37898) This commit updates the version of Angular Components used in angular.io to version 10.0.1. It also updates the angular.io app to adapt to breaking changes. PR Close #37898 --- aio/package.json | 4 +-- .../app/shared/custom-icon-registry.spec.ts | 29 ++++++++++--------- aio/src/app/shared/custom-icon-registry.ts | 6 ++-- aio/yarn.lock | 20 ++++++++----- goldens/size-tracking/aio-payloads.json | 2 +- 5 files changed, 34 insertions(+), 27 deletions(-) diff --git a/aio/package.json b/aio/package.json index 05066c69e8..fb0ed4794d 100644 --- a/aio/package.json +++ b/aio/package.json @@ -88,13 +88,13 @@ "private": true, "dependencies": { "@angular/animations": "10.0.2", - "@angular/cdk": "^9.2.2", + "@angular/cdk": "10.0.1", "@angular/common": "10.0.2", "@angular/compiler": "10.0.2", "@angular/core": "10.0.2", "@angular/elements": "10.0.2", "@angular/forms": "10.0.2", - "@angular/material": "^9.2.2", + "@angular/material": "10.0.1", "@angular/platform-browser": "10.0.2", "@angular/platform-browser-dynamic": "10.0.2", "@angular/router": "10.0.2", diff --git a/aio/src/app/shared/custom-icon-registry.spec.ts b/aio/src/app/shared/custom-icon-registry.spec.ts index be35c3d136..45f6fe458b 100644 --- a/aio/src/app/shared/custom-icon-registry.spec.ts +++ b/aio/src/app/shared/custom-icon-registry.spec.ts @@ -1,27 +1,31 @@ +import { HttpClient } from '@angular/common/http'; +import { ErrorHandler } from '@angular/core'; import { MatIconRegistry } from '@angular/material/icon'; +import { DomSanitizer } from '@angular/platform-browser'; import { CustomIconRegistry, SvgIconInfo } from './custom-icon-registry'; describe('CustomIconRegistry', () => { + const fakeHttpClient: HttpClient = {} as any; + const fakeDomSanitizer: DomSanitizer = {} as any; + const fakeDocument: Document = {} as any; + const fakeErrorHandler: ErrorHandler = {handleError: err => console.error(err)}; + it('should get the SVG element for a preloaded icon from the cache', () => { - const mockHttp: any = {}; - const mockSanitizer: any = {}; - const mockDocument: any = {}; const svgSrc = ''; const svgIcons: SvgIconInfo[] = [ { name: 'test_icon', svgSource: svgSrc } ]; - const registry = new CustomIconRegistry(mockHttp, mockSanitizer, mockDocument, svgIcons); + + const registry = new CustomIconRegistry( + fakeHttpClient, fakeDomSanitizer, fakeDocument, fakeErrorHandler, svgIcons); let svgElement: SVGElement|undefined; registry.getNamedSvgIcon('test_icon').subscribe(el => svgElement = el); + expect(svgElement).toEqual(createSvg(svgSrc)); }); it('should support caching icons with a namespace', () => { - const mockHttp: any = {}; - const mockSanitizer: any = {}; - const mockDocument: any = {}; - const svgSrc1 = ''; const svgSrc2 = ''; const svgSrc3 = ''; @@ -31,7 +35,8 @@ describe('CustomIconRegistry', () => { { namespace: 'bar', name: 'test_icon', svgSource: svgSrc3 }, ]; - const registry = new CustomIconRegistry(mockHttp, mockSanitizer, mockDocument, svgIcons); + const registry = new CustomIconRegistry( + fakeHttpClient, fakeDomSanitizer, fakeDocument, fakeErrorHandler, svgIcons); let svgElement: SVGElement|undefined; registry.getNamedSvgIcon('test_icon', 'foo').subscribe(el => svgElement = el); @@ -39,9 +44,6 @@ describe('CustomIconRegistry', () => { }); it('should call through to the MdIconRegistry if the icon name is not in the preloaded cache', () => { - const mockHttp: any = {}; - const mockSanitizer: any = {}; - const mockDocument: any = {}; const svgSrc = ''; const svgIcons: SvgIconInfo[] = [ @@ -49,7 +51,8 @@ describe('CustomIconRegistry', () => { ]; spyOn(MatIconRegistry.prototype, 'getNamedSvgIcon'); - const registry = new CustomIconRegistry(mockHttp, mockSanitizer, mockDocument, svgIcons); + const registry = new CustomIconRegistry( + fakeHttpClient, fakeDomSanitizer, fakeDocument, fakeErrorHandler, svgIcons); registry.getNamedSvgIcon('other_icon'); expect(MatIconRegistry.prototype.getNamedSvgIcon).toHaveBeenCalledWith('other_icon', undefined); diff --git a/aio/src/app/shared/custom-icon-registry.ts b/aio/src/app/shared/custom-icon-registry.ts index 156cf8b038..efa0a3605f 100644 --- a/aio/src/app/shared/custom-icon-registry.ts +++ b/aio/src/app/shared/custom-icon-registry.ts @@ -1,4 +1,4 @@ -import { InjectionToken, Inject, Injectable, Optional } from '@angular/core'; +import { ErrorHandler, InjectionToken, Inject, Injectable, Optional } from '@angular/core'; import { DOCUMENT } from '@angular/common'; import { of } from 'rxjs'; import { MatIconRegistry } from '@angular/material/icon'; @@ -42,8 +42,8 @@ export class CustomIconRegistry extends MatIconRegistry { private preloadedSvgElements: SvgIconMap = {[DEFAULT_NS]: {}}; constructor(http: HttpClient, sanitizer: DomSanitizer, @Optional() @Inject(DOCUMENT) document: Document, - @Inject(SVG_ICONS) svgIcons: SvgIconInfo[]) { - super(http, sanitizer, document); + errorHandler: ErrorHandler, @Inject(SVG_ICONS) svgIcons: SvgIconInfo[]) { + super(http, sanitizer, document, errorHandler); this.loadSvgElements(svgIcons); } diff --git a/aio/yarn.lock b/aio/yarn.lock index 1afbe1a640..ef2326720b 100644 --- a/aio/yarn.lock +++ b/aio/yarn.lock @@ -127,10 +127,12 @@ dependencies: tslib "^2.0.0" -"@angular/cdk@^9.2.2": - version "9.2.2" - resolved "https://registry.yarnpkg.com/@angular/cdk/-/cdk-9.2.2.tgz#776be85aa55146f00dcd4909b81c67da47286c75" - integrity sha512-VNd+KuMN6cBcy4/8OyMxqYaxdjPP6IyCqIVijB2JREkc5Sg4VWmPgx2L3rHt/DzjsVBVRgx35uqOMymDezG3jQ== +"@angular/cdk@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@angular/cdk/-/cdk-10.0.1.tgz#8e10317cd6fee4d9f8a3794998629496fb60e68b" + integrity sha512-tEgaTDQplptbOf4cHHdVScH0h5QNvkWDhabAWpWaT4/dVXEsp+p2E9Pzkemesi/gNmUIetVjGaicX5VqsijZSQ== + dependencies: + tslib "^2.0.0" optionalDependencies: parse5 "^5.0.0" @@ -233,10 +235,12 @@ resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-10.0.2.tgz#31f22020be96ab2cf77283e0627f8a6fffedfe36" integrity sha512-kEMJ3DkprpoGJvEjvH/PZrBKtgCbLtFYtrXHRDy2+92vgCT0Xz6TwzZ2qlwlQSijffOgsV5LwdjI4oxpgVKReQ== -"@angular/material@^9.2.2": - version "9.2.2" - resolved "https://registry.yarnpkg.com/@angular/material/-/material-9.2.2.tgz#53b2d8a62fe48b79127cdf43b3b8b082e4c3df27" - integrity sha512-gdQiMJ6PtW/5fd+0mglHFyzxULDCBGjn9RTET3sUq2rkc9+jBXr4OvnsUyBWSnqqv97XqotVDIx5JgE4/YX/Rw== +"@angular/material@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@angular/material/-/material-10.0.1.tgz#f59988499d20ee4ab93292d7e9a9d16ce24839f0" + integrity sha512-4xGIupOiPbyYG/tTbVhgjATRZSRf+Xj2FGkX3csSlIOvhrFtN1B9gTlcbOjzWHPpWTFChZALzMXA/841KA9QqA== + dependencies: + tslib "^2.0.0" "@angular/platform-browser-dynamic@10.0.2": version "10.0.2" diff --git a/goldens/size-tracking/aio-payloads.json b/goldens/size-tracking/aio-payloads.json index 886658e1d6..b382fea53a 100755 --- a/goldens/size-tracking/aio-payloads.json +++ b/goldens/size-tracking/aio-payloads.json @@ -3,7 +3,7 @@ "master": { "uncompressed": { "runtime-es2015": 2987, - "main-es2015": 451075, + "main-es2015": 450880, "polyfills-es2015": 52685 } }