OLD | NEW |
---|---|
(Empty) | |
1 <!doctype html> | |
2 <script src="../../resources/testharness.js"></script> | |
3 <script src="../../resources/testharnessreport.js"></script> | |
4 <script src="../assert_selection.js"></script> | |
5 <script> | |
6 test(() => assert_selection( | |
7 [ | |
8 '<div contenteditable style="word-wrap: break-word;">', | |
9 '<div><b>a</b>^b|</div>', | |
10 '</div>' | |
11 ].join(''), | |
12 'bold', | |
13 [ | |
14 '<div contenteditable style="word-wrap: break-word;">', | |
15 '<div><b>a^b|</b></div>', | |
16 '</div>' | |
17 ].join('')), | |
18 'Extend previous B'); | |
19 | |
20 test(() => assert_selection( | |
21 [ | |
22 '<div contenteditable style="word-wrap: break-word;">', | |
23 '<div><b>a|</b>c</div>', | |
24 '</div>' | |
25 ].join(''), | |
26 'insertText b', | |
27 [ | |
28 '<div contenteditable style="word-wrap: break-word;">', | |
29 '<div><b>ab|</b>c</div>', | |
30 '</div>' | |
31 ].join('')), | |
32 'Insert a character into existing B'); | |
33 | |
34 test(() => assert_selection( | |
35 [ | |
36 '<div contenteditable style="word-wrap: break-word;">', | |
37 '<div><b>a|</b>c</div>', | |
38 '</div>' | |
39 ].join(''), | |
40 selection => { | |
41 selection.document.execCommand('bold'); // disable bold | |
42 selection.document.execCommand('insertText', false, 'b'); | |
43 }, | |
44 [ | |
45 '<div contenteditable style="word-wrap: break-word;">', | |
46 '<div><b>a</b>b|c</div>', | |
47 '</div>' | |
48 ].join('')), | |
49 'Simulate Ctrl+B then typing a character'); | |
50 | |
51 test(() => assert_selection( | |
52 [ | |
53 '<div contenteditable style="word-wrap: break-word;">', | |
54 '<div><div><b>a</b></div><div>^b|</div></div>', | |
Xiaocheng
2016/08/17 05:56:48
The initial selection should be something like '<d
yosin_UTC9
2016/08/17 06:39:53
Yes, you're right. Selection anchor is after "a".
| |
55 '</div>' | |
56 ].join(''), | |
57 'bold', | |
58 [ | |
59 '<div contenteditable style="word-wrap: break-word;">', | |
60 '<div><div><b>a</b></div><div><b>^b|</b></div></div>', | |
61 '</div>' | |
62 ].join('')), | |
63 'B element should not spread beyond DIV'); | |
64 </script> | |
OLD | NEW |