tizen beta release
[framework/web/webkit-efl.git] / LayoutTests / editing / inserting / insert-composition-whitespace.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../fast/js/resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <script>
10
11 var sel = document.getSelection();
12 var root = document.createElement("root");
13 document.body.appendChild(root);
14
15
16 function createEditable(tagName, text) {
17     var node = document.createElement(tagName);
18     node.contentEditable = true;
19     node.innerHTML = text;
20     return node;
21 }
22
23 function test(tagName, compositionText, expected) {
24     var node = createEditable(tagName, "X");
25     root.appendChild(node);
26
27     var textNode = node.firstChild;
28     sel.setBaseAndExtent(textNode, 0, textNode, textNode.data.length);
29     document.execCommand("Delete", false);
30
31     textInputController.setMarkedText(compositionText, 0, compositionText.length);
32     compositingText = node.innerText;
33     textInputController.unmarkText();
34     confirmedText = node.innerText;
35
36     shouldBe("compositingText", "'" + expected + "'");
37     shouldBe("confirmedText", "'" + expected + "'");
38 }
39
40 test("div", "AB", "AB");
41 test("div", "A B", "A B");
42 test("div", "A  B", "A \xA0B");
43 test("div", "A   B", "A \xA0 B");
44 test("div", "A    B", "A \xA0 \xA0B"); 
45
46 test("div", " AB", "\xA0AB");
47 test("div", "  AB", "\xA0 AB");
48 test("div", "   AB", "\xA0 \xA0AB");
49 test("div", "    AB", "\xA0 \xA0 AB");
50 test("div", "     AB", "\xA0 \xA0 \xA0AB");
51 test("div", "      AB", "\xA0 \xA0 \xA0 AB");
52 test("div", "       AB", "\xA0 \xA0 \xA0 \xA0AB");
53 test("div", "AB  ", "AB \xA0");
54 test("div", "AB   ", "AB \xA0\xA0");
55 test("div", "AB    ", "AB \xA0 \xA0");
56 test("div", "AB     ", "AB \xA0 \xA0\xA0");
57 test("div", "AB      ", "AB \xA0 \xA0 \xA0");
58 test("div", "AB       ", "AB \xA0 \xA0 \xA0\xA0");
59
60 test("div", "  A  B  ", "\xA0 A \xA0B \xA0");
61 test("div", "\t\tA\t\tB\t\t", "\xA0 A \xA0B \xA0");
62
63 test("div", " ", "\xA0");
64 test("div", "  ", "\xA0\xA0");
65 test("div", "   ", "\xA0 \xA0");
66
67 test("pre", "AB", "AB");
68 test("pre", "A B", "A B");
69 test("pre", "A  B", "A  B");
70 test("pre", "A   B", "A   B");
71 test("pre", "A    B", "A    B");
72 test("pre", "AB  ", "AB  ");
73 test("pre", "AB   ", "AB   ");
74 test("pre", "AB    ", "AB    ");
75 test("pre", "AB     ", "AB     ");
76 test("pre", "AB      ", "AB      ");
77 test("pre", "AB       ", "AB       ");
78 test("pre", "  AB", "  AB");
79 test("pre", "   AB", "   AB");
80 test("pre", "    AB", "    AB");
81 test("pre", "     AB", "     AB");
82 test("pre", "      AB", "      AB");
83 test("pre", "       AB", "       AB");
84
85 test("pre", "  A  B  ", "  A  B  ");
86 test("pre", "\t\tA\t\tB\t\t", "\t\tA\t\tB\t\t");
87 test("pre", " ", " ");
88 test("pre", "  ", "  ");
89 test("pre", "   ", "   ");
90
91 root.style.display = "none";
92
93 </script>
94 <script src="../../fast/js/resources/js-test-post.js"></script>
95 </body>
96 </html>