OLD | NEW |
---|---|
(Empty) | |
1 description("Test to make sure inserting an ordered/unordered list inside anothe r list works") | |
yosin_UTC9
2017/03/21 05:37:20
Please use assert_selection() which is implemented
jfernandez
2017/03/24 01:57:55
Done.
| |
2 | |
3 var testContainer = document.createElement("div"); | |
4 testContainer.contentEditable = true; | |
5 document.body.appendChild(testContainer); | |
6 | |
7 function testList(toggleCommand, initialContents, expectedContents, id1, id2 = i d1) | |
8 { | |
9 testContainer.innerHTML = initialContents; | |
10 window.getSelection().collapse(document.getElementById(id1), 0); | |
11 window.getSelection().extend(document.getElementById(id2), 1); | |
12 document.execCommand(toggleCommand, false, null); | |
13 if (testContainer.innerHTML === expectedContents) { | |
14 testPassed(initialContents + "\n got:" + expectedContents+"\n"); | |
15 } else { | |
16 testFailed(initialContents + "\n got:" + testContainer.innerHTML + "\nex p.:" + expectedContents+"\n"); | |
17 } | |
18 } | |
19 | |
20 debug('Select 1 node\n'); | |
21 testList("InsertOrderedList", '<ul><li id="first">hello</li><li>world</li><li>We bKit</li></ul>', '<ol><li>hello</li></ol><ul><li>world</li><li>WebKit</li></ul>' , "first"); | |
22 testList("InsertOrderedList", '<ul><li>hello</li><li id="first">world</li><li>We bKit</li></ul>', '<ul><li>hello</li></ul><ol><li>world</li></ol><ul><li>WebKit</ li></ul>', "first"); | |
23 testList("InsertOrderedList", '<ul><li>hello</li><li>world</li><li id="first">We bKit</li></ul>', '<ul><li>hello</li><li>world</li></ul><ol><li>WebKit</li></ol>' , "first"); | |
24 testList("InsertUnorderedList", '<ol><li id="first">hello</li><li>world</li><li> WebKit</li></ol>', '<ul><li>hello</li></ul><ol><li>world</li><li>WebKit</li></ol >', "first"); | |
25 testList("InsertUnorderedList", '<ol><li>hello</li><li id="first">world</li><li> WebKit</li></ol>', '<ol><li>hello</li></ol><ul><li>world</li></ul><ol><li>WebKit </li></ol>', "first"); | |
26 testList("InsertUnorderedList", '<ol><li>hello</li><li>world</li><li id="first"> WebKit</li></ol>', '<ol><li>hello</li><li>world</li></ol><ul><li>WebKit</li></ul >', "first"); | |
27 | |
28 debug('Select 2 nodes \n'); | |
29 testList("InsertOrderedList", '<ul><li id="first">hello</li><li id="second">worl d</li><li>WebKit</li></ul>', '<ol><li>hello</li><li>world</li></ol><ul><li>WebKi t</li></ul>', "first", "second"); | |
30 testList("InsertOrderedList", '<ul><li>hello</li><li id="first">world</li><li id ="second">WebKit</li></ul>', '<ul><li>hello</li></ul><ol><li>world</li><li id="s econd">WebKit</li></ol>', "first", "second"); | |
31 testList("InsertUnorderedList", '<ol><li id="first">hello</li><li id="second">wo rld</li><li>WebKit</li></ol>', '<ul><li>hello</li><li>world</li></ul><ol><li>Web Kit</li></ol>', "first", "second"); | |
32 testList("InsertUnorderedList", '<ol><li>hello</li><li id="first">world</li><li id="second">WebKit</li></ol>', '<ol><li>hello</li></ol><ul><li>world</li><li id= "second">WebKit</li></ul>', "first", "second"); | |
33 | |
34 document.body.removeChild(testContainer); | |
35 | |
36 var successfullyParsed = true; | |
OLD | NEW |