3 This tests that textarea wrap attributes work correctly when submitting a form.
4 <form action=
"?" name=f
>
5 <textarea name=ta_WrapHard cols=
5 style=
"-webkit-appearance:textarea" wrap=hard
>123456789</textarea><br>
6 <textarea name=ta_WrapSoft cols=
5 style=
"-webkit-appearance:textarea" wrap=soft
>123456789</textarea><br>
7 <textarea name=ta_WrapOff cols=
5 style=
"-webkit-appearance:textarea" wrap=off
>123456789</textarea><br>
8 <textarea name=ta_WrapHardRTL cols=
5 style=
"-webkit-appearance:textarea; direction:rtl" wrap=hard
>אבגאבגאבגאבג</textarea><br>
9 <textarea name=ta_WrapHardBidi cols=
5 style=
"-webkit-appearance:textarea; direction:ltr" wrap=hard
>abc
אבגאבגabc
</textarea><br>
10 <textarea name=ta_WrapHardHidden cols=
5 style=
"-webkit-appearance:textarea; visibility:hidden" wrap=hard
>123456789</textarea><br>
17 document
.getElementById('res').innerHTML
= document
.getElementById('res').innerHTML
+ msg
+ "<br>";
20 if (window
.testRunner
) {
21 testRunner
.dumpAsText();
22 testRunner
.waitUntilDone();
25 var unescapedLineWrap
= unescape("%0D%0A");
27 function assertLineWrap(properties
, escapedResult
, shouldHaveLineBreakInResult
) {
28 var unescapedResult
= unescape(escapedResult
);
29 var passed
= shouldHaveLineBreakInResult
?
30 unescapedResult
.indexOf(unescapedLineWrap
) != -1 :
31 unescapedResult
.indexOf(unescapedLineWrap
) == -1
33 log("<p>" + properties
+ ": Success</p>");
35 log("<p>" + properties
+ ": Failure. Expected " + (shouldHaveLineBreakInResult
? "" : "no ") +
36 "%0D%A in the result at the line-wrap. <br>Actual form data: " + unescapedResult
+ "</p>");
39 if (document
.URL
.substring(0, 4) == "file") {
41 if (document
.URL
.indexOf('?') == -1) {
44 var urlString
= document
.URL
.substring(document
.URL
.indexOf('?')+1, document
.URL
.length
);
46 var index2
= urlString
.indexOf('ta_WrapSoft');
47 var index3
= urlString
.indexOf('ta_WrapOff');
48 var index4
= urlString
.indexOf('ta_WrapHardRTL');
49 var index5
= urlString
.indexOf('ta_WrapHardBidi');
50 var index6
= urlString
.indexOf('ta_WrapHardHidden');
51 var index7
= document
.URL
.length
;
55 assertLineWrap("wrap=hard", urlString
.substring(index1
, index2
- 1), true);
56 assertLineWrap("wrap=soft", urlString
.substring(index2
, index3
- 1), false);
57 assertLineWrap("wrap=off", urlString
.substring(index3
, index4
- 1), false);
58 assertLineWrap("wrap=hard rtl text", urlString
.substring(index4
, index5
- 1), true);
59 assertLineWrap("wrap=hard mixed rtl and ltr text", urlString
.substring(index5
, index6
- 1), true);
60 assertLineWrap("wrap=hard visibility:hidden", urlString
.substring(index6
, index7
- 1), true);
62 if (window
.testRunner
)
63 testRunner
.notifyDone();
67 document
.write("<p>This test doesn't work directly from bugzilla, please save it to a local file first.</p>");