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

Unsubscription error when running any default component test using Steps #10379

Closed
Cito opened this issue Jun 30, 2021 · 0 comments
Closed

Unsubscription error when running any default component test using Steps #10379

Cito opened this issue Jun 30, 2021 · 0 comments
Assignees
Labels
LTS-FIXED-10.1.4 Fixed in PrimeNG LTS 10.1.4 LTS-FIXED-11.4.7 Fixed in PrimeNG LTS 11.4.7 Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@Cito
Copy link
Contributor

Cito commented Jun 30, 2021

I'm submitting a ... (check one with "x")

[X] bug report => Search github for a similar issue or PR before submitting

If the Steps component is created, but not initialized, then the unsubscription in the ngDestroy method fails, because the subscription property is not set. This happens for instance in the default tests created by angular-cli which just test if a component can be created. If the component uses Steps, then you get an error in the console log and start to wonder what's happening here.

To replicate the bug, add the following spec to src\app\components\steps\steps.spec.ts in the PrimeNG source code:

    it('should create', () => {
        expect(testComponent).toBeTruthy();
    });

The run the tests with ng tests and look at the output in the console. You will see something like

ERROR: 'Error during cleanup of component', Object{component: TestStpesComponent{activeIndex: 1, __ngContext__: [..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ...]}, stacktrace: TypeError: Cannot read property 'unsubscribe' of undefined
TypeError: Cannot read property 'unsubscribe' of undefined
    at Steps.ngOnDestroy (http://localhost:9877/_karma_webpack_/webpack:/src/app/components/steps/steps.ts:92:27)
  • Angular version: 12.0.5

  • PrimeNG version: 12.0.1

I have revently submitted a very simple fix as PR #9881.

@yigitfindikli yigitfindikli self-assigned this Jul 1, 2021
@yigitfindikli yigitfindikli added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Jul 1, 2021
@yigitfindikli yigitfindikli added this to the 12.1.0-rc.1 milestone Jul 1, 2021
@yigitfindikli yigitfindikli added LTS-FIXED-10.1.4 Fixed in PrimeNG LTS 10.1.4 LTS-FIXED-11.4.7 Fixed in PrimeNG LTS 11.4.7 and removed LTS-PORTABLE labels Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTS-FIXED-10.1.4 Fixed in PrimeNG LTS 10.1.4 LTS-FIXED-11.4.7 Fixed in PrimeNG LTS 11.4.7 Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

2 participants