angular_webdriver 0.0.7 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.gitmodules +3 -0
- data/.rspec +2 -0
- data/.travis.yml +32 -0
- data/Gemfile +2 -0
- data/Thorfile +33 -1
- data/angular_webdriver.gemspec +10 -3
- data/docs/overview.md +101 -0
- data/docs/sync.md +53 -0
- data/lib/angular_webdriver/protractor/by.rb +331 -0
- data/lib/angular_webdriver/protractor/by_repeater_inner.rb +106 -0
- data/lib/angular_webdriver/protractor/client_side_scripts.rb +1035 -0
- data/lib/angular_webdriver/protractor/protractor.rb +396 -77
- data/lib/angular_webdriver/protractor/protractor_element.rb +33 -0
- data/lib/angular_webdriver/protractor/rspec_helpers.rb +19 -0
- data/lib/angular_webdriver/protractor/watir_patch.rb +209 -0
- data/lib/angular_webdriver/protractor/webdriver_patch.rb +246 -0
- data/lib/angular_webdriver/version.rb +2 -2
- data/lib/angular_webdriver.rb +14 -1
- data/{LICENSE → license/angular_webdriver/LICENSE.txt} +0 -0
- data/{lib/angular_webdriver → license}/protractor/LICENSE.txt +0 -0
- data/{lib/angular_webdriver/protractor/get_url_trace.rb → notes/bootstrap_notes.md} +13 -0
- data/notes/element_by_id/element_by_id_sync_off.txt +12 -0
- data/notes/element_by_id/element_by_id_sync_on.txt +74 -0
- data/notes/element_chaining_debug.txt +94 -0
- data/notes/evaluate/js_evaluate_sync_on.txt +60 -0
- data/notes/evaluate/ruby_evaluate_sync_on.txt +35 -0
- data/notes/get_title/browser_get_title_sync_off.txt +11 -0
- data/notes/get_title/browser_get_title_sync_on.txt +54 -0
- data/notes/phantomjs.md +23 -0
- data/notes/protractor_cli_bugs.txt +39 -0
- data/notes/protractor_get/protractor_get.rb +102 -0
- data/notes/protractor_get/protractor_get_website_sync_off.txt +11 -0
- data/notes/protractor_get/protractor_get_website_sync_on.txt +86 -0
- data/notes/repeater/findAllRepeaterRows_annotated.txt +150 -0
- data/notes/repeater/findAllRepeaterRows_raw.txt +145 -0
- data/notes/repeater/findRepeaterColumn_annotated.txt +317 -0
- data/notes/repeater/findRepeaterColumn_raw.txt +310 -0
- data/notes/repeater/findRepeaterElement_annotated.txt +152 -0
- data/notes/repeater/findRepeaterElement_raw.txt +146 -0
- data/notes/repeater/findRepeaterRows_annotated.txt +156 -0
- data/notes/repeater/findRepeaterRows_raw.txt +152 -0
- data/notes/sync_after.md +46 -0
- data/notes/sync_notes.md +137 -0
- data/notes/synchronize_spec/status_gettext.txt +121 -0
- data/notes/synchronize_spec/status_gettext_x3.txt +451 -0
- data/notes/synchronize_spec/synchronize_spec.js.txt +74 -0
- data/notes/synchronize_spec/watir_gettext.txt +73 -0
- data/readme.md +52 -12
- data/release_notes.md +127 -0
- data/selenium_server/lib/logs.rb +50 -0
- data/selenium_server/lib/selenium_server.rb +21 -0
- data/selenium_server/readme.md +3 -0
- data/selenium_server/spec/logs_spec.rb +18 -0
- data/selenium_server/spec/nodejs_sync_spec_waithttp_annotated.txt +54 -0
- data/selenium_server/spec/nodejs_sync_spec_waithttp_raw.txt +367 -0
- data/selenium_server/spec/nodejs_sync_spec_waithttp_raw_processed.txt +43 -0
- data/selenium_server/spec/ruby_sync_spec_waithttp_annotated.txt +59 -0
- data/selenium_server/spec/ruby_sync_spec_waithttp_raw.txt +267 -0
- data/selenium_server/spec/ruby_sync_spec_waithttp_raw_processed.txt +39 -0
- data/selenium_server/spec/spec_helper.rb +6 -0
- data/selenium_server/spec/status_gettext_x3.txt +429 -0
- data/selenium_server/spec/status_gettext_x3_annotated.txt +86 -0
- metadata +91 -18
- data/lib/angular_webdriver/protractor/clientSideScripts.json +0 -19
- data/lib/angular_webdriver/protractor/clientsidescripts.js +0 -671
- data/lib/angular_webdriver/protractor/scripts.rb +0 -7
- data/lib/angular_webdriver/protractor/scripts_to_json.js +0 -11
- data/spec/protractor_spec.rb +0 -40
- data/spec/spec_helper.rb +0 -5
@@ -1,19 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"waitForAngular": "try { return (function (rootSelector, callback) {\n var el = document.querySelector(rootSelector);\n\n try {\n if (!window.angular) {\n throw new Error('angular could not be found on the window');\n }\n if (angular.getTestability) {\n angular.getTestability(el).whenStable(callback);\n } else {\n if (!angular.element(el).injector()) {\n throw new Error('root element (' + rootSelector + ') has no injector.' +\n ' this may mean it is not inside ng-app.');\n }\n angular.element(el).injector().get('$browser').\n notifyWhenNoOutstandingRequests(callback);\n }\n } catch (err) {\n callback(err.message);\n }\n}).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }",
|
3
|
-
"findBindings": "try { return (function (binding, exactMatch, using, rootSelector) {\n var root = document.querySelector(rootSelector || 'body');\n using = using || document;\n if (angular.getTestability) {\n return angular.getTestability(root).\n findBindings(using, binding, exactMatch);\n }\n var bindings = using.getElementsByClassName('ng-binding');\n var matches = [];\n for (var i = 0; i < bindings.length; ++i) {\n var dataBinding = angular.element(bindings[i]).data('$binding');\n if (dataBinding) {\n var bindingName = dataBinding.exp || dataBinding[0].exp || dataBinding;\n if (exactMatch) {\n var matcher = new RegExp('({|\\\\s|^|\\\\|)' + binding + '(}|\\\\s|$|\\\\|)');\n if (matcher.test(bindingName)) {\n matches.push(bindings[i]);\n }\n } else {\n if (bindingName.indexOf(binding) != -1) {\n matches.push(bindings[i]);\n }\n }\n\n }\n }\n return matches; /* Return the whole array for webdriver.findElements. */\n}).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }",
|
4
|
-
"findRepeaterRows": "try { return (function (repeater, exact, index, using) {\n function repeaterMatch(ngRepeat, repeater, exact) {\n if (exact) {\n return ngRepeat.split(' track by ')[0].split(' as ')[0].split('|')[0].\n trim() == repeater;\n } else {\n return ngRepeat.indexOf(repeater) != -1;\n }\n }\n\n using = using || document;\n\n var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\\\:'];\n var rows = [];\n for (var p = 0; p < prefixes.length; ++p) {\n var attr = prefixes[p] + 'repeat';\n var repeatElems = using.querySelectorAll('[' + attr + ']');\n attr = attr.replace(/\\\\/g, '');\n for (var i = 0; i < repeatElems.length; ++i) {\n if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {\n rows.push(repeatElems[i]);\n }\n }\n }\n /* multiRows is an array of arrays, where each inner array contains\n one row of elements. */\n var multiRows = [];\n for (var p = 0; p < prefixes.length; ++p) {\n var attr = prefixes[p] + 'repeat-start';\n var repeatElems = using.querySelectorAll('[' + attr + ']');\n attr = attr.replace(/\\\\/g, '');\n for (var i = 0; i < repeatElems.length; ++i) {\n if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {\n var elem = repeatElems[i];\n var row = [];\n while (elem.nodeType != 8 ||\n !repeaterMatch(elem.nodeValue, repeater, exact)) {\n if (elem.nodeType == 1) {\n row.push(elem);\n }\n elem = elem.nextSibling;\n }\n multiRows.push(row);\n }\n }\n }\n var row = rows[index] || [], multiRow = multiRows[index] || [];\n return [].concat(row, multiRow);\n }).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }",
|
5
|
-
"findAllRepeaterRows": "try { return (function (repeater, exact, using) {\n function repeaterMatch(ngRepeat, repeater, exact) {\n if (exact) {\n return ngRepeat.split(' track by ')[0].split(' as ')[0].split('|')[0].\n trim() == repeater;\n } else {\n return ngRepeat.indexOf(repeater) != -1;\n }\n }\n\n using = using || document;\n\n var rows = [];\n var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\\\:'];\n for (var p = 0; p < prefixes.length; ++p) {\n var attr = prefixes[p] + 'repeat';\n var repeatElems = using.querySelectorAll('[' + attr + ']');\n attr = attr.replace(/\\\\/g, '');\n for (var i = 0; i < repeatElems.length; ++i) {\n if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {\n rows.push(repeatElems[i]);\n }\n }\n }\n for (var p = 0; p < prefixes.length; ++p) {\n var attr = prefixes[p] + 'repeat-start';\n var repeatElems = using.querySelectorAll('[' + attr + ']');\n attr = attr.replace(/\\\\/g, '');\n for (var i = 0; i < repeatElems.length; ++i) {\n if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {\n var elem = repeatElems[i];\n while (elem.nodeType != 8 ||\n !repeaterMatch(elem.nodeValue, repeater, exact)) {\n if (elem.nodeType == 1) {\n rows.push(elem);\n }\n elem = elem.nextSibling;\n }\n }\n }\n }\n return rows;\n }).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }",
|
6
|
-
"findRepeaterElement": "try { return (function (repeater, exact, index, binding, using, rootSelector) {\n function repeaterMatch(ngRepeat, repeater, exact) {\n if (exact) {\n return ngRepeat.split(' track by ')[0].split(' as ')[0].split('|')[0].\n trim() == repeater;\n } else {\n return ngRepeat.indexOf(repeater) != -1;\n }\n }\n\n var matches = [];\n var root = document.querySelector(rootSelector || 'body');\n using = using || document;\n\n var rows = [];\n var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\\\:'];\n for (var p = 0; p < prefixes.length; ++p) {\n var attr = prefixes[p] + 'repeat';\n var repeatElems = using.querySelectorAll('[' + attr + ']');\n attr = attr.replace(/\\\\/g, '');\n for (var i = 0; i < repeatElems.length; ++i) {\n if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {\n rows.push(repeatElems[i]);\n }\n }\n }\n /* multiRows is an array of arrays, where each inner array contains\n one row of elements. */\n var multiRows = [];\n for (var p = 0; p < prefixes.length; ++p) {\n var attr = prefixes[p] + 'repeat-start';\n var repeatElems = using.querySelectorAll('[' + attr + ']');\n attr = attr.replace(/\\\\/g, '');\n for (var i = 0; i < repeatElems.length; ++i) {\n if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {\n var elem = repeatElems[i];\n var row = [];\n while (elem.nodeType != 8 || (elem.nodeValue &&\n !repeaterMatch(elem.nodeValue, repeater, exact))) {\n if (elem.nodeType == 1) {\n row.push(elem);\n }\n elem = elem.nextSibling;\n }\n multiRows.push(row);\n }\n }\n }\n var row = rows[index];\n var multiRow = multiRows[index];\n var bindings = [];\n if (row) {\n if (angular.getTestability) {\n matches.push.apply(\n matches,\n angular.getTestability(root).findBindings(row, binding));\n } else {\n if (row.className.indexOf('ng-binding') != -1) {\n bindings.push(row);\n }\n var childBindings = row.getElementsByClassName('ng-binding');\n for (var i = 0; i < childBindings.length; ++i) {\n bindings.push(childBindings[i]);\n }\n }\n }\n if (multiRow) {\n for (var i = 0; i < multiRow.length; ++i) {\n var rowElem = multiRow[i];\n if (angular.getTestability) {\n matches.push.apply(\n matches,\n angular.getTestability(root).findBindings(rowElem, binding));\n } else {\n if (rowElem.className.indexOf('ng-binding') != -1) {\n bindings.push(rowElem);\n }\n var childBindings = rowElem.getElementsByClassName('ng-binding');\n for (var j = 0; j < childBindings.length; ++j) {\n bindings.push(childBindings[j]);\n }\n }\n }\n }\n for (var i = 0; i < bindings.length; ++i) {\n var dataBinding = angular.element(bindings[i]).data('$binding');\n if (dataBinding) {\n var bindingName = dataBinding.exp || dataBinding[0].exp || dataBinding;\n if (bindingName.indexOf(binding) != -1) {\n matches.push(bindings[i]);\n }\n }\n }\n return matches;\n}).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }",
|
7
|
-
"findRepeaterColumn": "try { return (function (repeater, exact, binding, using, rootSelector) {\n function repeaterMatch(ngRepeat, repeater, exact) {\n if (exact) {\n return ngRepeat.split(' track by ')[0].split(' as ')[0].split('|')[0].\n trim() == repeater;\n } else {\n return ngRepeat.indexOf(repeater) != -1;\n }\n }\n\n var matches = [];\n var root = document.querySelector(rootSelector || 'body');\n using = using || document;\n\n var rows = [];\n var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\\\:'];\n for (var p = 0; p < prefixes.length; ++p) {\n var attr = prefixes[p] + 'repeat';\n var repeatElems = using.querySelectorAll('[' + attr + ']');\n attr = attr.replace(/\\\\/g, '');\n for (var i = 0; i < repeatElems.length; ++i) {\n if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {\n rows.push(repeatElems[i]);\n }\n }\n }\n /* multiRows is an array of arrays, where each inner array contains\n one row of elements. */\n var multiRows = [];\n for (var p = 0; p < prefixes.length; ++p) {\n var attr = prefixes[p] + 'repeat-start';\n var repeatElems = using.querySelectorAll('[' + attr + ']');\n attr = attr.replace(/\\\\/g, '');\n for (var i = 0; i < repeatElems.length; ++i) {\n if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {\n var elem = repeatElems[i];\n var row = [];\n while (elem.nodeType != 8 || (elem.nodeValue &&\n !repeaterMatch(elem.nodeValue, repeater, exact))) {\n if (elem.nodeType == 1) {\n row.push(elem);\n }\n elem = elem.nextSibling;\n }\n multiRows.push(row);\n }\n }\n }\n var bindings = [];\n for (var i = 0; i < rows.length; ++i) {\n if (angular.getTestability) {\n matches.push.apply(\n matches,\n angular.getTestability(root).findBindings(rows[i], binding));\n } else {\n if (rows[i].className.indexOf('ng-binding') != -1) {\n bindings.push(rows[i]);\n }\n var childBindings = rows[i].getElementsByClassName('ng-binding');\n for (var k = 0; k < childBindings.length; ++k) {\n bindings.push(childBindings[k]);\n }\n }\n }\n for (var i = 0; i < multiRows.length; ++i) {\n for (var j = 0; j < multiRows[i].length; ++j) {\n if (angular.getTestability) {\n matches.push.apply(\n matches,\n angular.getTestability(root).findBindings(multiRows[i][j], binding));\n } else {\n var elem = multiRows[i][j];\n if (elem.className.indexOf('ng-binding') != -1) {\n bindings.push(elem);\n }\n var childBindings = elem.getElementsByClassName('ng-binding');\n for (var k = 0; k < childBindings.length; ++k) {\n bindings.push(childBindings[k]);\n }\n }\n }\n }\n for (var j = 0; j < bindings.length; ++j) {\n var dataBinding = angular.element(bindings[j]).data('$binding');\n if (dataBinding) {\n var bindingName = dataBinding.exp || dataBinding[0].exp || dataBinding;\n if (bindingName.indexOf(binding) != -1) {\n matches.push(bindings[j]);\n }\n }\n }\n return matches;\n}).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }",
|
8
|
-
"findByModel": "try { return (function (model, using, rootSelector) {\n var root = document.querySelector(rootSelector || 'body');\n using = using || document;\n\n if (angular.getTestability) {\n return angular.getTestability(root).\n findModels(using, model, true);\n }\n var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\\\:'];\n for (var p = 0; p < prefixes.length; ++p) {\n var selector = '[' + prefixes[p] + 'model=\"' + model + '\"]';\n var elements = using.querySelectorAll(selector);\n if (elements.length) {\n return elements;\n }\n }\n}).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }",
|
9
|
-
"findByOptions": "try { return (function (optionsDescriptor, using) {\n using = using || document;\n\n var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\\\:'];\n for (var p = 0; p < prefixes.length; ++p) {\n var selector = '[' + prefixes[p] + 'options=\"' + optionsDescriptor + '\"] option';\n var elements = using.querySelectorAll(selector);\n if (elements.length) {\n return elements;\n }\n }\n}).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }",
|
10
|
-
"findByButtonText": "try { return (function (searchText, using) {\n using = using || document;\n\n var elements = using.querySelectorAll('button, input[type=\"button\"], input[type=\"submit\"]');\n var matches = [];\n for (var i = 0; i < elements.length; ++i) {\n var element = elements[i];\n var elementText;\n if (element.tagName.toLowerCase() == 'button') {\n elementText = element.textContent || element.innerText || '';\n } else {\n elementText = element.value;\n }\n if (elementText.trim() === searchText) {\n matches.push(element);\n }\n }\n\n return matches;\n}).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }",
|
11
|
-
"findByPartialButtonText": "try { return (function (searchText, using) {\n using = using || document;\n\n var elements = using.querySelectorAll('button, input[type=\"button\"], input[type=\"submit\"]');\n var matches = [];\n for (var i = 0; i < elements.length; ++i) {\n var element = elements[i];\n var elementText;\n if (element.tagName.toLowerCase() == 'button') {\n elementText = element.textContent || element.innerText || '';\n } else {\n elementText = element.value;\n }\n if (elementText.indexOf(searchText) > -1) {\n matches.push(element);\n }\n }\n\n return matches;\n}).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }",
|
12
|
-
"findByCssContainingText": "try { return (function (cssSelector, searchText, using) {\n using = using || document;\n\n var elements = using.querySelectorAll(cssSelector);\n var matches = [];\n for (var i = 0; i < elements.length; ++i) {\n var element = elements[i];\n var elementText = element.textContent || element.innerText || '';\n if (elementText.indexOf(searchText) > -1) {\n matches.push(element);\n }\n }\n return matches;\n}).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }",
|
13
|
-
"testForAngular": "try { return (function (attempts, asyncCallback) {\n var callback = function(args) {\n setTimeout(function() {\n asyncCallback(args);\n }, 0);\n };\n var check = function(n) {\n try {\n if (window.angular && window.angular.resumeBootstrap) {\n callback([true, null]);\n } else if (n < 1) {\n if (window.angular) {\n callback([false, 'angular never provided resumeBootstrap']);\n } else {\n callback([false, 'retries looking for angular exceeded']);\n }\n } else {\n window.setTimeout(function() {check(n - 1);}, 1000);\n }\n } catch (e) {\n callback([false, e]);\n }\n };\n check(attempts);\n}).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }",
|
14
|
-
"evaluate": "try { return (function (element, expression) {\n return angular.element(element).scope().$eval(expression);\n}).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }",
|
15
|
-
"allowAnimations": "try { return (function (element, value) {\n var ngElement = angular.element(element);\n if (ngElement.allowAnimations) {\n // AngularDart: $testability API.\n return ngElement.allowAnimations(value);\n } else {\n // AngularJS\n var enabledFn = ngElement.injector().get('$animate').enabled;\n return (value == null) ? enabledFn() : enabledFn(value);\n }\n}).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }",
|
16
|
-
"getLocationAbsUrl": "try { return (function (selector) {\n var el = document.querySelector(selector);\n if (angular.getTestability) {\n return angular.getTestability(el).\n getLocation();\n }\n return angular.element(el).injector().get('$location').absUrl();\n}).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }",
|
17
|
-
"setLocation": "try { return (function (selector, url) {\n var el = document.querySelector(selector);\n if (angular.getTestability) {\n return angular.getTestability(el).\n setLocation(url);\n }\n var $injector = angular.element(el).injector();\n var $location = $injector.get('$location');\n var $rootScope = $injector.get('$rootScope');\n\n if (url !== $location.url()) {\n $location.url(url);\n $rootScope.$digest();\n }\n}).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }",
|
18
|
-
"installInBrowser": "window.clientSideScripts = {waitForAngular: function (rootSelector, callback) {\n var el = document.querySelector(rootSelector);\n\n try {\n if (!window.angular) {\n throw new Error('angular could not be found on the window');\n }\n if (angular.getTestability) {\n angular.getTestability(el).whenStable(callback);\n } else {\n if (!angular.element(el).injector()) {\n throw new Error('root element (' + rootSelector + ') has no injector.' +\n ' this may mean it is not inside ng-app.');\n }\n angular.element(el).injector().get('$browser').\n notifyWhenNoOutstandingRequests(callback);\n }\n } catch (err) {\n callback(err.message);\n }\n}, findBindings: function (binding, exactMatch, using, rootSelector) {\n var root = document.querySelector(rootSelector || 'body');\n using = using || document;\n if (angular.getTestability) {\n return angular.getTestability(root).\n findBindings(using, binding, exactMatch);\n }\n var bindings = using.getElementsByClassName('ng-binding');\n var matches = [];\n for (var i = 0; i < bindings.length; ++i) {\n var dataBinding = angular.element(bindings[i]).data('$binding');\n if (dataBinding) {\n var bindingName = dataBinding.exp || dataBinding[0].exp || dataBinding;\n if (exactMatch) {\n var matcher = new RegExp('({|\\\\s|^|\\\\|)' + binding + '(}|\\\\s|$|\\\\|)');\n if (matcher.test(bindingName)) {\n matches.push(bindings[i]);\n }\n } else {\n if (bindingName.indexOf(binding) != -1) {\n matches.push(bindings[i]);\n }\n }\n\n }\n }\n return matches; /* Return the whole array for webdriver.findElements. */\n}, findRepeaterRows: function (repeater, exact, index, using) {\n function repeaterMatch(ngRepeat, repeater, exact) {\n if (exact) {\n return ngRepeat.split(' track by ')[0].split(' as ')[0].split('|')[0].\n trim() == repeater;\n } else {\n return ngRepeat.indexOf(repeater) != -1;\n }\n }\n\n using = using || document;\n\n var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\\\:'];\n var rows = [];\n for (var p = 0; p < prefixes.length; ++p) {\n var attr = prefixes[p] + 'repeat';\n var repeatElems = using.querySelectorAll('[' + attr + ']');\n attr = attr.replace(/\\\\/g, '');\n for (var i = 0; i < repeatElems.length; ++i) {\n if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {\n rows.push(repeatElems[i]);\n }\n }\n }\n /* multiRows is an array of arrays, where each inner array contains\n one row of elements. */\n var multiRows = [];\n for (var p = 0; p < prefixes.length; ++p) {\n var attr = prefixes[p] + 'repeat-start';\n var repeatElems = using.querySelectorAll('[' + attr + ']');\n attr = attr.replace(/\\\\/g, '');\n for (var i = 0; i < repeatElems.length; ++i) {\n if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {\n var elem = repeatElems[i];\n var row = [];\n while (elem.nodeType != 8 ||\n !repeaterMatch(elem.nodeValue, repeater, exact)) {\n if (elem.nodeType == 1) {\n row.push(elem);\n }\n elem = elem.nextSibling;\n }\n multiRows.push(row);\n }\n }\n }\n var row = rows[index] || [], multiRow = multiRows[index] || [];\n return [].concat(row, multiRow);\n }, findAllRepeaterRows: function (repeater, exact, using) {\n function repeaterMatch(ngRepeat, repeater, exact) {\n if (exact) {\n return ngRepeat.split(' track by ')[0].split(' as ')[0].split('|')[0].\n trim() == repeater;\n } else {\n return ngRepeat.indexOf(repeater) != -1;\n }\n }\n\n using = using || document;\n\n var rows = [];\n var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\\\:'];\n for (var p = 0; p < prefixes.length; ++p) {\n var attr = prefixes[p] + 'repeat';\n var repeatElems = using.querySelectorAll('[' + attr + ']');\n attr = attr.replace(/\\\\/g, '');\n for (var i = 0; i < repeatElems.length; ++i) {\n if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {\n rows.push(repeatElems[i]);\n }\n }\n }\n for (var p = 0; p < prefixes.length; ++p) {\n var attr = prefixes[p] + 'repeat-start';\n var repeatElems = using.querySelectorAll('[' + attr + ']');\n attr = attr.replace(/\\\\/g, '');\n for (var i = 0; i < repeatElems.length; ++i) {\n if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {\n var elem = repeatElems[i];\n while (elem.nodeType != 8 ||\n !repeaterMatch(elem.nodeValue, repeater, exact)) {\n if (elem.nodeType == 1) {\n rows.push(elem);\n }\n elem = elem.nextSibling;\n }\n }\n }\n }\n return rows;\n }, findRepeaterElement: function (repeater, exact, index, binding, using, rootSelector) {\n function repeaterMatch(ngRepeat, repeater, exact) {\n if (exact) {\n return ngRepeat.split(' track by ')[0].split(' as ')[0].split('|')[0].\n trim() == repeater;\n } else {\n return ngRepeat.indexOf(repeater) != -1;\n }\n }\n\n var matches = [];\n var root = document.querySelector(rootSelector || 'body');\n using = using || document;\n\n var rows = [];\n var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\\\:'];\n for (var p = 0; p < prefixes.length; ++p) {\n var attr = prefixes[p] + 'repeat';\n var repeatElems = using.querySelectorAll('[' + attr + ']');\n attr = attr.replace(/\\\\/g, '');\n for (var i = 0; i < repeatElems.length; ++i) {\n if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {\n rows.push(repeatElems[i]);\n }\n }\n }\n /* multiRows is an array of arrays, where each inner array contains\n one row of elements. */\n var multiRows = [];\n for (var p = 0; p < prefixes.length; ++p) {\n var attr = prefixes[p] + 'repeat-start';\n var repeatElems = using.querySelectorAll('[' + attr + ']');\n attr = attr.replace(/\\\\/g, '');\n for (var i = 0; i < repeatElems.length; ++i) {\n if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {\n var elem = repeatElems[i];\n var row = [];\n while (elem.nodeType != 8 || (elem.nodeValue &&\n !repeaterMatch(elem.nodeValue, repeater, exact))) {\n if (elem.nodeType == 1) {\n row.push(elem);\n }\n elem = elem.nextSibling;\n }\n multiRows.push(row);\n }\n }\n }\n var row = rows[index];\n var multiRow = multiRows[index];\n var bindings = [];\n if (row) {\n if (angular.getTestability) {\n matches.push.apply(\n matches,\n angular.getTestability(root).findBindings(row, binding));\n } else {\n if (row.className.indexOf('ng-binding') != -1) {\n bindings.push(row);\n }\n var childBindings = row.getElementsByClassName('ng-binding');\n for (var i = 0; i < childBindings.length; ++i) {\n bindings.push(childBindings[i]);\n }\n }\n }\n if (multiRow) {\n for (var i = 0; i < multiRow.length; ++i) {\n var rowElem = multiRow[i];\n if (angular.getTestability) {\n matches.push.apply(\n matches,\n angular.getTestability(root).findBindings(rowElem, binding));\n } else {\n if (rowElem.className.indexOf('ng-binding') != -1) {\n bindings.push(rowElem);\n }\n var childBindings = rowElem.getElementsByClassName('ng-binding');\n for (var j = 0; j < childBindings.length; ++j) {\n bindings.push(childBindings[j]);\n }\n }\n }\n }\n for (var i = 0; i < bindings.length; ++i) {\n var dataBinding = angular.element(bindings[i]).data('$binding');\n if (dataBinding) {\n var bindingName = dataBinding.exp || dataBinding[0].exp || dataBinding;\n if (bindingName.indexOf(binding) != -1) {\n matches.push(bindings[i]);\n }\n }\n }\n return matches;\n}, findRepeaterColumn: function (repeater, exact, binding, using, rootSelector) {\n function repeaterMatch(ngRepeat, repeater, exact) {\n if (exact) {\n return ngRepeat.split(' track by ')[0].split(' as ')[0].split('|')[0].\n trim() == repeater;\n } else {\n return ngRepeat.indexOf(repeater) != -1;\n }\n }\n\n var matches = [];\n var root = document.querySelector(rootSelector || 'body');\n using = using || document;\n\n var rows = [];\n var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\\\:'];\n for (var p = 0; p < prefixes.length; ++p) {\n var attr = prefixes[p] + 'repeat';\n var repeatElems = using.querySelectorAll('[' + attr + ']');\n attr = attr.replace(/\\\\/g, '');\n for (var i = 0; i < repeatElems.length; ++i) {\n if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {\n rows.push(repeatElems[i]);\n }\n }\n }\n /* multiRows is an array of arrays, where each inner array contains\n one row of elements. */\n var multiRows = [];\n for (var p = 0; p < prefixes.length; ++p) {\n var attr = prefixes[p] + 'repeat-start';\n var repeatElems = using.querySelectorAll('[' + attr + ']');\n attr = attr.replace(/\\\\/g, '');\n for (var i = 0; i < repeatElems.length; ++i) {\n if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {\n var elem = repeatElems[i];\n var row = [];\n while (elem.nodeType != 8 || (elem.nodeValue &&\n !repeaterMatch(elem.nodeValue, repeater, exact))) {\n if (elem.nodeType == 1) {\n row.push(elem);\n }\n elem = elem.nextSibling;\n }\n multiRows.push(row);\n }\n }\n }\n var bindings = [];\n for (var i = 0; i < rows.length; ++i) {\n if (angular.getTestability) {\n matches.push.apply(\n matches,\n angular.getTestability(root).findBindings(rows[i], binding));\n } else {\n if (rows[i].className.indexOf('ng-binding') != -1) {\n bindings.push(rows[i]);\n }\n var childBindings = rows[i].getElementsByClassName('ng-binding');\n for (var k = 0; k < childBindings.length; ++k) {\n bindings.push(childBindings[k]);\n }\n }\n }\n for (var i = 0; i < multiRows.length; ++i) {\n for (var j = 0; j < multiRows[i].length; ++j) {\n if (angular.getTestability) {\n matches.push.apply(\n matches,\n angular.getTestability(root).findBindings(multiRows[i][j], binding));\n } else {\n var elem = multiRows[i][j];\n if (elem.className.indexOf('ng-binding') != -1) {\n bindings.push(elem);\n }\n var childBindings = elem.getElementsByClassName('ng-binding');\n for (var k = 0; k < childBindings.length; ++k) {\n bindings.push(childBindings[k]);\n }\n }\n }\n }\n for (var j = 0; j < bindings.length; ++j) {\n var dataBinding = angular.element(bindings[j]).data('$binding');\n if (dataBinding) {\n var bindingName = dataBinding.exp || dataBinding[0].exp || dataBinding;\n if (bindingName.indexOf(binding) != -1) {\n matches.push(bindings[j]);\n }\n }\n }\n return matches;\n}, findByModel: function (model, using, rootSelector) {\n var root = document.querySelector(rootSelector || 'body');\n using = using || document;\n\n if (angular.getTestability) {\n return angular.getTestability(root).\n findModels(using, model, true);\n }\n var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\\\:'];\n for (var p = 0; p < prefixes.length; ++p) {\n var selector = '[' + prefixes[p] + 'model=\"' + model + '\"]';\n var elements = using.querySelectorAll(selector);\n if (elements.length) {\n return elements;\n }\n }\n}, findByOptions: function (optionsDescriptor, using) {\n using = using || document;\n\n var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\\\:'];\n for (var p = 0; p < prefixes.length; ++p) {\n var selector = '[' + prefixes[p] + 'options=\"' + optionsDescriptor + '\"] option';\n var elements = using.querySelectorAll(selector);\n if (elements.length) {\n return elements;\n }\n }\n}, findByButtonText: function (searchText, using) {\n using = using || document;\n\n var elements = using.querySelectorAll('button, input[type=\"button\"], input[type=\"submit\"]');\n var matches = [];\n for (var i = 0; i < elements.length; ++i) {\n var element = elements[i];\n var elementText;\n if (element.tagName.toLowerCase() == 'button') {\n elementText = element.textContent || element.innerText || '';\n } else {\n elementText = element.value;\n }\n if (elementText.trim() === searchText) {\n matches.push(element);\n }\n }\n\n return matches;\n}, findByPartialButtonText: function (searchText, using) {\n using = using || document;\n\n var elements = using.querySelectorAll('button, input[type=\"button\"], input[type=\"submit\"]');\n var matches = [];\n for (var i = 0; i < elements.length; ++i) {\n var element = elements[i];\n var elementText;\n if (element.tagName.toLowerCase() == 'button') {\n elementText = element.textContent || element.innerText || '';\n } else {\n elementText = element.value;\n }\n if (elementText.indexOf(searchText) > -1) {\n matches.push(element);\n }\n }\n\n return matches;\n}, findByCssContainingText: function (cssSelector, searchText, using) {\n using = using || document;\n\n var elements = using.querySelectorAll(cssSelector);\n var matches = [];\n for (var i = 0; i < elements.length; ++i) {\n var element = elements[i];\n var elementText = element.textContent || element.innerText || '';\n if (elementText.indexOf(searchText) > -1) {\n matches.push(element);\n }\n }\n return matches;\n}, testForAngular: function (attempts, asyncCallback) {\n var callback = function(args) {\n setTimeout(function() {\n asyncCallback(args);\n }, 0);\n };\n var check = function(n) {\n try {\n if (window.angular && window.angular.resumeBootstrap) {\n callback([true, null]);\n } else if (n < 1) {\n if (window.angular) {\n callback([false, 'angular never provided resumeBootstrap']);\n } else {\n callback([false, 'retries looking for angular exceeded']);\n }\n } else {\n window.setTimeout(function() {check(n - 1);}, 1000);\n }\n } catch (e) {\n callback([false, e]);\n }\n };\n check(attempts);\n}, evaluate: function (element, expression) {\n return angular.element(element).scope().$eval(expression);\n}, allowAnimations: function (element, value) {\n var ngElement = angular.element(element);\n if (ngElement.allowAnimations) {\n // AngularDart: $testability API.\n return ngElement.allowAnimations(value);\n } else {\n // AngularJS\n var enabledFn = ngElement.injector().get('$animate').enabled;\n return (value == null) ? enabledFn() : enabledFn(value);\n }\n}, getLocationAbsUrl: function (selector) {\n var el = document.querySelector(selector);\n if (angular.getTestability) {\n return angular.getTestability(el).\n getLocation();\n }\n return angular.element(el).injector().get('$location').absUrl();\n}, setLocation: function (selector, url) {\n var el = document.querySelector(selector);\n if (angular.getTestability) {\n return angular.getTestability(el).\n setLocation(url);\n }\n var $injector = angular.element(el).injector();\n var $location = $injector.get('$location');\n var $rootScope = $injector.get('$rootScope');\n\n if (url !== $location.url()) {\n $location.url(url);\n $rootScope.$digest();\n }\n}};"
|
19
|
-
}
|