gulp-protractor-qa icon indicating copy to clipboard operation
gulp-protractor-qa copied to clipboard

Handle any form of denormalized directives

Open stramel opened this issue 9 years ago • 8 comments

According to the official documentation, Angular allows the following:

<span ng-bind="name"></span>
<span ng:bind="name"></span>
<span ng_bind="name"></span>
<span data-ng-bind="name"></span>
<span x-ng-bind="name"></span> 

Currently, only ng- and data-ng- are supported. (https://github.com/ramonvictor/gulp-protractor-qa/blob/master/lib/find-view-matches.js#L55)

Reference: https://docs.angularjs.org/guide/directive#normalization

stramel avatar Oct 22 '15 18:10 stramel

I'm working on it now! Thanks for your contributions, @stramel! Very welcome! :)

ramonvictor avatar Oct 22 '15 18:10 ramonvictor

Just an update on this, selectors with : don't seem to be supported by cheerio. I get this error:

SyntaxError: Malformed attribute selector: ng:repeat="

When I remove ng: option all works fine. Thus, I'm not including ng: variation for now.

ramonvictor avatar Oct 22 '15 19:10 ramonvictor

I'm wondering if there would be a way to wildcard match the attribute and strip off the ng:, ng-, ng_ and everything before the ng. That would cover all cases but I'm not sure if it would be possible to look for an attribute containing bind

stramel avatar Oct 22 '15 20:10 stramel

694c2f74ad84fbd167536f9198b567f09a63b2b5 should cover all prefixes, except ng:.

ramonvictor avatar Oct 22 '15 20:10 ramonvictor

I know what you mean, I'll think about it later. I want to focus on publishing this refactored version first.

ramonvictor avatar Oct 22 '15 20:10 ramonvictor

I agree, it would be good to get this out.

stramel avatar Oct 22 '15 20:10 stramel

@ramonvictor Thoughts?

Using the Cheerio Plugins to create a different find method that strips the prefixes.

stramel avatar Oct 22 '15 21:10 stramel

@stramel that sounds a good approach. I'll take a look on it soon. Thanks for one more nice suggestion.

ramonvictor avatar Oct 23 '15 18:10 ramonvictor