Skip to content

Can't unit test the player component. Can't set properties of undefined (setting 'src') when the player is added to the app component #142

Open
@vladyn

Description

@vladyn

Description

Can't unit test a component contains ngx-videogular

Expected Behavior

I have a simple player exactly created as per docs. I Expect when I add the component to the app component view my unit tests not to brake.

Actual Behavior

Unit tests are broken with an eroor

ERROR: 'Error during cleanup of component', Object{component: AppComponent{title: 'm3-learning-hub', __ngContext__: 0}, stacktrace: TypeError: Cannot set properties of undefined (setting 'src')
TypeError: Cannot set properties of undefined (setting 'src')
    at VgMediaDirective.call [as ngOnDestroy] (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@videogular/ngx-videogular/fesm2022/videogular-ngx-videogular-core.mjs:944:25)
    at executeOnDestroys (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2022/core.mjs:9960:32)
    at cleanUpView (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2022/core.mjs:9863:9)
    at destroyViewTree (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2022/core.mjs:9698:17)
    at destroyLView (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2022/core.mjs:9836:9)
    at ViewRef$1.destroy (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2022/core.mjs:12672:9)
    at ComponentRef.destroy (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2022/core.mjs:15462:23)
    at PseudoApplicationComponentFixture.destroy (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2022/testing.mjs:243:31)
    at PseudoApplicationComponentFixture.destroy (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2022/testing.mjs:388:15)

Steps to Reproduce

If this is an issue, describe the steps you took to see the issue. If this is a feature, delete this block.

  1. create simple videogular player from as per the docs
  2. add it to the app component e.g. -
  3. tests for the app component always fails with the above error

Em I doing something wrong here or this is known issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions