Bug 549311 - New lines management tests for placeholder are missing; r=ehsan

--HG--
extra : rebase_source : ba4be5c6a90abfef87f573968d00b4cc179aafdd
This commit is contained in:
Mounir Lamouri 2010-03-02 14:06:17 -08:00
Родитель 8741080d1b
Коммит 4dca577f2e
6 изменённых файлов: 60 добавлений и 0 удалений

Просмотреть файл

@ -41,6 +41,14 @@ function testPlaceholderForElement(element)
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'));

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -11,3 +11,7 @@
== 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