@fortawesome/angular-fontawesome#FaIconLibrary TypeScript Examples
The following examples show how to use
@fortawesome/angular-fontawesome#FaIconLibrary.
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: core.module.ts From enterprise-ng-2020-workshop with MIT License | 6 votes |
constructor(
@Optional()
@SkipSelf()
parentModule: CoreModule,
faIconLibrary: FaIconLibrary
) {
if (parentModule) {
throw new Error('CoreModule is already loaded. Import only in AppModule');
}
faIconLibrary.addIcons(
faCog,
faBars,
faRocket,
faPowerOff,
faUserCircle,
faPlayCircle,
faGithub,
faMediumM,
faTwitter,
faInstagram,
faYoutube
);
}
Example #2
Source File: shared.module.ts From enterprise-ng-2020-workshop with MIT License | 6 votes |
constructor(faIconLibrary: FaIconLibrary) {
faIconLibrary.addIcons(
faGithub,
faMediumM,
faPlus,
faEdit,
faTrash,
faTimes,
faCaretUp,
faCaretDown,
faExclamationTriangle,
faFilter,
faTasks,
faCheck,
faSquare,
faLanguage,
faPaintBrush,
faLightbulb,
faWindowMaximize,
faStream,
faBook
);
}
Example #3
Source File: app.module.ts From tzcolors with MIT License | 6 votes |
constructor(library: FaIconLibrary) {
library.addIcons(fasStar, faCog, faDog, faWindowRestore)
library.addIcons(
farStar,
farMoon,
farSun,
faSortAmountUp,
faSortAmountDown,
faSortAlphaUp,
faSortAlphaDown
)
}
Example #4
Source File: app.module.ts From ngx-htaccess-generator with MIT License | 5 votes |
constructor(private library: FaIconLibrary) {
library.addIconPacks(fas, far);
}
Example #5
Source File: icons.module.ts From dayz-server-manager with MIT License | 5 votes |
public constructor(library: FaIconLibrary) {
library.addIconPacks(
fontAwesomeSolidIcons,
fontAwesomeRegularIcons,
fontAwesomeBrandsIcons,
);
}
Example #6
Source File: app.module.ts From mini-projects-2021 with MIT License | 5 votes |
constructor(library: FaIconLibrary) {
// Add multiple icons to the library
library.addIcons(fasStar, farStar, farAddressCard, farCalendarAlt);
}
Example #7
Source File: settings-container.component.spec.ts From enterprise-ng-2020-workshop with MIT License | 4 votes |
describe('SettingsComponent', () => {
let component: SettingsContainerComponent;
let fixture: ComponentFixture<SettingsContainerComponent>;
let store: MockStore;
let dispatchSpy;
let mockSelectSettings: MemoizedSelector<{}, SettingsState>;
const getThemeSelectArrow = () =>
fixture.debugElement.queryAll(By.css('.mat-select-trigger'))[1];
const getSelectOptions = () =>
fixture.debugElement.queryAll(By.css('mat-option'));
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
FontAwesomeModule,
SharedModule,
NoopAnimationsModule,
TranslateModule.forRoot()
],
providers: [provideMockStore()],
declarations: [SettingsContainerComponent]
}).compileComponents();
TestBed.inject(FaIconLibrary).addIcons(faBars);
store = TestBed.inject(MockStore);
mockSelectSettings = store.overrideSelector(
selectSettings,
{} as SettingsState
);
fixture = TestBed.createComponent(SettingsContainerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should dispatch change sticky header on sticky header toggle', () => {
dispatchSpy = spyOn(store, 'dispatch');
const componentDebug = fixture.debugElement;
const slider = componentDebug.queryAll(By.directive(MatSlideToggle))[0];
slider.triggerEventHandler('change', { checked: false });
fixture.detectChanges();
expect(dispatchSpy).toHaveBeenCalledTimes(1);
expect(dispatchSpy).toHaveBeenCalledWith(
actionSettingsChangeStickyHeader({ stickyHeader: false })
);
});
it('should dispatch change theme action on theme selection', () => {
dispatchSpy = spyOn(store, 'dispatch');
getThemeSelectArrow().triggerEventHandler('click', {});
fixture.detectChanges();
getSelectOptions()[1].triggerEventHandler('click', {});
fixture.detectChanges();
expect(dispatchSpy).toHaveBeenCalledTimes(1);
expect(dispatchSpy).toHaveBeenCalledWith(
actionSettingsChangeTheme({ theme: 'LIGHT-THEME' })
);
});
it('should dispatch change auto night mode on night mode toggle', () => {
dispatchSpy = spyOn(store, 'dispatch');
const componentDebug = fixture.debugElement;
const slider = componentDebug.queryAll(By.directive(MatSlideToggle))[1];
slider.triggerEventHandler('change', { checked: false });
fixture.detectChanges();
expect(dispatchSpy).toHaveBeenCalledTimes(1);
expect(dispatchSpy).toHaveBeenCalledWith(
actionSettingsChangeAutoNightMode({ autoNightMode: false })
);
});
it('should dispatch change animations page', () => {
dispatchSpy = spyOn(store, 'dispatch');
const componentDebug = fixture.debugElement;
const slider = componentDebug.queryAll(By.directive(MatSlideToggle))[2];
slider.triggerEventHandler('change', { checked: false });
fixture.detectChanges();
expect(dispatchSpy).toHaveBeenCalledTimes(1);
expect(dispatchSpy).toHaveBeenCalledWith(
actionSettingsChangeAnimationsPage({ pageAnimations: false })
);
});
it('should dispatch change animations elements', () => {
dispatchSpy = spyOn(store, 'dispatch');
const componentDebug = fixture.debugElement;
const slider = componentDebug.queryAll(By.directive(MatSlideToggle))[3];
slider.triggerEventHandler('change', { checked: false });
fixture.detectChanges();
expect(dispatchSpy).toHaveBeenCalledTimes(1);
expect(dispatchSpy).toHaveBeenCalledWith(
actionSettingsChangeAnimationsElements({ elementsAnimations: false })
);
});
it('should disable change animations page when disabled is set in state', () => {
mockSelectSettings.setResult({
pageAnimationsDisabled: true
} as SettingsState);
store.refreshState();
fixture.detectChanges();
dispatchSpy = spyOn(store, 'dispatch');
const componentDebug = fixture.debugElement;
const slider = componentDebug.queryAll(By.directive(MatSlideToggle))[2];
console.log(slider);
slider.triggerEventHandler('change', { checked: false });
fixture.detectChanges();
expect(dispatchSpy).toHaveBeenCalledTimes(0);
});
});