()
| 18576 | } |
| 18577 | |
| 18578 | function $$TestabilityProvider() { |
| 18579 | this.$get = ['$rootScope', '$browser', '$location', |
| 18580 | function($rootScope, $browser, $location) { |
| 18581 | |
| 18582 | /** |
| 18583 | * @name $testability |
| 18584 | * |
| 18585 | * @description |
| 18586 | * The private $$testability service provides a collection of methods for use when debugging |
| 18587 | * or by automated test and debugging tools. |
| 18588 | */ |
| 18589 | var testability = {}; |
| 18590 | |
| 18591 | /** |
| 18592 | * @name $$testability#findBindings |
| 18593 | * |
| 18594 | * @description |
| 18595 | * Returns an array of elements that are bound (via ng-bind or {{}}) |
| 18596 | * to expressions matching the input. |
| 18597 | * |
| 18598 | * @param {Element} element The element root to search from. |
| 18599 | * @param {string} expression The binding expression to match. |
| 18600 | * @param {boolean} opt_exactMatch If true, only returns exact matches |
| 18601 | * for the expression. Filters and whitespace are ignored. |
| 18602 | */ |
| 18603 | testability.findBindings = function(element, expression, opt_exactMatch) { |
| 18604 | var bindings = element.getElementsByClassName('ng-binding'); |
| 18605 | var matches = []; |
| 18606 | forEach(bindings, function(binding) { |
| 18607 | var dataBinding = angular.element(binding).data('$binding'); |
| 18608 | if (dataBinding) { |
| 18609 | forEach(dataBinding, function(bindingName) { |
| 18610 | if (opt_exactMatch) { |
| 18611 | var matcher = new RegExp('(^|\\s)' + escapeForRegexp(expression) + '(\\s|\\||$)'); |
| 18612 | if (matcher.test(bindingName)) { |
| 18613 | matches.push(binding); |
| 18614 | } |
| 18615 | } else { |
| 18616 | if (bindingName.indexOf(expression) != -1) { |
| 18617 | matches.push(binding); |
| 18618 | } |
| 18619 | } |
| 18620 | }); |
| 18621 | } |
| 18622 | }); |
| 18623 | return matches; |
| 18624 | }; |
| 18625 | |
| 18626 | /** |
| 18627 | * @name $$testability#findModels |
| 18628 | * |
| 18629 | * @description |
| 18630 | * Returns an array of elements that are two-way found via ng-model to |
| 18631 | * expressions matching the input. |
| 18632 | * |
| 18633 | * @param {Element} element The element root to search from. |
| 18634 | * @param {string} expression The model expression to match. |
| 18635 | * @param {boolean} opt_exactMatch If true, only returns exact matches |
nothing calls this directly
no test coverage detected