Support for unit testing frameworks on pages with <swal /> components
See original GitHub issueWhen testing pages using Jest or Jasmine with <swal> components or partials, importing the module or component at the top of the page leads to the following error.
```
StaticInjectorError[InjectionToken SwalDefaults]:
StaticInjectorError[InjectionToken SwalDefaults]:
NullInjectorError: No provider for InjectionToken SwalDefaults!
The alerts are working all over the app, and regular Swal() in the code work fine, even in tests.
Any help is appreciated!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Write Tests for Your Lightning Components Unit - Trailhead
Explain the role of the Lightning Test Service, its helpers, and execution methods. ... This is a modern framework for building single-page applications ......
Read more >JavaScript unit testing frameworks in 2022: A comparison
We examined 11 of the most popular JavaScript unit testing frameworks according to stateofjs.com, to help you decide which is best for you....
Read more >Testing - Lit.dev
Lit is a standard modern Javascript library, and you can use virtually any Javascript testing framework to test your Lit code.
Read more >20 Most Popular Unit Testing Tools in 2022
Here is the list of top Unit Testing Frameworks used by developers ... unit test; It supports data-driven testing using a group of...
Read more >swal popup
Swal PopupYou can add the custom animation using the Animate CSS, ... only to those alerts you want to be wide: swal (...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Unit testing with sweetAlert is very easy and handy. Please folor this link https://github.com/prmkishor/sweetAletUnitTesting/wiki/sweetAlert2-Angular-Unit-Testing
No provider for InjectionToken SwalDefaults
means that you (probably?) didn’t use forRoot and therefore, you haven’t provided that token to the library, which needs it. If you need more help please open a new issue, showing how you declared your tests.