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

Test fails because ionic slider undefined #204

Closed
ryaa opened this issue Jan 3, 2017 · 3 comments
Closed

Test fails because ionic slider undefined #204

ryaa opened this issue Jan 3, 2017 · 3 comments

Comments

@ryaa
Copy link

ryaa commented Jan 3, 2017

I created new project from here https://github.com/driftyco/ionic-starter-super and followed the instructions in the blog http://lathonez.github.io/2016/ionic-2-unit-testing/ to enable unit testing.
The problem is that the test fails because there is an error in ionic slider - see attached
_this.slider is undefined. Not sure why this is happening

screen shot 2017-01-03 at 04 16 30

The source code can be found at https://[email protected]/bossgit/boss811.mobile.git in master branch

@ryaa
Copy link
Author

ryaa commented Jan 4, 2017

Adding fixture.detectChanges() line into test.ts fixed the problem. Here is how it looks now

  public static beforeEachCompiler(components: Array<any>): Promise<{fixture: any, instance: any}> {
    return TestUtils.configureIonicTestingModule(components)
      .compileComponents().then(() => {
        let fixture: any = TestBed.createComponent(components[0]);
        fixture.detectChanges();
        return {
          fixture: fixture,
          instance: fixture.debugElement.componentInstance,
        };
      });
  }

@lathonez
Copy link
Owner

lathonez commented Jan 4, 2017

glad you sorted it

@lathonez lathonez closed this as completed Jan 4, 2017
@lathonez
Copy link
Owner

lathonez commented Jan 4, 2017

#191

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