@angular/material/icon#MatIcon TypeScript Examples

The following examples show how to use @angular/material/icon#MatIcon. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: mock-mat-icon.ts    From WowUp with GNU General Public License v3.0 6 votes vote down vote up
export function overrideIconModule(testBed: TestBedStatic): TestBedStatic {
  return testBed.overrideModule(MatIconModule, {
    remove: {
      declarations: [MatIcon],
      exports: [MatIcon],
    },
    add: {
      declarations: [MockMatIconComponent],
      exports: [MockMatIconComponent],
    },
  });
}
Example #2
Source File: funding-button.component.spec.ts    From WowUp with GNU General Public License v3.0 5 votes vote down vote up
describe("FundingButtonComponent", () => {
  let component: FundingButtonComponent;
  let fixture: ComponentFixture<FundingButtonComponent>;

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      declarations: [FundingButtonComponent, MatIcon],
      imports: [
        MatModule,
        HttpClientModule,
        NoopAnimationsModule,
        MatIconTestingModule,
        TranslateModule.forRoot({
          loader: {
            provide: TranslateLoader,
            useFactory: httpLoaderFactory,
            deps: [HttpClient],
          },
          compiler: {
            provide: TranslateCompiler,
            useClass: TranslateMessageFormatCompiler,
          },
        }),
      ],
      schemas: [CUSTOM_ELEMENTS_SCHEMA],
    }).compileComponents();
  });

  beforeEach(() => {
    fixture = TestBed.createComponent(FundingButtonComponent);
    component = fixture.componentInstance;
    component.funding = {
      platform: "TEST",
      url: "TEST",
    };
    fixture.detectChanges();
  });

  it("should create", () => {
    expect(component).toBeTruthy();
  });
});
Example #3
Source File: footer.component.spec.ts    From WowUp with GNU General Public License v3.0 5 votes vote down vote up
/** Fix icon warning? https://stackoverflow.com/a/62277810 */
describe("FooterComponent", () => {
  let fixture: ComponentFixture<FooterComponent>;
  let wowUpServiceSpy: WowUpService;
  let sessionServiceSpy: SessionService;
  let electronService: ElectronService;
  let linkService: LinkService;

  beforeEach(async () => {
    mockPreload();

    wowUpServiceSpy = jasmine.createSpyObj("WowUpService", [], {
      getApplicationVersion: () => Promise.resolve("TESTV"),
      wowupUpdateCheck$: new Subject<UpdateCheckResult>().asObservable(),
      wowupUpdateDownloaded$: new Subject<any>().asObservable(),
      wowupUpdateDownloadInProgress$: new Subject<boolean>().asObservable(),
    });

    sessionServiceSpy = jasmine.createSpyObj("SessionService", [""], {
      statusText$: new BehaviorSubject(""),
      pageContextText$: new BehaviorSubject(""),
      wowUpAccount$: new Subject(),
    });

    linkService = jasmine.createSpyObj("LinkService", [""], {});

    electronService = jasmine.createSpyObj("ElectronService", [""], {
      appUpdate$: new Subject(),
    });

    await TestBed.configureTestingModule({
      declarations: [FooterComponent, MatIcon],
      imports: [
        MatModule,
        NoopAnimationsModule,
        MatIconTestingModule,
        OverlayModule,
        HttpClientModule,
        TranslateModule.forRoot({
          loader: {
            provide: TranslateLoader,
            useFactory: httpLoaderFactory,
            deps: [HttpClient],
          },
          compiler: {
            provide: TranslateCompiler,
            useClass: TranslateMessageFormatCompiler,
          },
        }),
      ],
    })
      .overrideComponent(FooterComponent, {
        set: {
          providers: [
            { provide: ElectronService, useValue: electronService },
            { provide: WowUpService, useValue: wowUpServiceSpy },
            { provide: SessionService, useValue: sessionServiceSpy },
            { provide: LinkService, useValue: linkService },
          ],
        },
      })
      .compileComponents();
  });

  it("should create", () => {
    fixture = TestBed.createComponent(FooterComponent);
    expect(fixture.componentInstance).toBeTruthy();
  });
});