()
| 16258 | } |
| 16259 | |
| 16260 | function $$TestabilityProvider() { |
| 16261 | this.$get = ['$rootScope', '$browser', '$location', |
| 16262 | function($rootScope, $browser, $location) { |
| 16263 | |
| 16264 | /** |
| 16265 | * @name $testability |
| 16266 | * |
| 16267 | * @description |
| 16268 | * The private $$testability service provides a collection of methods for use when debugging |
| 16269 | * or by automated test and debugging tools. |
| 16270 | */ |
| 16271 | var testability = {}; |
| 16272 | |
| 16273 | /** |
| 16274 | * @name $$testability#findBindings |
| 16275 | * |
| 16276 | * @description |
| 16277 | * Returns an array of elements that are bound (via ng-bind or {{}}) |
| 16278 | * to expressions matching the input. |
| 16279 | * |
| 16280 | * @param {Element} element The element root to search from. |
| 16281 | * @param {string} expression The binding expression to match. |
| 16282 | * @param {boolean} opt_exactMatch If true, only returns exact matches |
| 16283 | * for the expression. Filters and whitespace are ignored. |
| 16284 | */ |
| 16285 | testability.findBindings = function(element, expression, opt_exactMatch) { |
| 16286 | var bindings = element.getElementsByClassName('ng-binding'); |
| 16287 | var matches = []; |
| 16288 | forEach(bindings, function(binding) { |
| 16289 | var dataBinding = angular.element(binding).data('$binding'); |
| 16290 | if (dataBinding) { |
| 16291 | forEach(dataBinding, function(bindingName) { |
| 16292 | if (opt_exactMatch) { |
| 16293 | var matcher = new RegExp('(^|\\s)' + escapeForRegexp(expression) + '(\\s|\\||$)'); |
| 16294 | if (matcher.test(bindingName)) { |
| 16295 | matches.push(binding); |
| 16296 | } |
| 16297 | } else { |
| 16298 | if (bindingName.indexOf(expression) != -1) { |
| 16299 | matches.push(binding); |
| 16300 | } |
| 16301 | } |
| 16302 | }); |
| 16303 | } |
| 16304 | }); |
| 16305 | return matches; |
| 16306 | }; |
| 16307 | |
| 16308 | /** |
| 16309 | * @name $$testability#findModels |
| 16310 | * |
| 16311 | * @description |
| 16312 | * Returns an array of elements that are two-way found via ng-model to |
| 16313 | * expressions matching the input. |
| 16314 | * |
| 16315 | * @param {Element} element The element root to search from. |
| 16316 | * @param {string} expression The model expression to match. |
| 16317 | * @param {boolean} opt_exactMatch If true, only returns exact matches |
nothing calls this directly
no test coverage detected