()
| 17541 | } |
| 17542 | |
| 17543 | function $$TestabilityProvider() { |
| 17544 | this.$get = ['$rootScope', '$browser', '$location', |
| 17545 | function($rootScope, $browser, $location) { |
| 17546 | |
| 17547 | /** |
| 17548 | * @name $testability |
| 17549 | * |
| 17550 | * @description |
| 17551 | * The private $$testability service provides a collection of methods for use when debugging |
| 17552 | * or by automated test and debugging tools. |
| 17553 | */ |
| 17554 | var testability = {}; |
| 17555 | |
| 17556 | /** |
| 17557 | * @name $$testability#findBindings |
| 17558 | * |
| 17559 | * @description |
| 17560 | * Returns an array of elements that are bound (via ng-bind or {{}}) |
| 17561 | * to expressions matching the input. |
| 17562 | * |
| 17563 | * @param {Element} element The element root to search from. |
| 17564 | * @param {string} expression The binding expression to match. |
| 17565 | * @param {boolean} opt_exactMatch If true, only returns exact matches |
| 17566 | * for the expression. Filters and whitespace are ignored. |
| 17567 | */ |
| 17568 | testability.findBindings = function(element, expression, opt_exactMatch) { |
| 17569 | var bindings = element.getElementsByClassName('ng-binding'); |
| 17570 | var matches = []; |
| 17571 | forEach(bindings, function(binding) { |
| 17572 | var dataBinding = angular.element(binding).data('$binding'); |
| 17573 | if (dataBinding) { |
| 17574 | forEach(dataBinding, function(bindingName) { |
| 17575 | if (opt_exactMatch) { |
| 17576 | var matcher = new RegExp('(^|\\s)' + escapeForRegexp(expression) + '(\\s|\\||$)'); |
| 17577 | if (matcher.test(bindingName)) { |
| 17578 | matches.push(binding); |
| 17579 | } |
| 17580 | } else { |
| 17581 | if (bindingName.indexOf(expression) != -1) { |
| 17582 | matches.push(binding); |
| 17583 | } |
| 17584 | } |
| 17585 | }); |
| 17586 | } |
| 17587 | }); |
| 17588 | return matches; |
| 17589 | }; |
| 17590 | |
| 17591 | /** |
| 17592 | * @name $$testability#findModels |
| 17593 | * |
| 17594 | * @description |
| 17595 | * Returns an array of elements that are two-way found via ng-model to |
| 17596 | * expressions matching the input. |
| 17597 | * |
| 17598 | * @param {Element} element The element root to search from. |
| 17599 | * @param {string} expression The model expression to match. |
| 17600 | * @param {boolean} opt_exactMatch If true, only returns exact matches |
nothing calls this directly
no test coverage detected