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

Testing directives with templateUrl returns blank templates #61

Open
Elecash opened this issue Nov 14, 2015 · 12 comments
Open

Testing directives with templateUrl returns blank templates #61

Elecash opened this issue Nov 14, 2015 · 12 comments

Comments

@Elecash
Copy link

Elecash commented Nov 14, 2015

I have a few directives with templateUrl and when I add this module tests stop working me.

 PhantomJS 1.9.8 (Mac OS X 0.0.0) Unit testing login process Should contains the login form FAILED
    Expected '' to contain '<form name="loginForm" ng-submit="ctrl.onSubmit()" novalidate="" class="ng-pristine ng-invalid ng-invalid-required">'.
@seriema
Copy link
Owner

seriema commented Nov 14, 2015

Hmm are those templates using the same URL prefix as your API (apiPath)? We're assuming the API lives in it's own base url so it's not mixed with static content like HTML templates or other non data API things.

@Elecash
Copy link
Author

Elecash commented Nov 14, 2015

It happens with default values, so no, it should not be in the same path.

@seriema
Copy link
Owner

seriema commented Nov 16, 2015

Do you have some code I can check?

@Elecash
Copy link
Author

Elecash commented Nov 16, 2015

I will try to set up an example on Codepen soon :)

@seriema
Copy link
Owner

seriema commented Nov 16, 2015

Thanks! Don't let that hold you up though. If you have something on Github already or if you just write down some data (API call url, url of templates, the apimock config, etc) that could work too.

@Elecash
Copy link
Author

Elecash commented Nov 16, 2015

No, sorry, this is closed source code for a startup.

But no problem, I will try to set up something this afternoon if I have time, ok?

@Elecash
Copy link
Author

Elecash commented Nov 16, 2015

Hi,

I've created this repo with my problem.

https://github.com/Elecash/angular-apimock-test

Follow instructions and you will see the problem. Install dependencies, run "gulp test" and tests should fail.

Open this file: https://github.com/Elecash/angular-apimock-test/blob/master/scripts/hello-world.js

If you comment line 12 and uncomment line 11 tests pass.

@seriema
Copy link
Owner

seriema commented Nov 16, 2015

Wow! Thank you! I'll look into it asap, but I might not have a fix until the weekend.

@Elecash
Copy link
Author

Elecash commented Nov 16, 2015

No problem. Now I'm using a workaround with the ngMockE2E module (I should write a post about it), but this module is a cleaner solution for me :)

@seriema
Copy link
Owner

seriema commented Nov 23, 2015

I tried out your sample and that is indeed odd! I'll need to look into it more. Bonus hugs if you're able to fork and add a test for this. =)

@seriema
Copy link
Owner

seriema commented Apr 30, 2016

@Elecash Sorry, I haven't forgotten about this but I haven't been able to write an automated test for this. It might require E2E testing. Any chance you'd be willing to help with that? As soon as I have a fully reproducible and automated test for it I'll be able to fix it more confidently and know that no future release will get a regression bug.

@Elecash
Copy link
Author

Elecash commented May 2, 2016

The truth is that I'm not working on that project anymore so I just don't need this, sorry!

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

No branches or pull requests

2 participants