Chromium Code Reviews| 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 checked_assert_selection(input, command, output) { | 6 function checked_assert_selection(input, command, output) { |
| 7 try { | 7 try { |
| 8 assert_selection(input, command, output); | 8 assert_selection(input, command, output); |
| 9 } catch (exception) { | 9 } catch (exception) { |
| 10 return exception.message; | 10 return exception.message; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 '<table><tbody><tr><td>foo</td></tr></tbody></table>|'); | 54 '<table><tbody><tr><td>foo</td></tr></tbody></table>|'); |
| 55 assert_selection( | 55 assert_selection( |
| 56 '^<table><tr><td>foo</td></tr></table>|', 'noop', | 56 '^<table><tr><td>foo</td></tr></table>|', 'noop', |
| 57 '^<table><tbody><tr><td>foo</td></tr></tbody></table>|'); | 57 '^<table><tbody><tr><td>foo</td></tr></tbody></table>|'); |
| 58 assert_selection( | 58 assert_selection( |
| 59 '|<table><tr><td>foo</td></tr></table>^', 'noop', | 59 '|<table><tr><td>foo</td></tr></table>^', 'noop', |
| 60 '|<table><tbody><tr><td>foo</td></tr></tbody></table>^'); | 60 '|<table><tbody><tr><td>foo</td></tr></tbody></table>^'); |
| 61 }, 'markers around table'); | 61 }, 'markers around table'); |
| 62 | 62 |
| 63 test(() => { | 63 test(() => { |
| 64 assert_selection( | |
| 65 '<div>foo</div>', | |
| 66 selection => { | |
| 67 let doc = selection.document; | |
| 68 doc.documentElement.replaceChild( | |
| 69 doc.createTextNode('baz'), doc.body); | |
| 70 }, | |
| 71 '<html><head></head>baz</html>', | |
| 72 'Serialize document element instead of document.body when is is null.'); | |
|
yoichio
2016/07/20 04:20:30
"when 'it' is null." ?
yosin_UTC9
2016/07/20 04:39:06
Done
| |
| 73 }, 'result with out body'); | |
| 74 | |
| 75 test(() => { | |
| 64 assert_equals(checked_assert_selection('fo|o', 'noop', 'fo|o'), | 76 assert_equals(checked_assert_selection('fo|o', 'noop', 'fo|o'), |
| 65 'no exception'); | 77 'no exception'); |
| 66 }, 'no marker in output'); | 78 }, 'no marker in output'); |
| 67 | 79 |
| 68 test(() => { | 80 test(() => { |
| 69 assert_equals(checked_assert_selection('fo|o|', 'noop', 'foo'), | 81 assert_equals(checked_assert_selection('fo|o|', 'noop', 'foo'), |
| 70 'You should have at least one focus marker "|" in "fo|o|".'); | 82 'You should have at least one focus marker "|" in "fo|o|".'); |
| 71 }, 'multiple focus markers in input'); | 83 }, 'multiple focus markers in input'); |
| 72 | 84 |
| 73 test(() => { | 85 test(() => { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 `\t sameupto fo`); | 127 `\t sameupto fo`); |
| 116 }, 'Compare result'); | 128 }, 'Compare result'); |
| 117 | 129 |
| 118 test(() => { | 130 test(() => { |
| 119 assert_selection( | 131 assert_selection( |
| 120 '<div contenteditable><p>^test|</p></div>', | 132 '<div contenteditable><p>^test|</p></div>', |
| 121 'insertHTML <span style="color: green">green</span>', | 133 'insertHTML <span style="color: green">green</span>', |
| 122 '<div contenteditable><p><span style="color: green">green|</span></p></d iv>'); | 134 '<div contenteditable><p><span style="color: green">green|</span></p></d iv>'); |
| 123 }, 'multiple spaces in function'); | 135 }, 'multiple spaces in function'); |
| 124 </script> | 136 </script> |
| OLD | NEW |