Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 1.08 KB

no-angular-attributes.md

File metadata and controls

37 lines (30 loc) · 1.08 KB

Discourage using Angular attributes inside CSS selectors

Ensure attributes used by Angular internally are not used to locate elements via Protractor.

Rule details

The rule would scan attributes used inside CSS selectors and would complain about any attribute that starts with ng- or data-ng- or x-ng-.

👎 Any use of the following patterns are considered warnings:

element(by.css("[ng-show=test]"));
element.all(by.css("[ng-hide]"));
$("[ng-src*=test]");
$$("[x-ng-href$=com]");
$("[data-ng-cloak]");
$$("a[href^=/], .container:has(nav) > [ng-focus]");
$("a[href^=/], [ng-init*='test'] > .container");
element(by.id("id")).$$("[ng-blur^=expression], a[href^=/]");
element(by.id("id")).$("[data-ng-pattern*='test']");

👍 The following patterns are not warnings:

element(by.css("input"));
element.all(by.css(".container"));
$(".show");
$$(".hide");
$("[cloak]");
$$("a[href^=/], .container:has(nav)");
$("a[href^=/], .container");
element(by.id("id")).$$("a[href^=/]");
element(by.id("id")).$("input");
var s = "ng-cloak";
element(by.id("data-ng-pattern"));