Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Unified Diff: third_party/WebKit/LayoutTests/custom-elements/spec/selectors/pseudo-class-defined.html

Issue 2039103004: Add tests of state changes for :defined() selector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/custom-elements/spec/selectors/pseudo-class-defined.html
diff --git a/third_party/WebKit/LayoutTests/custom-elements/spec/selectors/pseudo-class-defined.html b/third_party/WebKit/LayoutTests/custom-elements/spec/selectors/pseudo-class-defined.html
index a248f121b1ae9c9f8e2dc78ff829c16b4af62cdc..6f1e191bd07346b6925c9c4b5fb24eadfc951b07 100644
--- a/third_party/WebKit/LayoutTests/custom-elements/spec/selectors/pseudo-class-defined.html
+++ b/third_party/WebKit/LayoutTests/custom-elements/spec/selectors/pseudo-class-defined.html
@@ -39,19 +39,30 @@ iframe.onload = () => {
function test_defined_for_createElement(defined, doc, tagName, description = '') {
dominicc (has gone to gerrit) 2016/06/07 12:01:06 Nit: Consider tagName -> tag_name if you're going
kojii 2016/06/07 18:59:31 Done. testharness.js forcing us to mix styles alwa
// Test document.createElement().
- let element = doc.createElement(tagName);
+ const element = doc.createElement(tagName);
dominicc (has gone to gerrit) 2016/06/07 12:01:05 Why const and not let?
kojii 2016/06/07 18:59:31 Changed back to let. Read somewhere that I should
doc.body.appendChild(element);
test_defined(defined, element, `${description}createElement("${tagName}")`);
// Test document.createElementNS().
- element = doc.createElementNS('http://www.w3.org/1999/xhtml', tagName);
- doc.body.appendChild(element);
- test_defined(defined, element, `${description}createElementNS("http://www.w3.org/1999/xhtml", "${tagName}")`);
+ const html_element = doc.createElementNS('http://www.w3.org/1999/xhtml', tagName);
+ doc.body.appendChild(html_element);
+ test_defined(defined, html_element, `${description}createElementNS("http://www.w3.org/1999/xhtml", "${tagName}")`);
// If the element namespace is not HTML, it should be "uncustomized"; i.e., "defined".
- element = doc.createElementNS('http://www.w3.org/2000/svg', tagName);
- doc.body.appendChild(element);
- test_defined(true, element, `${description}createElementNS("http://www.w3.org/2000/svg", "${tagName}")`);
+ const svg_element = doc.createElementNS('http://www.w3.org/2000/svg', tagName);
+ doc.body.appendChild(svg_element);
+ test_defined(true, svg_element, `${description}createElementNS("http://www.w3.org/2000/svg", "${tagName}")`);
+
+ // Test ":defined" changes when the custom element was defined.
+ if (!defined) {
+ const w = doc.defaultView;
+ w.customElements.define(tagName, class extends w.HTMLElement {
+ constructor() { super(); }
+ });
rune 2016/06/07 09:39:08 Would it make sense to test the two other cases in
kojii 2016/06/07 10:48:54 is="" is not supported yet, it requires quite amou
rune 2016/06/07 10:56:00 Acknowledged.
+
+ test_defined(true, element, `Upgraded ${description}createElement("${tagName}")`);
+ test_defined(true, html_element, `Upgraded ${description}createElementNS("http://www.w3.org/1999/xhtml", "${tagName}")`);
+ }
}
function test_defined(expected, element, description) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698