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
This commit is contained in:
parent
54373cc895
commit
13ef5d6c7d
|
@ -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",
|
||||
|
|
|
@ -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 = '<svg xmlns="http://www.w3.org/2000/svg" focusable="false" ' +
|
||||
'viewBox="0 0 24 24"><path d="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"/></svg>';
|
||||
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 = '<svg xmlns="http://www.w3.org/2000/svg"><path d="h100" /></svg>';
|
||||
const svgSrc2 = '<svg xmlns="http://www.w3.org/2000/svg"><path d="h200" /></svg>';
|
||||
const svgSrc3 = '<svg xmlns="http://www.w3.org/2000/svg"><path d="h300" /></svg>';
|
||||
|
@ -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 = '<svg xmlns="http://www.w3.org/2000/svg" focusable="false" ' +
|
||||
'viewBox="0 0 24 24"><path d="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"/></svg>';
|
||||
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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"master": {
|
||||
"uncompressed": {
|
||||
"runtime-es2015": 2987,
|
||||
"main-es2015": 451075,
|
||||
"main-es2015": 450880,
|
||||
"polyfills-es2015": 52685
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue