source: trip-planner-front/node_modules/@angular/material/esm2015/icon/testing/fake-icon-registry.js@ 6fe77af

Last change on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 7.8 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { Injectable, NgModule } from '@angular/core';
9import { MatIconRegistry } from '@angular/material/icon';
10import { of as observableOf } from 'rxjs';
11/**
12 * A null icon registry that must be imported to allow disabling of custom
13 * icons.
14 */
15export class FakeMatIconRegistry {
16 addSvgIcon() {
17 return this;
18 }
19 addSvgIconLiteral() {
20 return this;
21 }
22 addSvgIconInNamespace() {
23 return this;
24 }
25 addSvgIconLiteralInNamespace() {
26 return this;
27 }
28 addSvgIconSet() {
29 return this;
30 }
31 addSvgIconSetLiteral() {
32 return this;
33 }
34 addSvgIconSetInNamespace() {
35 return this;
36 }
37 addSvgIconSetLiteralInNamespace() {
38 return this;
39 }
40 registerFontClassAlias() {
41 return this;
42 }
43 classNameForFontAlias(alias) {
44 return alias;
45 }
46 getDefaultFontSetClass() {
47 return 'material-icons';
48 }
49 getSvgIconFromUrl() {
50 return observableOf(this._generateEmptySvg());
51 }
52 getNamedSvgIcon() {
53 return observableOf(this._generateEmptySvg());
54 }
55 setDefaultFontSetClass() {
56 return this;
57 }
58 addSvgIconResolver() {
59 return this;
60 }
61 ngOnDestroy() { }
62 _generateEmptySvg() {
63 const emptySvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
64 emptySvg.classList.add('fake-testing-svg');
65 // Emulate real icon characteristics from `MatIconRegistry` so size remains consistent in tests.
66 emptySvg.setAttribute('fit', '');
67 emptySvg.setAttribute('height', '100%');
68 emptySvg.setAttribute('width', '100%');
69 emptySvg.setAttribute('preserveAspectRatio', 'xMidYMid meet');
70 emptySvg.setAttribute('focusable', 'false');
71 return emptySvg;
72 }
73}
74FakeMatIconRegistry.decorators = [
75 { type: Injectable }
76];
77/** Import this module in tests to install the null icon registry. */
78export class MatIconTestingModule {
79}
80MatIconTestingModule.decorators = [
81 { type: NgModule, args: [{
82 providers: [{ provide: MatIconRegistry, useClass: FakeMatIconRegistry }]
83 },] }
84];
85//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFrZS1pY29uLXJlZ2lzdHJ5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL2ljb24vdGVzdGluZy9mYWtlLWljb24tcmVnaXN0cnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFDLFVBQVUsRUFBRSxRQUFRLEVBQVksTUFBTSxlQUFlLENBQUM7QUFDOUQsT0FBTyxFQUFDLGVBQWUsRUFBQyxNQUFNLHdCQUF3QixDQUFDO0FBQ3ZELE9BQU8sRUFBYSxFQUFFLElBQUksWUFBWSxFQUFDLE1BQU0sTUFBTSxDQUFDO0FBTXBEOzs7R0FHRztBQUVILE1BQU0sT0FBTyxtQkFBbUI7SUFDOUIsVUFBVTtRQUNSLE9BQU8sSUFBSSxDQUFDO0lBQ2QsQ0FBQztJQUVELGlCQUFpQjtRQUNmLE9BQU8sSUFBSSxDQUFDO0lBQ2QsQ0FBQztJQUVELHFCQUFxQjtRQUNuQixPQUFPLElBQUksQ0FBQztJQUNkLENBQUM7SUFFRCw0QkFBNEI7UUFDMUIsT0FBTyxJQUFJLENBQUM7SUFDZCxDQUFDO0lBRUQsYUFBYTtRQUNYLE9BQU8sSUFBSSxDQUFDO0lBQ2QsQ0FBQztJQUVELG9CQUFvQjtRQUNsQixPQUFPLElBQUksQ0FBQztJQUNkLENBQUM7SUFFRCx3QkFBd0I7UUFDdEIsT0FBTyxJQUFJLENBQUM7SUFDZCxDQUFDO0lBRUQ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