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

Unified Diff: LayoutTests/fast/dom/shadow/tabstop-property.html

Issue 1046853002: Implement 'tabstop' as an HTML attribute (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add invlid value case Created 5 years, 9 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
Index: LayoutTests/fast/dom/shadow/tabstop-property.html
diff --git a/LayoutTests/fast/dom/shadow/tabstop-property.html b/LayoutTests/fast/dom/shadow/tabstop-property.html
index f9e5cbe65c9517ba95cc9565764861793d877394..13f864dd86059783a6b706fc4d660f80aadfffce 100644
--- a/LayoutTests/fast/dom/shadow/tabstop-property.html
+++ b/LayoutTests/fast/dom/shadow/tabstop-property.html
@@ -9,21 +9,45 @@
<script>
var div;
+function resetAttributes(el)
+{
+ el.removeAttribute("tabindex");
+ el.removeAttribute("tabstop");
+}
+
+function tabStopShouldBe(el, expected)
+{
+ shouldBe(el + ".tabStop", expected);
+ shouldBeEqualToString(el + ".getAttribute('tabstop')", expected);
+}
+
function test() {
debug("Testing tabStop property and attribute");
debug("Test tabStop normal assignment behavior");
div = document.createElement("div");
+
+ resetAttributes(div);
var flag = div.tabStop;
shouldBe("div.tabStop", "false");
div.tabStop = flag;
+ tabStopShouldBe("div", "false");
+
+ div.removeAttribute('tabstop');
shouldBe("div.tabStop", "false");
+ shouldBe("div.hasAttribute('tabstop')", "false");
tkent 2015/03/31 08:11:18 nit: shouldBeFalse()
kochi 2015/03/31 08:46:08 Done.
+
+ div.tabStop = true;
+ tabStopShouldBe("div", "true");
- div.removeAttribute('isTabstop');
+ div.removeAttribute('tabstop');
shouldBe("div.tabStop", "false");
+ shouldBe("div.hasAttribute('tabstop')", "false");
tkent 2015/03/31 08:11:18 nit: shouldBeFalse()
kochi 2015/03/31 08:46:08 Done.
+
- debug("Test tabStop override by tabindex property");
+ debug("Test tabStop value implicitly set by tabindex property");
+ resetAttributes(div);
div.tabIndex = 0;
shouldBe("div.tabStop", "true");
@@ -33,36 +57,60 @@ function test() {
div.tabIndex = 1;
shouldBe("div.tabStop", "true");
- debug("Test tabStop override by tabindex attribute");
+ resetAttributes(div);
+ shouldBe("div.tabStop", "false");
tkent 2015/03/31 08:11:18 nit: shouldBeFalse()
kochi 2015/03/31 08:46:08 Done.
+
+
+ debug("Test explicit tabStop not overridable by tabindex attribute");
+ resetAttributes(div);
div.tabStop = false;
div.setAttribute("tabindex", "0");
- shouldBe("div.tabStop", "true");
+ tabStopShouldBe("div", "false");
div.tabStop = true;
div.setAttribute("tabindex", "-1");
- shouldBe("div.tabStop", "false");
+ tabStopShouldBe("div", "true");
div.tabStop = false;
div.setAttribute("tabIndex", "1");
- shouldBe("div.tabStop", "true");
+ tabStopShouldBe("div", "false");
+
+ resetAttributes(div);
+ shouldBe("div.tabStop", "false");
tkent 2015/03/31 08:11:18 shouldBeFalse()
kochi 2015/03/31 08:46:08 Done.
+ shouldBe("div.hasAttribute('tabstop')", "false");
tkent 2015/03/31 08:11:18 shouldBeFalse()
kochi 2015/03/31 08:46:08 Done.
+
+
+ debug("Test tabStop change with explicit tabindex change");
+ resetAttributes(div);
- debug("Test tabStop change after tabindex change");
div.tabIndex = 0;
+ shouldBe("div.tabStop", "true");
div.tabStop = false;
- shouldBe("div.tabStop", "false");
+ tabStopShouldBe("div", "false");
+ resetAttributes(div);
div.tabIndex = -1;
+ shouldBe("div.tabStop", "false");
tkent 2015/03/31 08:11:18 shouldBeFalse()
kochi 2015/03/31 08:46:08 Done.
div.tabStop = true;
- shouldBe("div.tabStop", "true");
+ tabStopShouldBe("div", "true");
+ resetAttributes(div);
+
+ debug("Test tabStop with invalid value");
+ resetAttributes(div);
- debug("Test tabStop change before tabindex change which will be overridden");
- div.tabStop = false;
div.tabIndex = 0;
+ div.tabStop = false;
+ tabStopShouldBe("div", "false");
+ div.setAttribute("tabstop", "invalid");
shouldBe("div.tabStop", "true");
tkent 2015/03/31 08:11:18 shouldBeTrue()
kochi 2015/03/31 08:46:08 Done.
+ shouldBeEqualToString("div.getAttribute('tabstop')", "invalid");
- div.tabStop = true;
div.tabIndex = -1;
+ div.tabStop = true;
+ tabStopShouldBe("div", "true");
+ div.setAttribute("tabstop", "invalid");
shouldBe("div.tabStop", "false");
+ shouldBeEqualToString("div.getAttribute('tabstop')", "invalid");
}
function run_test() {

Powered by Google App Engine
This is Rietveld 408576698