Bug 549311 - New lines management tests for placeholder are missing; r=ehsan
authorMounir Lamouri <mounir.lamouri@gmail.com>
Tue, 02 Mar 2010 14:06:17 -0800
changeset 38853 9d313a2e3d79aadaa0ec91cead1847409cf74950
parent 38852 bacc4eece3fbb96154d9e775695237c0c4b2fbb8
child 38854 4180454f836ee491f4c9fbbd0fc35b6789d4bbe3
push id11900
push usereakhgari@mozilla.com
push dateTue, 02 Mar 2010 22:07:20 +0000
treeherdermozilla-central@9d313a2e3d79 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs549311
milestone1.9.3a3pre
Bug 549311 - New lines management tests for placeholder are missing; r=ehsan
content/html/content/test/test_bug457800.html
layout/reftests/forms/placeholder/placeholder-11.html
layout/reftests/forms/placeholder/placeholder-12.html
layout/reftests/forms/placeholder/placeholder-13.html
layout/reftests/forms/placeholder/placeholder-14.html
layout/reftests/forms/placeholder/reftest.list
--- a/content/html/content/test/test_bug457800.html
+++ b/content/html/content/test/test_bug457800.html
@@ -36,16 +36,24 @@ function testPlaceholderForElement(eleme
   element.placeholder = 'ph';
   is(element.placeholder, 'ph', "can't write placeholder in DOM interface");
 
   // check placeholder and value are not interfering
   is(element.value, '', "value has changed when placeholder has changed");
   element.value = 'value';
   is(element.placeholder, 'ph', "placeholder in DOM interface has changed when value has changed");
   is(element.getAttribute('placeholder'), 'ph', "placeholder attribute has changed when value has changed");
+
+  // check new lines are managed correctly (shouldn't be shown but kept in the DOM)
+  element.placeholder = 'place\nholder';
+  is(element.placeholder, 'place\nholder', "\\n shouldn't be stripped");
+  is(element.getAttribute('placeholder'), 'place\nholder', "\\n shouldn't be stripped");
+  element.placeholder = 'place\rholder';
+  is(element.placeholder, 'place\rholder', "\\r shouldn't be stripped");
+  is(element.getAttribute('placeholder'), 'place\rholder', "\\r shouldn't be stripped");
 }
 
 testPlaceholderForElement(document.getElementById('inputtext'));
 testPlaceholderForElement(document.getElementById('inputpassword'));
 testPlaceholderForElement(document.getElementById('textarea'));
 
 </script>
 </pre>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/forms/placeholder/placeholder-11.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+  <!-- Test: placeholder shouldn't show new lines (&#10; version) -->
+  <body>
+    <input type="text" value="" placeholder="my&#10; placeholder">
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/forms/placeholder/placeholder-12.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+  <!-- Test: placeholder shouldn't show new lines (&#13; version) -->
+  <body>
+    <input type="text" value="" placeholder="my&#13; placeholder">
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/forms/placeholder/placeholder-13.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <!-- Test: placeholder shouldn't show new lines (\r version) -->
+  <script type="text/javascript">
+    function setPlaceholder()
+    {
+      document.getElementById('p1').placeholder = 'my\r placeholder';
+    }
+    function disableReftestWait()
+    {
+      document.documentElement.className = '';
+    }
+  </script>
+  <body onload="setPlaceholder(); disableReftestWait();">
+    <input type="text" id="p1" value="" placeholder="">
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/forms/placeholder/placeholder-14.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <!-- Test: placeholder shouldn't show new lines (\n version) -->
+  <script type="text/javascript">
+    function setPlaceholder()
+    {
+      document.getElementById('p1').placeholder = 'my\n placeholder';
+    }
+    function disableReftestWait()
+    {
+      document.documentElement.className = '';
+    }
+  </script>
+  <body onload="setPlaceholder(); disableReftestWait();">
+    <input type="text" id="p1" value="" placeholder="">
+  </body>
+</html>
--- a/layout/reftests/forms/placeholder/reftest.list
+++ b/layout/reftests/forms/placeholder/reftest.list
@@ -6,8 +6,12 @@
 == placeholder-4.html placeholder-overridden-ref.html
 == placeholder-5.html placeholder-visible-ref.html
 == placeholder-6.html placeholder-overflow-ref.html
 == placeholder-6-textarea.html placeholder-overflow-textarea-ref.html
 == placeholder-7.html placeholder-focus-ref.html
 == placeholder-8.html placeholder-focus-ref.html
 == placeholder-9.html placeholder-focus-ref.html
 == placeholder-10.html placeholder-visible-ref.html
+== placeholder-11.html placeholder-visible-ref.html
+== placeholder-12.html placeholder-visible-ref.html
+== placeholder-13.html placeholder-visible-ref.html
+== placeholder-14.html placeholder-visible-ref.html