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

deferBlock() triggers undefined (reading 'render') #675

Open
carflynn2009 opened this issue Oct 21, 2024 · 1 comment
Open

deferBlock() triggers undefined (reading 'render') #675

carflynn2009 opened this issue Oct 21, 2024 · 1 comment

Comments

@carflynn2009
Copy link

carflynn2009 commented Oct 21, 2024

Is this a regression?

Yes

Description

When using deferBlock() with any of the four callbacks i get undefined (reading 'render') and the test exits

even if i use an empty test file and copy the example code from the Spectator docs it fails in the same way

    @Component({
      selector: 'app-cmp',
      template: `
        @defer (on viewport) {
          <div>Complete state of the first defer block</div> <!--Parent Complete State-->

          @defer {
            <div>Complete state of the nested defer block</div> <!--Nested Complete State-->
          }
        } @placeholder {
          <div>Placeholder</div>
        }
      `,
    })
    class DummyComponent {}

    const createComponent = createComponentFactory({
      component: DummyComponent,
      deferBlockBehavior: DeferBlockBehavior.Manual,
    });

    it('should render the first nested complete state', async () => {
      // Arrange
      const spectator = createComponent();

      // Act
      // Renders the parent complete state
      const parentCompleteState = await spectator.deferBlock().renderComplete();

      // Renders the nested complete state
      await parentCompleteState.deferBlock().renderComplete();

      // Assert
      expect(spectator.element.outerHTML).toContain('nested defer block');
    });
TypeError: Cannot read properties of undefined (reading 'render')
    at http://localhost:9876/_karma_webpack_/webpack:/node_modules/@ngneat/spectator/fesm2022/ngneat-spectator.mjs:796:28
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js:3:1)
    at apply (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js:17:1)
    at _ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone.js:369:28)
    at ProxyZoneSpec.onInvoke (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone-testing.js:2081:39)
    at _ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone.js:368:34)
    at ZoneImpl.run (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone.js:111:43)
    at apply (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone.js:2538:40)
    at _ZoneDelegate.invokeTask (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone.js:402:33)

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

`undefined (reading 'render')`

Please provide the environment you discovered this bug in

Angular 18.2.0
Spectator 19.0.0

Anything else?

No response

Do you want to create a pull request?

No

@ShivaniShanbhag27
Copy link

Hey, any updates on this I am facing a similar issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants