forked from angular/router
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some work in the repo to prepare the way for exmaples and tests.
- Loading branch information
1 parent
3f054c6
commit d60be29
Showing
70 changed files
with
17,112 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"directory" : "bower_components" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
node_modules | ||
bower_components | ||
compiled | ||
dist | ||
sauce_connect.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
language: node_js | ||
|
||
node_js: | ||
- 0.10 | ||
|
||
env: | ||
global: | ||
- BROWSER_PROVIDER_READY_FILE=/tmp/sauce-connect-ready | ||
- LOGS_DIR=/tmp/angular-router-build/logs | ||
- SAUCE_USERNAME=angular-ci | ||
- SAUCE_ACCESS_KEY=9b988f434ff8-fbca-8aa4-4ae3-35442987 | ||
|
||
install: | ||
- mkdir -p $LOGS_DIR | ||
- ./scripts/sauce_connect_setup.sh | ||
- npm install | ||
- npm install -g gulp | ||
- npm install -g karma-cli | ||
- ./scripts/wait_for_browser_provider.sh | ||
|
||
script: | ||
- gulp build | ||
- gulp templates | ||
- karma start --single-run --browsers SL_Chrome --reporters dots | ||
- ./scripts/run_protractor_tests.sh | ||
|
||
after_script: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "router", | ||
"version": "0.0.0", | ||
"homepage": "https://github.com/eisenbergeffect/router", | ||
"authors": [ | ||
"Rob Eisenberg <[email protected]>" | ||
], | ||
"moduleType": [ | ||
"es6" | ||
], | ||
"license": "MIT", | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"app/bower_components", | ||
"test", | ||
"tests" | ||
], | ||
"dependencies": { | ||
"polymer": "Polymer/polymer#~0.2.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Instructions: | ||
1) Apply selenium_shadow_dom.patch to selenium. | ||
|
||
$ cd <selenium_dir> | ||
$ git apply <path_to_templating/chromedriver>/selenium_shadow_dom.patch | ||
$ ./go //javascript/chrome-driver:atoms | ||
|
||
2) Copy the output to chromedriver. | ||
|
||
$ cp build/javascript/chrome-driver/atoms.* \ | ||
<chromium_dir>/src/third_party/webdriver/ | ||
|
||
3) Apply the chromedriver_shadow_dom.patch to chromedriver. | ||
|
||
$ cd <chromium_dir> | ||
$ git apply <README_dir>/chromedriver_shadow_dom.patch | ||
|
||
4) Build chromedriver. | ||
|
||
$ ninja -C out/Release chromedriver | ||
|
||
5) Copy the new version of chromedriver to this directory | ||
|
||
$ cp <chromium dir>/src/out/Release/chromedriver <path_to_templating/chromedriver>/ |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
From 29859b18c82760e13304ab8d74fee5ac1a0eda73 Mon Sep 17 00:00:00 2001 | ||
From: Vojta Jina <[email protected]> | ||
Date: Tue, 22 Apr 2014 17:01:38 -0700 | ||
Subject: [PATCH] Allow shadom DOM, using both prefixed and unprefixed | ||
|
||
--- | ||
chrome/test/chromedriver/js/call_function.js | 77 +++++++++++++++++++++------- | ||
chrome/test/chromedriver/js/focus.js | 15 +++++- | ||
2 files changed, 72 insertions(+), 20 deletions(-) | ||
|
||
diff --git a/chrome/test/chromedriver/js/call_function.js b/chrome/test/chromedriver/js/call_function.js | ||
index f31f95f..aa2ef93 100644 | ||
--- a/chrome/test/chromedriver/js/call_function.js | ||
+++ b/chrome/test/chromedriver/js/call_function.js | ||
@@ -32,7 +32,18 @@ var ELEMENT_KEY = 'ELEMENT'; | ||
* @const | ||
* @type {boolean} | ||
*/ | ||
-var SHADOW_DOM_ENABLED = typeof ShadowRoot === 'function'; | ||
+var SHADOW_DOM_ENABLED = false; | ||
+var ShadowRootCls = null; | ||
+var SHADOW_ROOT_PROPERTY = null; | ||
+if (typeof ShadowRoot === 'function') { | ||
+ ShadowRootCls = ShadowRoot; | ||
+ SHADOW_ROOT_PROPERTY = 'shadowRoot'; | ||
+ SHADOW_DOM_ENABLED = true; | ||
+} else if (typeof WebKitShadowRoot === 'function') { | ||
+ ShadowRootCls = WebKitShadowRoot; | ||
+ SHADOW_ROOT_PROPERTY = 'webkitShadowRoot'; | ||
+ SHADOW_DOM_ENABLED = true; | ||
+} | ||
|
||
/** | ||
* A cache which maps IDs <-> cached objects for the purpose of identifying | ||
@@ -97,12 +108,44 @@ Cache.prototype = { | ||
* @return {boolean} If the nodes is reachable. | ||
*/ | ||
isNodeReachable_: function(node) { | ||
- var nodeRoot = getNodeRoot(node); | ||
- if (nodeRoot == document) | ||
- return true; | ||
- else if (SHADOW_DOM_ENABLED && nodeRoot instanceof ShadowRoot) | ||
+ while (node) { | ||
+ if (node == document) | ||
+ return true; | ||
+ | ||
+ // WC3 spec states "The parentNode and parentElement attributes of the | ||
+ // shadow root object must always return null." Use alternate approach to | ||
+ // determine if it is reachable. | ||
+ if (SHADOW_DOM_ENABLED && node instanceof ShadowRootCls) | ||
+ return this.isShadowRootReachable_(node); | ||
+ | ||
+ node = node.parentNode; | ||
+ } | ||
+ return false; | ||
+ }, | ||
+ | ||
+ /** | ||
+ * @private | ||
+ * @param {!WebKitShadowRoot} shadow_root | ||
+ * @param {Node} [node=document] | ||
+ */ | ||
+ isShadowRootReachable_: function(shadow_root, node) { | ||
+ if (node == null) | ||
+ node = document; | ||
+ | ||
+ if (node == shadow_root) { | ||
return true; | ||
+ } | ||
|
||
+ if (node[SHADOW_ROOT_PROPERTY] | ||
+ && this.isShadowRootReachable_(shadow_root, node[SHADOW_ROOT_PROPERTY])) { | ||
+ return true; | ||
+ } | ||
+ var children = node.childNodes; | ||
+ for (var i = 0; i < children.length; i++) { | ||
+ var child = children[i]; | ||
+ if (this.isShadowRootReachable_(shadow_root, child)) | ||
+ return true; | ||
+ } | ||
return false; | ||
} | ||
}; | ||
@@ -144,11 +187,9 @@ function getPageCache(opt_doc) { | ||
function wrap(value) { | ||
if (typeof(value) == 'object' && value != null) { | ||
var nodeType = value['nodeType']; | ||
- if (nodeType == NodeType.ELEMENT || nodeType == NodeType.DOCUMENT | ||
- || (SHADOW_DOM_ENABLED && value instanceof ShadowRoot)) { | ||
+ if (nodeType == NodeType.ELEMENT || nodeType == NodeType.DOCUMENT) { | ||
var wrapped = {}; | ||
- var root = getNodeRoot(value); | ||
- wrapped[ELEMENT_KEY] = getPageCache(root).storeItem(value); | ||
+ wrapped[ELEMENT_KEY] = getPageCache(value.ownerDocument).storeItem(value); | ||
return wrapped; | ||
} | ||
|
||
@@ -204,15 +245,15 @@ function unwrap(value, cache) { | ||
function callFunction(shadowHostIds, func, args, opt_unwrappedReturn) { | ||
var cache = getPageCache(); | ||
cache.clearStale(); | ||
- if (shadowHostIds && SHADOW_DOM_ENABLED) { | ||
- for (var i = 0; i < shadowHostIds.length; i++) { | ||
- var host = cache.retrieveItem(shadowHostIds[i]); | ||
- // TODO(zachconrad): Use the olderShadowRoot API when available to check | ||
- // all of the shadow roots. | ||
- cache = getPageCache(host.webkitShadowRoot); | ||
- cache.clearStale(); | ||
- } | ||
- } | ||
+// if (shadowHostIds && SHADOW_DOM_ENABLED) { | ||
+// for (var i = 0; i < shadowHostIds.length; i++) { | ||
+// var host = cache.retrieveItem(shadowHostIds[i]); | ||
+// // TODO(zachconrad): Use the olderShadowRoot API when available to check | ||
+// // all of the shadow roots. | ||
+// cache = getPageCache(host.webkitShadowRoot); | ||
+// cache.clearStale(); | ||
+// } | ||
+// } | ||
|
||
if (opt_unwrappedReturn) | ||
return func.apply(null, unwrap(args, cache)); | ||
diff --git a/chrome/test/chromedriver/js/focus.js b/chrome/test/chromedriver/js/focus.js | ||
index 2945a34..0243d80 100644 | ||
--- a/chrome/test/chromedriver/js/focus.js | ||
+++ b/chrome/test/chromedriver/js/focus.js | ||
@@ -24,7 +24,7 @@ function focus(element) { | ||
// input, which still have setSelectionRange defined. For chrome 29+, V8 | ||
// throws a DOMException with code InvalidStateError. | ||
var doc = element.ownerDocument || element; | ||
- var prevActiveElement = doc.activeElement; | ||
+ var prevActiveElement = getActiveElement(doc); | ||
if (element != prevActiveElement && prevActiveElement) | ||
prevActiveElement.blur(); | ||
element.focus(); | ||
@@ -38,6 +38,17 @@ function focus(element) { | ||
throw error; | ||
} | ||
} | ||
- if (element != doc.activeElement) | ||
+ if (element != getActiveElement(doc)) | ||
throw new Error('cannot focus element'); | ||
} | ||
+ | ||
+function getActiveElement(doc) { | ||
+ var activeElement = doc.activeElement; | ||
+ var shadowRootProperty = activeElement.hasOwnProperty('shadowRoot') ? 'shadowRoot' : 'webkitShadowRoot'; | ||
+ | ||
+ while (activeElement[shadowRootProperty] | ||
+ && activeElement[shadowRootProperty].activeElement) { | ||
+ activeElement = activeElement[shadowRootProperty].activeElement; | ||
+ } | ||
+ return activeElement; | ||
+} | ||
-- | ||
1.9.0 | ||
|
Oops, something went wrong.