Commit Graph

15 Commits

Author SHA1 Message Date
Igor Lins e Silva b9ce5d80d1 Set standalone property to false for testing components 2024-11-20 22:29:44 +01:00
Yaroslav Admin 2a3a9e77e1 Update to Angular 18
Fixes #445
2024-05-23 19:31:48 +02:00
Yaroslav Admin 31ba9799c0 Simplify testing configuration implementation 2024-05-09 21:04:52 +02:00
bleistift2 14c4812d8e Feat: Allow Configuring the testing module to not throw errors when adding icons
The FontAwesomeTestingModule is now configurable via a `forRoot` method.
The configuration object passed to it configures how the mock icon library
should behave when adding icons to it: ignore them, warn about them or throw
an error.

Fix #440
https://github.com/FortAwesome/angular-fontawesome/issues/440
2024-05-09 21:04:52 +02:00
bleistift2 dc9dcca556 Fix: Expose MockFaIconLibrary on the testing API
As discussed in https://github.com/FortAwesome/angular-fontawesome/issues/440#issuecomment-2072194681
2024-05-09 21:04:52 +02:00
Yaroslav Admin 8e42dad8f2 Document how to use custom icons
Fixes #172
2024-04-20 18:53:31 +02:00
Yaroslav Admin 9e9798cb8e Introduce more permissive icon types
With this change `angular-fontawesome` exposes more permissive variants of some types (`IconPrefix`, `IconName`, `IconLookup`, `IconDefinition` and `IconPack`) from the `fontawesome-svg-core`. These new types allow arbitrary string values as icon name and icon prefix while maintaining auto-completion for the core Font Awesome icons.

Firstly, this makes it possible to define and use custom icons without any casts, thus implementing part of the #172 and addressing part of the #423 (Kit packages with custom icons). The documentation for custom icons is coming later in a separate PR.

Secondly, this makes `angular-fontawesome` resilient to multiple instance of `fontawesome-common-types` packages, thus helps with issues like #125.

The drawback of this change is that if a user makes a typo in a core icon name or an icon prefix it will no longer produce a compile-time error, but will throw a runtime error instead. However, this trade-off seems to be overall the best option. Considerations:

1. To keep type safety while supporting custom icons, we'll need to somehow extend the mentioned icon types. It was investigated in the https://github.com/FortAwesome/angular-fontawesome/issues/172#issuecomment-620812343. The conclusion is that it requires very convoluted code to be added to the project and therefore is undesired.
2. For the explicit reference approach, the type safety/completion is not really needed as icon definitions are imported as runtime symbols and importing a symbol which does not exist will always result in complication error.
3. For the icon library approach, the type safety isn't perfect either. While it will catch cases where one specifies a completely incorrect icon name, it does not catch all problems. Icons are added to the library at runtime and if an icon name is correct, but the icon was not added to the library it will still result in a runtime error.
2024-04-18 15:24:10 +02:00
Yaroslav Admin c33f197ad9 Update to Angular 14 2022-06-03 15:33:10 +02:00
Yaroslav Admin 3c016ac994 Make MockFaIconLibrary throw on attempts to add icons or packs
Normally people should not add icons or packs outside of the
`AppModule`/`AppComponent` constructor, so this should only throw in
case of an error and help to detect a mistake (e.g. user imported
`FontAwesomeTestingModule`, but attempts to configure the regular
`FaIconLibrary` and is surprised that icons are not rendered properly).

Even if the above assumption turns out to be wrong it will be easier to
remove this error, then add it after the release (as it will be a
breaking change).
2019-11-10 22:29:34 +01:00
Yaroslav Admin 170922993b Remove Service suffix to align name with the regular version 2019-11-10 22:29:34 +01:00
Yaroslav Admin 134d82e4c2 Introduce Prettier and format the codebase
The only exception are Markdown files as they are heavily updated by
Prettier even in the situations, where it is quite dubious changes.
2019-11-10 17:00:39 +01:00
Yaroslav Admin bb16fd796f Update linter configuration and fix new warnings 2019-11-10 17:00:39 +01:00
Yaroslav Admin 15a1655e0e Remove deprecated APIs and usage of deprecated APIs 2019-11-02 17:48:12 +01:00
Yaroslav Admin 41d6a7ae23 Fix dummy icon definition
Because path was in the array, icon was erroneously assumed to be a
duotone icon and error was reported when component was trying to render
a second path (i.e. missing second element of the array).
2019-11-01 18:39:10 +01:00
Damien Retzinger 527737b613 feat(testing): add basic FontAwesomeTestingModule (#176)
Fixes #134
2019-09-12 17:35:03 +02:00