Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

During unit test, directive template is not being replaced when replace: true is set #3245

Closed
pheuter opened this issue Jul 16, 2013 · 7 comments

Comments

@pheuter
Copy link

pheuter commented Jul 16, 2013

As demonstrated in this plunk: http://plnkr.co/edit/ufrNwS3CPuFpDNy6LVoU?p=preview

@pheuter
Copy link
Author

pheuter commented Jul 16, 2013

See #1859

@pkozlowski-opensource
Copy link
Member

@pheuter Your plunker is missing a template for a directive (/directives/section/section.html). Please update it otherwise there is no way to debug it.

@pheuter
Copy link
Author

pheuter commented Jul 21, 2013

@pkozlowski-opensource The template is cached in views.js

@pkozlowski-opensource
Copy link
Member

OK, I see. So, the problem is in your test. You were trying to use class-based selectors while the build-in jqLite find supports only tag-based selectors: http://docs.angularjs.org/api/angular.element

Just include jQuery and your test start to work: http://plnkr.co/edit/lBvAkNgYTaEMEHqW3yMZ?p=preview

@pheuter
Copy link
Author

pheuter commented Jul 21, 2013

@pkozlowski-opensource I updated the plunk with an alert() containing the html of the compiled element.

As you can see, the problem of the directive not being replaced with the template is still prevalent.

That's the core of the problem.

@pkozlowski-opensource
Copy link
Member

You are missing $rootScope.$digest(); in your test, check my plunk....

@pheuter
Copy link
Author

pheuter commented Jul 21, 2013

Ah, I see. Thanks!

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

No branches or pull requests

2 participants