From 215d373ebdac1f8fe5e03dbacedd403eee247ba3 Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Sun, 29 Oct 2017 14:01:00 +0000 Subject: [PATCH] refactor(aio): rename `CustomMdIconRegistry` to `CustomIconRegistry` (#19702) The change of Angular Material version means that the `md` prefix is no longer appropriate. PR Close #19702 --- aio/src/app/app.module.ts | 4 ++-- ...icon-registry.spec.ts => custom-icon-registry.spec.ts} | 8 ++++---- ...custom-md-icon-registry.ts => custom-icon-registry.ts} | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) rename aio/src/app/shared/{custom-md-icon-registry.spec.ts => custom-icon-registry.spec.ts} (84%) rename aio/src/app/shared/{custom-md-icon-registry.ts => custom-icon-registry.ts} (96%) diff --git a/aio/src/app/app.module.ts b/aio/src/app/app.module.ts index bb3fb4e360..3dec7d0bd1 100644 --- a/aio/src/app/app.module.ts +++ b/aio/src/app/app.module.ts @@ -29,7 +29,7 @@ import { SwUpdatesModule } from 'app/sw-updates/sw-updates.module'; import { AppComponent } from 'app/app.component'; import { ApiService } from 'app/embedded/api/api.service'; -import { CustomMdIconRegistry, SVG_ICONS } from 'app/shared/custom-md-icon-registry'; +import { CustomIconRegistry, SVG_ICONS } from 'app/shared/custom-icon-registry'; import { Deployment } from 'app/shared/deployment.service'; import { DocViewerComponent } from 'app/layout/doc-viewer/doc-viewer.component'; import { DtComponent } from 'app/layout/doc-viewer/dt.component'; @@ -111,7 +111,7 @@ export const svgIconProviders = [ Location, { provide: LocationStrategy, useClass: PathLocationStrategy }, LocationService, - { provide: MatIconRegistry, useClass: CustomMdIconRegistry }, + { provide: MatIconRegistry, useClass: CustomIconRegistry }, NavigationService, Platform, ScrollService, diff --git a/aio/src/app/shared/custom-md-icon-registry.spec.ts b/aio/src/app/shared/custom-icon-registry.spec.ts similarity index 84% rename from aio/src/app/shared/custom-md-icon-registry.spec.ts rename to aio/src/app/shared/custom-icon-registry.spec.ts index 92e35f8285..712d949ee3 100644 --- a/aio/src/app/shared/custom-md-icon-registry.spec.ts +++ b/aio/src/app/shared/custom-icon-registry.spec.ts @@ -1,7 +1,7 @@ import { MatIconRegistry } from '@angular/material'; -import { CustomMdIconRegistry, SvgIconInfo } from './custom-md-icon-registry'; +import { CustomIconRegistry, SvgIconInfo } from './custom-icon-registry'; -describe('CustomMdIconRegistry', () => { +describe('CustomIconRegistry', () => { it('should get the SVG element for a preloaded icon from the cache', () => { const mockHttp: any = {}; const mockSanitizer: any = {}; @@ -10,7 +10,7 @@ describe('CustomMdIconRegistry', () => { const svgIcons: SvgIconInfo[] = [ { name: 'test_icon', svgSource: svgSrc } ]; - const registry = new CustomMdIconRegistry(mockHttp, mockSanitizer, svgIcons); + const registry = new CustomIconRegistry(mockHttp, mockSanitizer, svgIcons); let svgElement: SVGElement; registry.getNamedSvgIcon('test_icon').subscribe(el => svgElement = el); expect(svgElement).toEqual(createSvg(svgSrc)); @@ -26,7 +26,7 @@ describe('CustomMdIconRegistry', () => { ]; spyOn(MatIconRegistry.prototype, 'getNamedSvgIcon'); - const registry = new CustomMdIconRegistry(mockHttp, mockSanitizer, svgIcons); + const registry = new CustomIconRegistry(mockHttp, mockSanitizer, svgIcons); registry.getNamedSvgIcon('other_icon'); expect(MatIconRegistry.prototype.getNamedSvgIcon).toHaveBeenCalledWith('other_icon', undefined); diff --git a/aio/src/app/shared/custom-md-icon-registry.ts b/aio/src/app/shared/custom-icon-registry.ts similarity index 96% rename from aio/src/app/shared/custom-md-icon-registry.ts rename to aio/src/app/shared/custom-icon-registry.ts index 4df6dd7cea..d0fe754f21 100644 --- a/aio/src/app/shared/custom-md-icon-registry.ts +++ b/aio/src/app/shared/custom-icon-registry.ts @@ -6,7 +6,7 @@ import { DomSanitizer } from '@angular/platform-browser'; /** * Use SVG_ICONS (and SvgIconInfo) as "multi" providers to provide the SVG source - * code for the icons that you wish to have preloaded in the `CustomMdIconRegistry` + * code for the icons that you wish to have preloaded in the `CustomIconRegistry` * For compatibility with the MdIconComponent, please ensure that the SVG source has * the following attributes: * @@ -45,7 +45,7 @@ function createFakeHttp(http: HttpClient): any { * us to provide preloaded icon SVG sources. */ @Injectable() -export class CustomMdIconRegistry extends MatIconRegistry { +export class CustomIconRegistry extends MatIconRegistry { private preloadedSvgElements: SvgIconMap = {}; constructor(http: HttpClient, sanitizer: DomSanitizer, @Inject(SVG_ICONS) svgIcons: SvgIconInfo[]) {