@this
()
| 20376 | |
| 20377 | /** @this */ |
| 20378 | function $$TestabilityProvider() { |
| 20379 | this.$get = ['$rootScope', '$browser', '$location', |
| 20380 | function($rootScope, $browser, $location) { |
| 20381 | |
| 20382 | /** |
| 20383 | * @name $testability |
| 20384 | * |
| 20385 | * @description |
| 20386 | * The private $$testability service provides a collection of methods for use when debugging |
| 20387 | * or by automated test and debugging tools. |
| 20388 | */ |
| 20389 | var testability = {}; |
| 20390 | |
| 20391 | /** |
| 20392 | * @name $$testability#findBindings |
| 20393 | * |
| 20394 | * @description |
| 20395 | * Returns an array of elements that are bound (via ng-bind or {{}}) |
| 20396 | * to expressions matching the input. |
| 20397 | * |
| 20398 | * @param {Element} element The element root to search from. |
| 20399 | * @param {string} expression The binding expression to match. |
| 20400 | * @param {boolean} opt_exactMatch If true, only returns exact matches |
| 20401 | * for the expression. Filters and whitespace are ignored. |
| 20402 | */ |
| 20403 | testability.findBindings = function(element, expression, opt_exactMatch) { |
| 20404 | var bindings = element.getElementsByClassName('ng-binding'); |
| 20405 | var matches = []; |
| 20406 | forEach(bindings, function(binding) { |
| 20407 | var dataBinding = angular.element(binding).data('$binding'); |
| 20408 | if (dataBinding) { |
| 20409 | forEach(dataBinding, function(bindingName) { |
| 20410 | if (opt_exactMatch) { |
| 20411 | var matcher = new RegExp('(^|\\s)' + escapeForRegexp(expression) + '(\\s|\\||$)'); |
| 20412 | if (matcher.test(bindingName)) { |
| 20413 | matches.push(binding); |
| 20414 | } |
| 20415 | } else { |
| 20416 | if (bindingName.indexOf(expression) !== -1) { |
| 20417 | matches.push(binding); |
| 20418 | } |
| 20419 | } |
| 20420 | }); |
| 20421 | } |
| 20422 | }); |
| 20423 | return matches; |
| 20424 | }; |
| 20425 | |
| 20426 | /** |
| 20427 | * @name $$testability#findModels |
| 20428 | * |
| 20429 | * @description |
| 20430 | * Returns an array of elements that are two-way found via ng-model to |
| 20431 | * expressions matching the input. |
| 20432 | * |
| 20433 | * @param {Element} element The element root to search from. |
| 20434 | * @param {string} expression The model expression to match. |
| 20435 | * @param {boolean} opt_exactMatch If true, only returns exact matches |
nothing calls this directly
no test coverage detected