diff --git a/tests/CustomElements/html/imports.html b/tests/CustomElements/html/imports.html index aa7595a..77946f4 100644 --- a/tests/CustomElements/html/imports.html +++ b/tests/CustomElements/html/imports.html @@ -11,6 +11,14 @@ Custom Elements: imports integration + @@ -44,7 +53,6 @@ })(); test('CustomElements upgrade from HTML Imports', function() { chai.assert.equal(2, elementsCreated, 'HTML hook allows main document and import document to upgrade'); - done(); }) diff --git a/tests/CustomElements/runner.html b/tests/CustomElements/runner.html index 290751e..e6beaaf 100644 --- a/tests/CustomElements/runner.html +++ b/tests/CustomElements/runner.html @@ -11,7 +11,6 @@ CustomElements Tests - diff --git a/tests/ShadowCSS/html/before-content.html b/tests/ShadowCSS/html/before-content.html index 7c32c12..f536bbc 100644 --- a/tests/ShadowCSS/html/before-content.html +++ b/tests/ShadowCSS/html/before-content.html @@ -11,8 +11,7 @@ content in :before pseudo-class - - + @@ -52,7 +51,7 @@ - + @@ -175,7 +174,7 @@ diff --git a/tests/ShadowCSS/html/combinators-shadow.html b/tests/ShadowCSS/html/combinators-shadow.html index ffdea38..5642e85 100644 --- a/tests/ShadowCSS/html/combinators-shadow.html +++ b/tests/ShadowCSS/html/combinators-shadow.html @@ -12,8 +12,7 @@ Using combinators styling - - + @@ -76,7 +75,7 @@ diff --git a/tests/ShadowCSS/html/combinators.html b/tests/ShadowCSS/html/combinators.html index 40a2817..6357ebe 100644 --- a/tests/ShadowCSS/html/combinators.html +++ b/tests/ShadowCSS/html/combinators.html @@ -12,8 +12,7 @@ Using combinators styling - - + @@ -71,7 +70,7 @@ diff --git a/tests/ShadowCSS/html/compressed.html b/tests/ShadowCSS/html/compressed.html index 60e4e05..d05259e 100644 --- a/tests/ShadowCSS/html/compressed.html +++ b/tests/ShadowCSS/html/compressed.html @@ -12,8 +12,7 @@ Using compressed stylesheet - - + @@ -35,11 +34,10 @@ diff --git a/tests/ShadowCSS/html/css-animation.html b/tests/ShadowCSS/html/css-animation.html index 93000df..016f1ca 100644 --- a/tests/ShadowCSS/html/css-animation.html +++ b/tests/ShadowCSS/html/css-animation.html @@ -11,8 +11,7 @@ polyfill rule - - + @@ -61,7 +60,7 @@ - + @@ -96,7 +95,7 @@ XBar = register('x-bar', 'x-foo', HTMLElement.prototype); XAuto = register('x-auto', '', HTMLElement.prototype); - document.addEventListener('WebComponentsReady', function() { + test('polyfill directive', function(done) { setTimeout(function() { // x-foo var n = document.querySelector('x-foo'); diff --git a/tests/ShadowCSS/html/polyfill-rule.html b/tests/ShadowCSS/html/polyfill-rule.html index 4ef504a..a111d64 100644 --- a/tests/ShadowCSS/html/polyfill-rule.html +++ b/tests/ShadowCSS/html/polyfill-rule.html @@ -11,8 +11,7 @@ polyfill rule - - + @@ -55,7 +54,7 @@ diff --git a/tests/ShadowCSS/html/pseudo-scoping-strict.html b/tests/ShadowCSS/html/pseudo-scoping-strict.html index 2209ae7..5503e8c 100644 --- a/tests/ShadowCSS/html/pseudo-scoping-strict.html +++ b/tests/ShadowCSS/html/pseudo-scoping-strict.html @@ -11,8 +11,7 @@ Psuedo scoped styling - - + @@ -85,7 +84,7 @@ register('x-foo', '', HTMLElement.prototype); register('x-button', 'button', HTMLButtonElement.prototype, ['x-button']); - document.addEventListener('WebComponentsReady', function() { + test('Psuedo scoped styling strict', function(done) { setTimeout(function() { var foo = document.querySelector('x-foo'); var fooDiv = foo.shadowRoot.querySelector('div'); diff --git a/tests/ShadowCSS/html/pseudo-scoping.html b/tests/ShadowCSS/html/pseudo-scoping.html index 3561b87..f5ad30b 100644 --- a/tests/ShadowCSS/html/pseudo-scoping.html +++ b/tests/ShadowCSS/html/pseudo-scoping.html @@ -11,8 +11,7 @@ Psuedo scoped styling - - + @@ -74,7 +73,7 @@ register('x-foo', '', HTMLElement.prototype); register('x-button', 'button', HTMLButtonElement.prototype, ['x-button']); - document.addEventListener('WebComponentsReady', function() { + test('Psuedo scoped styling', function(done) { setTimeout(function() { var foo = document.querySelector('x-foo'); var fooDiv = foo.shadowRoot.querySelector('div'); diff --git a/tests/ShadowCSS/html/style-import-base-tag.html b/tests/ShadowCSS/html/style-import-base-tag.html index edc62d7..581e0fd 100644 --- a/tests/ShadowCSS/html/style-import-base-tag.html +++ b/tests/ShadowCSS/html/style-import-base-tag.html @@ -18,8 +18,7 @@ var wcjs = location.href.match(/^.*webcomponentsjs\//); base.href = wcjs ? wcjs[0] : '/'; - - + @@ -28,7 +27,7 @@
red
- + @@ -22,7 +21,7 @@
blue
diff --git a/tests/ShadowCSS/runner.html b/tests/ShadowCSS/runner.html index 835fd86..7007a94 100644 --- a/tests/ShadowCSS/runner.html +++ b/tests/ShadowCSS/runner.html @@ -11,24 +11,25 @@ ShadowCSS Tests - - - - - - - - - -
+ - - - - diff --git a/tests/ShadowCSS/tests.js b/tests/ShadowCSS/tests.js index be7a483..1f00113 100644 --- a/tests/ShadowCSS/tests.js +++ b/tests/ShadowCSS/tests.js @@ -9,22 +9,4 @@ */ htmlSuite('ShadowCss', function() { - htmlTest('html/pseudo-scoping.html'); - htmlTest('html/pseudo-scoping.html?wc-shadow'); - htmlTest('html/pseudo-scoping-strict.html'); - htmlTest('html/pseudo-scoping-strict.html?wc-shadow'); - htmlTest('html/polyfill-directive.html'); - htmlTest('html/polyfill-rule.html'); - htmlTest('html/colon-host.html'); - htmlTest('html/colon-host.html?wc-shadow'); - htmlTest('html/combinators.html?wc-shadow'); - htmlTest('html/combinators-shadow.html'); - htmlTest('html/combinators-shadow.html?wc-shadow'); - htmlTest('html/compressed.html'); - htmlTest('html/before-content.html'); - htmlTest('html/before-content.html?wc-shadow'); - htmlTest('html/before-content.html'); - htmlTest('html/style-import.html'); - htmlTest('html/style-import-base-tag.html'); - htmlTest('html/css-animation.html'); }); diff --git a/tests/ShadowDOM/html/document-body-inner-html.html b/tests/ShadowDOM/html/document-body-inner-html.html index 5f9b510..7e74b2c 100644 --- a/tests/ShadowDOM/html/document-body-inner-html.html +++ b/tests/ShadowDOM/html/document-body-inner-html.html @@ -8,8 +8,7 @@ Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> - - + diff --git a/tests/ShadowDOM/html/document-body-shadow-root.html b/tests/ShadowDOM/html/document-body-shadow-root.html index 8033278..d6b30bf 100644 --- a/tests/ShadowDOM/html/document-body-shadow-root.html +++ b/tests/ShadowDOM/html/document-body-shadow-root.html @@ -8,8 +8,7 @@ Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> - - + diff --git a/tests/ShadowDOM/html/document-write.html b/tests/ShadowDOM/html/document-write.html index 19189db..cb5445c 100644 --- a/tests/ShadowDOM/html/document-write.html +++ b/tests/ShadowDOM/html/document-write.html @@ -8,8 +8,7 @@ Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> - - + diff --git a/tests/ShadowDOM/html/head-then-body.html b/tests/ShadowDOM/html/head-then-body.html index fb7287c..85ccb52 100644 --- a/tests/ShadowDOM/html/head-then-body.html +++ b/tests/ShadowDOM/html/head-then-body.html @@ -8,9 +8,7 @@ Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> - - - + diff --git a/tests/ShadowDOM/html/on-load-test.html b/tests/ShadowDOM/html/on-load-test.html index 837ddaa..9c33180 100644 --- a/tests/ShadowDOM/html/on-load-test.html +++ b/tests/ShadowDOM/html/on-load-test.html @@ -8,22 +8,29 @@ Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> - - + + diff --git a/tests/ShadowDOM/html/on-unload-test.html b/tests/ShadowDOM/html/on-unload-test.html index d1b5dc7..2e05168 100644 --- a/tests/ShadowDOM/html/on-unload-test.html +++ b/tests/ShadowDOM/html/on-unload-test.html @@ -8,8 +8,7 @@ Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> - - + diff --git a/tests/ShadowDOM/js/Document.js b/tests/ShadowDOM/js/Document.js index 415d3d9..0cdebe9 100644 --- a/tests/ShadowDOM/js/Document.js +++ b/tests/ShadowDOM/js/Document.js @@ -8,7 +8,7 @@ * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ -htmlSuite('Document', function() { +suite('Document', function() { var wrap = ShadowDOMPolyfill.wrap; @@ -704,8 +704,4 @@ htmlSuite('Document', function() { a3.localName = 'span'; assert.equal('', a3.outerHTML); }); - - htmlTest('../html/document-write.html'); - - htmlTest('../html/head-then-body.html'); }); diff --git a/tests/ShadowDOM/js/HTMLBodyElement.js b/tests/ShadowDOM/js/HTMLBodyElement.js index 08b8dcc..492faf6 100644 --- a/tests/ShadowDOM/js/HTMLBodyElement.js +++ b/tests/ShadowDOM/js/HTMLBodyElement.js @@ -8,7 +8,7 @@ * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ -htmlSuite('HTMLBodyElement', function() { +suite('HTMLBodyElement', function() { var wrap = ShadowDOMPolyfill.wrap; @@ -124,8 +124,4 @@ htmlSuite('HTMLBodyElement', function() { test('constructor', function() { assert.equal(HTMLBodyElement, document.createElement('body').constructor); }); - - htmlTest('../html/document-body-inner-html.html'); - - htmlTest('../html/document-body-shadow-root.html'); }); diff --git a/tests/ShadowDOM/js/TouchEvent.js b/tests/ShadowDOM/js/TouchEvent.js index 9e9e246..3a53e4b 100644 --- a/tests/ShadowDOM/js/TouchEvent.js +++ b/tests/ShadowDOM/js/TouchEvent.js @@ -8,7 +8,7 @@ * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ -htmlSuite('Events', function() { +suite('Events', function() { var unwrap = ShadowDOMPolyfill.unwrap; var wrap = ShadowDOMPolyfill.wrap; diff --git a/tests/ShadowDOM/js/events.js b/tests/ShadowDOM/js/events.js index df0ec7c..508ec4e 100644 --- a/tests/ShadowDOM/js/events.js +++ b/tests/ShadowDOM/js/events.js @@ -8,7 +8,7 @@ * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ -htmlSuite('Events', function() { +suite('Events', function() { var unwrap = ShadowDOMPolyfill.unwrap; var wrap = ShadowDOMPolyfill.wrap; @@ -931,9 +931,6 @@ test('retarget order (multiple shadow roots)', function() { assertArrayEqual(expected, log); }); - htmlTest('../html/on-load-test.html'); - htmlTest('../html/on-unload-test.html'); - test('event wrap round trip', function() { var e = new Event('x'); assert.equal(e, wrap(unwrap(e))); diff --git a/tests/ShadowDOM/runner.html b/tests/ShadowDOM/runner.html index 71f7a20..19b9655 100644 --- a/tests/ShadowDOM/runner.html +++ b/tests/ShadowDOM/runner.html @@ -11,19 +11,130 @@ ShadowDOM Tests - - - - - + - - -
diff --git a/tests/ShadowDOM/tests.js b/tests/ShadowDOM/tests.js index 85777b5..7cef3e3 100644 --- a/tests/ShadowDOM/tests.js +++ b/tests/ShadowDOM/tests.js @@ -24,123 +24,8 @@ var base; }); })(); -function expectStructure(nodeOrWrapper, nonNullFields) { - assert(nodeOrWrapper); - assert.strictEqual(nodeOrWrapper.parentNode, nonNullFields.parentNode || null); - assert.strictEqual(nodeOrWrapper.previousSibling, - nonNullFields.previousSibling || null); - assert.strictEqual(nodeOrWrapper.nextSibling, nonNullFields.nextSibling || null); - assert.strictEqual(nodeOrWrapper.firstChild, nonNullFields.firstChild || null); - assert.strictEqual(nodeOrWrapper.lastChild, nonNullFields.lastChild || null); -} - -function unwrapAndExpectStructure(node, nonNullFields) { - for (var p in nonNullFields) { - nonNullFields[p] = ShadowDOMPolyfill.unwrap(nonNullFields[p]); - } - expectStructure(ShadowDOMPolyfill.unwrap(node), nonNullFields); -} - -function assertArrayEqual(a, b, msg) { - for (var i = 0; i < a.length; i++) { - assert.equal(a[i], b[i], msg); - } - assert.equal(a.length, b.length, msg); -} - -function expectMutationRecord(record, expected) { - assert.equal(record.type, - expected.type === undefined ? null : expected.type); - assert.equal(record.target, - expected.target === undefined ? null : expected.target); - assertArrayEqual(record.addedNodes, - expected.addedNodes === undefined ? [] : expected.addedNodes); - assertArrayEqual(record.removedNodes, - expected.removedNodes === undefined ? [] : expected.removedNodes); - assert.equal(record.previousSibling, - expected.previousSibling === undefined ? - null : expected.previousSibling); - assert.equal(record.nextSibling, - expected.nextSibling === undefined ? null : expected.nextSibling); - assert.equal(record.attributeName, - expected.attributeName === undefined ? null : expected.attributeName); - assert.equal(record.attributeNamespace, - expected.attributeNamespace === undefined ? - null : expected.attributeNamespace); - assert.equal(record.oldValue, - expected.oldValue === undefined ? null : expected.oldValue); -} - -mocha.setup({ - ui: 'tdd', - globals: ['console', 'getInterface'] -}) var modules = [ - 'ChildNodeInterface.js', - 'Comment.js', - 'DOMTokenList.js', - 'Document.js', - 'Element.js', - 'FormData.js', - 'HTMLAudioElement.js', - 'HTMLBodyElement.js', - 'HTMLButtonElement.js', - 'HTMLCanvasElement.js', - 'HTMLContentElement.js', - 'HTMLElement.js', - 'HTMLFieldSetElement.js', - 'HTMLFormElement.js', - 'HTMLHeadElement.js', - 'HTMLHtmlElement.js', - 'HTMLImageElement.js', - 'HTMLInputElement.js', - 'HTMLKeygenElement.js', - 'HTMLLabelElement.js', - 'HTMLLegendElement.js', - 'HTMLObjectElement.js', - 'HTMLOptionElement.js', - 'HTMLOutputElement.js', - 'HTMLSelectElement.js', - 'HTMLShadowElement.js', - 'HTMLTableElement.js', - 'HTMLTableRowElement.js', - 'HTMLTableSectionElement.js', - 'HTMLTemplateElement.js', - 'HTMLTextAreaElement.js', - 'MutationObserver.js', - 'MutationObserver/attributes.js', - 'MutationObserver/callback.js', - 'MutationObserver/characterData.js', - 'MutationObserver/childList.js', - 'MutationObserver/mixed.js', - 'MutationObserver/options.js', - 'MutationObserver/shadow-root.js', - 'MutationObserver/transient.js', - 'Node.js', - 'NonElementParentNodeInterface.js', - 'ParentNodeInterface.js', - 'Range.js', - 'SVGElement.js', - 'SVGElementInstance.js', - 'Selection.js', - 'TreeWalker.js', - 'ShadowRoot.js', - 'Text.js', - 'TouchEvent.js', - 'TreeScope.js', - 'Window.js', - 'XMLHttpRequest.js', - //'build-json.js', - 'createTable.js', - 'custom-element.js', - 'events.js', - 'microtask.js', - 'paralleltrees.js', - 'reprojection.js', - 'rerender.js', - 'test.js', - 'wrappers.js', ]; modules.forEach(function(inSrc) { diff --git a/tests/WebComponents/html/ce-import-upgrade-async.html b/tests/WebComponents/html/ce-import-upgrade-async.html index 7384f4d..e5b13f6 100644 --- a/tests/WebComponents/html/ce-import-upgrade-async.html +++ b/tests/WebComponents/html/ce-import-upgrade-async.html @@ -12,33 +12,33 @@ - - + diff --git a/tests/WebComponents/html/ce-import-upgrade.html b/tests/WebComponents/html/ce-import-upgrade.html index 13c48d0..c43a55f 100644 --- a/tests/WebComponents/html/ce-import-upgrade.html +++ b/tests/WebComponents/html/ce-import-upgrade.html @@ -12,16 +12,13 @@ - - + diff --git a/tests/WebComponents/html/ce-import.html b/tests/WebComponents/html/ce-import.html index ab566f0..ea367a7 100644 --- a/tests/WebComponents/html/ce-import.html +++ b/tests/WebComponents/html/ce-import.html @@ -12,15 +12,14 @@ - - + - + @@ -21,12 +20,12 @@ diff --git a/tests/WebComponents/html/ce-upgradedocumenttree.html b/tests/WebComponents/html/ce-upgradedocumenttree.html index b6091d7..bfdf8b6 100644 --- a/tests/WebComponents/html/ce-upgradedocumenttree.html +++ b/tests/WebComponents/html/ce-upgradedocumenttree.html @@ -12,8 +12,14 @@ - - + + @@ -30,18 +36,20 @@ document.registerElement('x-test', {prototype: proto}); } - if (CustomElements.useNative || HTMLImports.useNative) { - done(); - } else { - window.addEventListener('WebComponentsReady', function() { - CustomElements.ready = false; - register(); - chai.assert.equal(created, 0, 'no elements created when ready explicitly set to false'); - CustomElements.upgradeDocumentTree(document); - chai.assert.equal(created, 3, 'elements in document tree upgraded via CustomElements.upgradeDocumentTree'); - done(); - }); - } + test('upgraded document tree', function(done) { + if (CustomElements.useNative || HTMLImports.useNative) { + return done(); + } else { + window.addEventListener('WebComponentsReady', function() { + CustomElements.ready = false; + register(); + chai.assert.equal(created, 0, 'no elements created when ready explicitly set to false'); + CustomElements.upgradeDocumentTree(document); + chai.assert.equal(created, 3, 'elements in document tree upgraded via CustomElements.upgradeDocumentTree'); + done(); + }); + } + }); diff --git a/tests/WebComponents/html/dev-loader-swizzled.html b/tests/WebComponents/html/dev-loader-swizzled.html index 87f5c89..d9e243c 100644 --- a/tests/WebComponents/html/dev-loader-swizzled.html +++ b/tests/WebComponents/html/dev-loader-swizzled.html @@ -12,20 +12,20 @@ - - + diff --git a/tests/WebComponents/html/dev-loader.html b/tests/WebComponents/html/dev-loader.html index f51d030..1ef370f 100644 --- a/tests/WebComponents/html/dev-loader.html +++ b/tests/WebComponents/html/dev-loader.html @@ -12,19 +12,19 @@ - - + diff --git a/tests/WebComponents/html/jquery-shadowdom-polyfill.html b/tests/WebComponents/html/jquery-shadowdom-polyfill.html index 8f771df..883d01b 100644 --- a/tests/WebComponents/html/jquery-shadowdom-polyfill.html +++ b/tests/WebComponents/html/jquery-shadowdom-polyfill.html @@ -12,19 +12,22 @@ ShadowDOM Polyfill + jQuery + - -
asdf
diff --git a/tests/WebComponents/html/loader-forcepoly.html b/tests/WebComponents/html/loader-forcepoly.html index 4aa33f3..7704e1c 100644 --- a/tests/WebComponents/html/loader-forcepoly.html +++ b/tests/WebComponents/html/loader-forcepoly.html @@ -12,17 +12,17 @@ - - + diff --git a/tests/WebComponents/html/smoke.html b/tests/WebComponents/html/smoke.html index b743ab6..dca9d76 100644 --- a/tests/WebComponents/html/smoke.html +++ b/tests/WebComponents/html/smoke.html @@ -12,8 +12,7 @@ - - + @@ -21,8 +20,7 @@ plain - + @@ -23,10 +22,9 @@ window.addEventListener('HTMLImportsLoaded', function() { window.importsOk = true; }); - window.addEventListener('WebComponentsReady', function() { + test('expected boot', function() { chai.assert.ok(window.importsOk, 'WebComponentsReady without HTMLImportsLoaded'); chai.assert.ok(window.importTest, 'import failed to set global value'); - done(); }); diff --git a/tests/WebComponents/runner.html b/tests/WebComponents/runner.html index c51ff32..d5fce33 100644 --- a/tests/WebComponents/runner.html +++ b/tests/WebComponents/runner.html @@ -11,24 +11,21 @@ WebComponents Tests - - - - - - - - - -
+ - - - - diff --git a/tests/runner.html b/tests/runner.html index c52360c..3c564c8 100644 --- a/tests/runner.html +++ b/tests/runner.html @@ -19,8 +19,8 @@ 'HTMLImports/runner.html', 'Template/tests.html', 'CustomElements/runner.html', -// 'ShadowDOM', -// 'ShadowCSS', -// 'WebComponents' + 'ShadowDOM/runner.html', + 'ShadowCSS/runner.html', + 'WebComponents/runner.html' ]);