-
Notifications
You must be signed in to change notification settings - Fork 27.4k
docs : update unit-testing-component-controllers #15974
Conversation
@musclor Just a few more remarks with regards to the comment you left on your previous PR:
Btw, any reason you closed the previous PR and created a new one? There's no need for that, you can simply update existing PR's by pushing new commits to your branch on which you created the PR! |
As per the section 'Testing Directives With External Templates' of https://docs.angularjs.org/guide/unit-testing : if the test directory hierarchy differs from the application's, the test with $compile will fail because of an unexpected GET to retrieve the template from the server. I am sorry I closed the previous PR the reason is I only used the link on 'Improve this Doc' of Angular's website during the whole process. Thank you for your advice I will try to do like that next time. Kind regards |
@musclor Afaik this does not mean you can't test it. It even explains what you need to do in order to ensure this is not going to be a problem. It doesn't mention using
Anyhow, doesn't matter now, the PR is merged 😛 |
You are refering to a sub section of 'Testing Directives' which uses $compile. Furthermore the directive example uses The fact that the PR is merged does not mean we cannot do further improvements to the documentation ! ;p Have a nice day |
@musclor I'm not sure what you're saying I'm refering to, but this is what I'm talking about: https://plnkr.co/edit/JUbGZuFZG2FPnNK18Kal?p=preview The tests are green. Even tho I wouldn't use the They also both fail if the binding is removed from the corresponding component. |
@frederikprijck It's because you are using $templateCache (same as karma-ng-html2js-preprocessor). If you comment it the templateUrl test will fail. |
@musclor I'm totally confused about what you're trying to point out. I know it will fail when you comment it out but if you want to have tests with templateUrl, you need to use any of those. Commenting that out or not using Afaik you're initial problem with the unit test in the docs was:
Afaict, this is solved with the tests in the plunkr. Hence my proposal to add it as a test instead of the removed test. (as it does what you where saying you wanted the test to be doing). Anyway ... this is getting to chatty, feel free to ping me over at https://gitter.im/angular/angular.js to discuss this further. |
Nothing more to add @frederikprijck
Exactly what I tried to say from the begining actually :) I just think for the sake of simplicity it is better for the documentation to use a simplier component with Thank you for your time and explainations (I have learnt a few new things thanks to you :) |
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
docs update
What is the current behavior? (You can also link to an open issue here)
#15968
What is the new behavior (if this is a feature change)?
Removes a useless spec.
Does this PR introduce a breaking change?
No
Please check if the PR fulfills these requirements
Other information: