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

Unified Diff: LayoutTests/fast/selectors/placeholder-shown-sibling-style-update.html

Issue 1280423002: CSS4: Implement :placeholder-shown pseudo class (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated as per review comments Created 5 years, 4 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/selectors/placeholder-shown-sibling-style-update.html
diff --git a/LayoutTests/fast/selectors/placeholder-shown-sibling-style-update.html b/LayoutTests/fast/selectors/placeholder-shown-sibling-style-update.html
new file mode 100644
index 0000000000000000000000000000000000000000..d50eea605d0d6503878fca5407610476e40541a1
--- /dev/null
+++ b/LayoutTests/fast/selectors/placeholder-shown-sibling-style-update.html
@@ -0,0 +1,46 @@
+<!doctype html>
+<script src="../../resources/js-test.js"></script>
+<style>
+target {
+ background-color: white;
+}
+:placeholder-shown + target {
+ background-color: rgb(1, 2, 3);
+}
+</style>
+<div>
+ <input id="input-with-renderer">
+ <target id="target1"></target>
+ <textarea id="textarea-with-renderer"></textarea>
+ <target id="target2"></target>
+</div>
+<div style="display:none;">
+ <input id="input-without-renderer">
+ <target id="target3"></target>
+ <textarea id="textarea-without-renderer"></textarea>
+ <target id="target4"></target>
+</div>
+<script>
+description('Test style update of the :placeholder-shown pseudo class.');
+function testBackgroundColor(expectMatch) {
+ shouldBeEqualToString('getComputedStyle(document.getElementById("target1")).backgroundColor', expectMatch ? 'rgb(1, 2, 3)' : 'rgb(255, 255, 255)');
+ shouldBeEqualToString('getComputedStyle(document.getElementById("target2")).backgroundColor', expectMatch ? 'rgb(1, 2, 3)' : 'rgb(255, 255, 255)');
+ shouldBeEqualToString('getComputedStyle(document.getElementById("target3")).backgroundColor', expectMatch ? 'rgb(1, 2, 3)' : 'rgb(255, 255, 255)');
+ shouldBeEqualToString('getComputedStyle(document.getElementById("target4")).backgroundColor', expectMatch ? 'rgb(1, 2, 3)' : 'rgb(255, 255, 255)');
+}
+var inputCaseWithRenderer = document.getElementById("input-with-renderer");
+var textareaCaseWithRenderer = document.getElementById("textarea-with-renderer");
+var inputCaseWithoutRenderer = document.getElementById("input-without-renderer");
+var textareaCaseWithoutRenderer = document.getElementById("textarea-without-renderer");
+function setAttribute(attribute, value) {
+ inputCaseWithRenderer.setAttribute(attribute, value);
+ textareaCaseWithRenderer.setAttribute(attribute, value);
+ inputCaseWithoutRenderer.setAttribute(attribute, value);
+ textareaCaseWithoutRenderer.setAttribute(attribute, value);
+}
+debug("Initial state is without placehoder.");
+testBackgroundColor(false);
+debug("Adding a placeholder, the targets should match the style.");
+setAttribute("placeholder", "WebKit")
+testBackgroundColor(true);
+</script>

Powered by Google App Engine
This is Rietveld 408576698