Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

content: Ionic Angular Testing (Standalone etc) #3808

Open
studioromeo opened this issue Aug 29, 2024 · 0 comments
Open

content: Ionic Angular Testing (Standalone etc) #3808

studioromeo opened this issue Aug 29, 2024 · 0 comments
Labels
triage New issues

Comments

@studioromeo
Copy link

URL

https://ionicframework.com/docs/angular/testing

Issue Description

We are in dire need of some documentation on how to test ionic in angular.

The current documentation explains the theory behind testing but does not go into ionic specifics. I'd argue that the theory behind what is a unit test has been covered elsewhere in more detail and so it's not important for the ionic docs to go over that.

What we could use is knowing how to correctly bootstrap ionic so that components are loaded correctly and can be tested. I know theres some nuances due to ionics web component architecture. Some of it is explained on stencil docs and elsewhere.

While I've been able to figure out some things through looking the ionic source code and also a bit of blind luck there are some things I haven't been able to determine yet. For example when testing a standalone project it's not clear how to bootstrap ionic in testbed or whether its required at all? Using provideIonicAngular() doesn't seem to render any components but importing IonicModule does (but only if calling forRoot).

TestBed.configureTestingModule({
      providers: [
        importProvidersFrom(IonicModule.forRoot()), <<< - works but is this right?
        provideIonicAngular({}), // does not render but is more alike to real world
      ],
    }).compileComponents()

But there are issues with using IonicModule.forRoot as described here ionic-team/ionic-framework#23173 (comment) hence why standalone is a good idea but these components don't seem to render?

Any advice is helpful on this to point us in the right direction 🙏

@studioromeo studioromeo added the triage New issues label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage New issues
Projects
None yet
Development

No branches or pull requests

1 participant