-
Notifications
You must be signed in to change notification settings - Fork 6.7k
feat(tooltip): added tooltip-html-unsafe directive #257
Conversation
The directive displays the unsanitized HTML in the tooltip instead of the escaped text. The $tooltip service has been modified to allow a little more flexibility in terms of the prefix used on the $observe'd attributes. For example, the `tooltip-html-unsafe` directive needs to be called as written, but it would be nonsensical to require all other attributes (like animation or placement) to also use that verbose prefix as opposed to the simpler and more familiar `tooltip-` prefix. The service now allows independent specification of the name and its prefix. Lastly, the docs for the tooltip and popover have been updated to show their available optional attributes. Closes angular-ui#246
Great stuff @joshdmiller! Looks good on the first sight, wanted to see if tests pass on all browsers but seems like Jenkins is not pinking up git changes... Will try to ping Igor to see what is going on here, we need to hold on non-trivial merges till this is resolved. |
@joshdmiller looks like CI is back so I've merged it into the Added some comments to the 17be39b but those might be more like me having hard time reading the code. Feel free to comment / change / ignore. Otherwise good to merge. Solid wrok, the |
@pkozlowski-opensource Awesome. The As for the single test, you are right that I do not test to ensure HTML is output. The reason for this is that this directive actually doesn't do it - the So while I didn't write a test that the HTML itself makes it out, all this would really test is that (a) the template contains the string The alternative would be to test that the contents of the inserted DOM node matches this HTML, but that would require building in knowledge of the template into the tests, which I think we should avoid if possible. Plus I don't think it's necessary anyway. So the only test I wrote is that the directive actually gets called - with the service and provider, everything else should already have been tested. What do you think? |
@joshdmiller don't worry about the Regarding the tests:
Anyway, there are many ways of writing tests so feel free to ignore the above, just sharing my thoughts here. Otherwise go ahead and merge it! |
This looks good to me :) |
1 similar comment
This looks good to me :) |
@joshdmiller I would like to land it and work toward a next release. Do you want me to do the changes discussed in this PR and merge it? Or are you going to merge it? |
@pkozlowski-opensource Somehow this got knocked out of my queue. I'll fix and merge today. |
@joshdmiller awesome, I will work on other PRs / issues then. |
Landed as 45ed280. |
The directive displays the unsanitized HTML in the tooltip instead of
the escaped text.
The $tooltip service has been modified to allow a little more
flexibility in terms of the prefix used on the $observe'd attributes.
For example, the
tooltip-html-unsafe
directive needs to be called aswritten, but it would be nonsensical to require all other attributes
(like animation or placement) to also use that verbose prefix as opposed
to the simpler and more familiar
tooltip-
prefix. The service nowallows independent specification of the name and its prefix.
Lastly, the docs for the tooltip and popover have been updated to show
their available optional attributes.
Closes #246