OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
4 <script src="../assert_selection.js"></script> | 4 <script src="../assert_selection.js"></script> |
5 <script> | 5 <script> |
6 function swapMarks(string) { | 6 function swapMarks(string) { |
7 if (string.indexOf('^') === -1) | 7 if (string.indexOf('^') === -1) |
8 return string; | 8 return string; |
9 return string.replace('^', '$').replace('|', '^').replace('$', '|'); | 9 return string.replace('^', '$').replace('|', '^').replace('$', '|'); |
10 } | 10 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 test_selection( | 54 test_selection( |
55 '<p>Abcd efgh X^Y blah i|jkl</p>', | 55 '<p>Abcd efgh X^Y blah i|jkl</p>', |
56 selection => doInsert(selection, 19), | 56 selection => doInsert(selection, 19), |
57 '<p>Abcd efgh X^Y blah i|_____________jkl</p>', | 57 '<p>Abcd efgh X^Y blah i|_____________jkl</p>', |
58 'insertData at 19'); | 58 'insertData at 19'); |
59 | 59 |
60 // Deletion tests | 60 // Deletion tests |
61 test_selection( | 61 test_selection( |
62 '<p>Abcd efgh T^he Range i|jkl</p>', | 62 '<p>Abcd efgh T^he Range i|jkl</p>', |
63 selection => doDelete(selection, 5, 8), | 63 selection => doDelete(selection, 5, 8), |
64 '<p>Abcd ^ Range i|jkl</p>', | 64 '<p>Abcd ^Range i|jkl</p>', |
65 'deleteData(5, 8)'); | 65 'deleteData(5, 8)'); |
66 | 66 |
67 test_selection( | 67 test_selection( |
68 '<p>Abcd efgh T^he Range i|jkl</p>', | 68 '<p>Abcd efgh T^he Range i|jkl</p>', |
69 selection => doDelete(selection, 5, 6), | 69 selection => doDelete(selection, 5, 6), |
70 '<p>Abcd ^he Range i|jkl</p>', | 70 '<p>Abcd ^he Range i|jkl</p>', |
71 'deleteData(5, 6)'); | 71 'deleteData(5, 6)'); |
72 | 72 |
73 test_selection( | 73 test_selection( |
74 '<p>Abcd efgh T^he Range i|jkl</p>', | 74 '<p>Abcd efgh T^he Range i|jkl</p>', |
75 selection => doDelete(selection, 5, 17), | 75 selection => doDelete(selection, 5, 17), |
76 '<p>Abcd |kl</p>', | 76 '<p>Abcd |kl</p>', |
77 'deleteData(5, 17)'); | 77 'deleteData(5, 17)'); |
78 | 78 |
79 // Delete node containing selection | 79 // Delete node containing selection |
80 test_selection( | 80 test_selection( |
81 '<p>Abcd <em>efgh T^he Range i|j</em>kl</p>', | 81 '<p>Abcd <em>efgh T^he Range i|j</em>kl</p>', |
82 selection => selection.document.querySelector('em').remove(), | 82 selection => selection.document.querySelector('em').remove(), |
83 '<p>Abcd |kl</p>', | 83 '<p>Abcd |kl</p>', |
84 'delete node containing selection'); | 84 'delete node containing selection'); |
85 </script> | 85 </script> |
OLD | NEW |