Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: LayoutTests/editing/execCommand/script-tests/query-command-state.js

Issue 14930006: Ctrl+Shift+Right in Windows should select the spacing after the word (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added expectations for chromium-mac for delete-cell-contents-win.html Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 description("Test to make sure queryCommandState returns correct values.") 1 description("Test to make sure queryCommandState returns correct values.")
2 2
3 var testContainer = document.createElement("div"); 3 var testContainer = document.createElement("div");
4 testContainer.contentEditable = true; 4 testContainer.contentEditable = true;
5 document.body.appendChild(testContainer); 5 document.body.appendChild(testContainer);
6 6
7 function testQueryCommandState(command, contents, selector, expectedState) 7 function testQueryCommandState(command, contents, selector, expectedState)
8 { 8 {
9 testContainer.innerHTML = contents; 9 testContainer.innerHTML = contents;
10 var selected = selector(testContainer); 10 var selected = selector(testContainer);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 function runTests(editingBehavior) { 44 function runTests(editingBehavior) {
45 if (window.internals) 45 if (window.internals)
46 internals.settings.setEditingBehavior(editingBehavior); 46 internals.settings.setEditingBehavior(editingBehavior);
47 debug('Tests for ' + editingBehavior) 47 debug('Tests for ' + editingBehavior)
48 48
49 testQueryCommandState("bold", 'hello', selectAll, {'mac': false, 'win': fals e}[editingBehavior]); 49 testQueryCommandState("bold", 'hello', selectAll, {'mac': false, 'win': fals e}[editingBehavior]);
50 testQueryCommandState("bold", '<i>hello</i>', selectAll, {'mac': false, 'win ': false}[editingBehavior]); 50 testQueryCommandState("bold", '<i>hello</i>', selectAll, {'mac': false, 'win ': false}[editingBehavior]);
51 testQueryCommandState("bold", '<b>hello</b>', selectAll, {'mac': true, 'win' : true}[editingBehavior]); 51 testQueryCommandState("bold", '<b>hello</b>', selectAll, {'mac': true, 'win' : true}[editingBehavior]);
52 testQueryCommandState("bold", 'hello <b>world</b>', selectAll, {'mac': false , 'win': false}[editingBehavior]); 52 testQueryCommandState("bold", 'hello <b>world</b>', selectAll, {'mac': false , 'win': false}[editingBehavior]);
53 testQueryCommandState("bold", '<b>hello</b> world', selectAll, {'mac': true, 'win': false}[editingBehavior]); 53 testQueryCommandState("bold", '<b>hello</b> world', selectAll, {'mac': true, 'win': false}[editingBehavior]);
54 testQueryCommandState("bold", 'hello <b>world</b> WebKit', selectSecondWord, {'mac': true, 'win': true}[editingBehavior]); 54 testQueryCommandState("bold", 'hello <b>world</b> WebKit', selectSecondWord, {'mac': true, 'win': false}[editingBehavior]);
55 testQueryCommandState("bold", '<b>hello</b> world <b>WebKit</b>', selectSeco ndWord, {'mac': false, 'win': false}[editingBehavior]); 55 testQueryCommandState("bold", '<b>hello</b> world <b>WebKit</b>', selectSeco ndWord, {'mac': false, 'win': false}[editingBehavior]);
56 testQueryCommandState("bold", '<i>hello <b>hello</b> WebKit</i>', selectSeco ndWord, {'mac': true, 'win': true}[editingBehavior]); 56 testQueryCommandState("bold", '<i>hello <b>hello</b> WebKit</i>', selectSeco ndWord, {'mac': true, 'win': false}[editingBehavior]);
57 testQueryCommandState("bold", '<b>hello <i>hello</i> WebKit</b>', selectSeco ndWord, {'mac': true, 'win': true}[editingBehavior]); 57 testQueryCommandState("bold", '<b>hello <i>hello</i> WebKit</b>', selectSeco ndWord, {'mac': true, 'win': true}[editingBehavior]);
58 testQueryCommandState("bold", '<b><div>hello <i>hello</i> WebKit</div></b>', selectSecondWord, {'mac': true, 'win': true}[editingBehavior]); 58 testQueryCommandState("bold", '<b><div>hello <i>hello</i> WebKit</div></b>', selectSecondWord, {'mac': true, 'win': true}[editingBehavior]);
59 testQueryCommandState("bold", '<b style="font-weight: normal;">hello</b>', s electAll, {'mac': false, 'win': false}[editingBehavior]); 59 testQueryCommandState("bold", '<b style="font-weight: normal;">hello</b>', s electAll, {'mac': false, 'win': false}[editingBehavior]);
60 testQueryCommandState("bold", '<i style="font-weight: bold;">hello</i>', sel ectAll, {'mac': true, 'win': true}[editingBehavior]); 60 testQueryCommandState("bold", '<i style="font-weight: bold;">hello</i>', sel ectAll, {'mac': true, 'win': true}[editingBehavior]);
61 testQueryCommandState("bold", '<b>hello</b> world <b>WebKit</b>', selectAll, {'mac': true, 'win': false}[editingBehavior]); 61 testQueryCommandState("bold", '<b>hello</b> world <b>WebKit</b>', selectAll, {'mac': true, 'win': false}[editingBehavior]);
62 testQueryCommandState("bold", '<b>hello</b><b> world</b>', selectAll, {'mac' : true, 'win': true}[editingBehavior]); 62 testQueryCommandState("bold", '<b>hello</b><b> world</b>', selectAll, {'mac' : true, 'win': true}[editingBehavior]);
63 testQueryCommandState("bold", '<div><b>hello</b></div><p><b> WebKit</b></p>' , selectAll, {'mac': true, 'win': true}[editingBehavior]); 63 testQueryCommandState("bold", '<div><b>hello</b></div><p><b> WebKit</b></p>' , selectAll, {'mac': true, 'win': true}[editingBehavior]);
64 64
65 testQueryCommandState("italic", 'hello', selectAll, {'mac': false, 'win': fa lse}[editingBehavior]); 65 testQueryCommandState("italic", 'hello', selectAll, {'mac': false, 'win': fa lse}[editingBehavior]);
66 testQueryCommandState("italic", '<b>hello</b>', selectAll, {'mac': false, 'w in': false}[editingBehavior]); 66 testQueryCommandState("italic", '<b>hello</b>', selectAll, {'mac': false, 'w in': false}[editingBehavior]);
67 testQueryCommandState("italic", '<i>hello</i>', selectAll, {'mac': true, 'wi n': true}[editingBehavior]); 67 testQueryCommandState("italic", '<i>hello</i>', selectAll, {'mac': true, 'wi n': true}[editingBehavior]);
68 testQueryCommandState("italic", '<i>hello</i> world', selectAll, {'mac': tru e, 'win': false}[editingBehavior]); 68 testQueryCommandState("italic", '<i>hello</i> world', selectAll, {'mac': tru e, 'win': false}[editingBehavior]);
69 testQueryCommandState("italic", 'hello <i>world</i>', selectAll, {'mac': fal se, 'win': false}[editingBehavior]); 69 testQueryCommandState("italic", 'hello <i>world</i>', selectAll, {'mac': fal se, 'win': false}[editingBehavior]);
70 testQueryCommandState("italic", '<i><div>hello world</div></i>', selectAll, {'mac': true, 'win': true}[editingBehavior]); 70 testQueryCommandState("italic", '<i><div>hello world</div></i>', selectAll, {'mac': true, 'win': true}[editingBehavior]);
71 testQueryCommandState("italic", '<div style="font-style: italic">hello <span style="font-style: normal;">hello</span></div>', selectAll, {'mac': true, 'win' : false}[editingBehavior]); 71 testQueryCommandState("italic", '<div style="font-style: italic">hello <span style="font-style: normal;">hello</span></div>', selectAll, {'mac': true, 'win' : false}[editingBehavior]);
72 72
73 testQueryCommandState("subscript", 'hello', selectAll, {'mac': false, 'win': false}[editingBehavior]); 73 testQueryCommandState("subscript", 'hello', selectAll, {'mac': false, 'win': false}[editingBehavior]);
74 testQueryCommandState("subscript", '<sup>hello</sup>', selectAll, {'mac': fa lse, 'win': false}[editingBehavior]); 74 testQueryCommandState("subscript", '<sup>hello</sup>', selectAll, {'mac': fa lse, 'win': false}[editingBehavior]);
75 testQueryCommandState("subscript", '<sub>hello</sub>', selectAll, {'mac': tr ue, 'win': true}[editingBehavior]); 75 testQueryCommandState("subscript", '<sub>hello</sub>', selectAll, {'mac': tr ue, 'win': true}[editingBehavior]);
76 testQueryCommandState("subscript", '<sub>hello</sub> world', selectAll, {'ma c': true, 'win': false}[editingBehavior]); 76 testQueryCommandState("subscript", '<sub>hello</sub> world', selectAll, {'ma c': true, 'win': false}[editingBehavior]);
77 testQueryCommandState("subscript", 'hello <sub>world</sub>', selectAll, {'ma c': false, 'win': false}[editingBehavior]); 77 testQueryCommandState("subscript", 'hello <sub>world</sub>', selectAll, {'ma c': false, 'win': false}[editingBehavior]);
78 testQueryCommandState("subscript", '<div style="vertical-align: sub;">hello world</div>', selectAll, {'mac': true, 'win': true}[editingBehavior]); 78 testQueryCommandState("subscript", '<div style="vertical-align: sub;">hello world</div>', selectAll, {'mac': true, 'win': true}[editingBehavior]);
79 testQueryCommandState("subscript", 'hello <span style="vertical-align: sub;" >world</span> WebKit', selectSecondWord, {'mac': true, 'win': true}[editingBehav ior]); 79 testQueryCommandState("subscript", 'hello <span style="vertical-align: sub;" >world</span> WebKit', selectSecondWord, {'mac': true, 'win': false}[editingBeha vior]);
80 80
81 testQueryCommandState("superscript", 'hello', selectAll, {'mac': false, 'win ': false}[editingBehavior]); 81 testQueryCommandState("superscript", 'hello', selectAll, {'mac': false, 'win ': false}[editingBehavior]);
82 testQueryCommandState("superscript", '<sub>hello</sub>', selectAll, {'mac': false, 'win': false}[editingBehavior]); 82 testQueryCommandState("superscript", '<sub>hello</sub>', selectAll, {'mac': false, 'win': false}[editingBehavior]);
83 testQueryCommandState("superscript", '<sup>hello</sup>', selectAll, {'mac': true, 'win': true}[editingBehavior]); 83 testQueryCommandState("superscript", '<sup>hello</sup>', selectAll, {'mac': true, 'win': true}[editingBehavior]);
84 testQueryCommandState("superscript", '<sup>hello</sup> world', selectAll, {' mac': true, 'win': false}[editingBehavior]); 84 testQueryCommandState("superscript", '<sup>hello</sup> world', selectAll, {' mac': true, 'win': false}[editingBehavior]);
85 testQueryCommandState("superscript", 'hello <sup>world</sup>', selectAll, {' mac': false, 'win': false}[editingBehavior]); 85 testQueryCommandState("superscript", 'hello <sup>world</sup>', selectAll, {' mac': false, 'win': false}[editingBehavior]);
86 testQueryCommandState("superscript", '<span style="vertical-align: super;">h ello</span><span style="vertical-align: sub;">world</span>', selectAll, {'mac': true, 'win': false}[editingBehavior]); 86 testQueryCommandState("superscript", '<span style="vertical-align: super;">h ello</span><span style="vertical-align: sub;">world</span>', selectAll, {'mac': true, 'win': false}[editingBehavior]);
87 testQueryCommandState("superscript", 'hello<span style="vertical-align: supe r;">world</span>', selectAll, {'mac': false, 'win': false}[editingBehavior]); 87 testQueryCommandState("superscript", 'hello<span style="vertical-align: supe r;">world</span>', selectAll, {'mac': false, 'win': false}[editingBehavior]);
88 88
89 testQueryCommandState("underline", 'hello', selectAll, {'mac': false, 'win': false}[editingBehavior]); 89 testQueryCommandState("underline", 'hello', selectAll, {'mac': false, 'win': false}[editingBehavior]);
90 testQueryCommandState("underline", '<s>hello</s>', selectAll, {'mac': false, 'win': false}[editingBehavior]); 90 testQueryCommandState("underline", '<s>hello</s>', selectAll, {'mac': false, 'win': false}[editingBehavior]);
91 testQueryCommandState("underline", '<u>hello</u>', selectAll, {'mac': true, 'win': true}[editingBehavior]); 91 testQueryCommandState("underline", '<u>hello</u>', selectAll, {'mac': true, 'win': true}[editingBehavior]);
92 testQueryCommandState("underline", '<u>hello</u> world', selectAll, {'mac': true, 'win': false}[editingBehavior]); 92 testQueryCommandState("underline", '<u>hello</u> world', selectAll, {'mac': true, 'win': false}[editingBehavior]);
93 testQueryCommandState("underline", 'hello <u>world</u>', selectAll, {'mac': false, 'win': false}[editingBehavior]); 93 testQueryCommandState("underline", 'hello <u>world</u>', selectAll, {'mac': false, 'win': false}[editingBehavior]);
94 testQueryCommandState("underline", '<u><div>hello world</div></u>', selectAl l, {'mac': true, 'win': true}[editingBehavior]); 94 testQueryCommandState("underline", '<u><div>hello world</div></u>', selectAl l, {'mac': true, 'win': true}[editingBehavior]);
95 testQueryCommandState("underline", '<u><s><div>hello world WebKit</div></s>< /u>', selectSecondWord, {'mac': true, 'win': true}[editingBehavior]); 95 testQueryCommandState("underline", '<u><s><div>hello world WebKit</div></s>< /u>', selectSecondWord, {'mac': true, 'win': true}[editingBehavior]);
96 testQueryCommandState("underline", '<s><u>hello</u> world</s> WebKit', selec tSecondWord, {'mac': false, 'win': false}[editingBehavior]); 96 testQueryCommandState("underline", '<s><u>hello</u> world</s> WebKit', selec tSecondWord, {'mac': false, 'win': false}[editingBehavior]);
97 testQueryCommandState("underline", '<u><s>hello</s> world</u> WebKit', selec tSecondWord, {'mac': true, 'win': true}[editingBehavior]); 97 testQueryCommandState("underline", '<u><s>hello</s> world</u> WebKit', selec tSecondWord, {'mac': true, 'win': false}[editingBehavior]);
98 testQueryCommandState("underline", '<s>hello <u>world</s> WebKit</u>', selec tSecondWord, {'mac': true, 'win': true}[editingBehavior]); 98 testQueryCommandState("underline", '<s>hello <u>world</s> WebKit</u>', selec tSecondWord, {'mac': true, 'win': true}[editingBehavior]);
99 99
100 testQueryCommandState("strikeThrough", 'hello', selectAll, {'mac': false, 'w in': false}[editingBehavior]); 100 testQueryCommandState("strikeThrough", 'hello', selectAll, {'mac': false, 'w in': false}[editingBehavior]);
101 testQueryCommandState("strikeThrough", '<u>hello</u>', selectAll, {'mac': fa lse, 'win': false}[editingBehavior]); 101 testQueryCommandState("strikeThrough", '<u>hello</u>', selectAll, {'mac': fa lse, 'win': false}[editingBehavior]);
102 testQueryCommandState("strikeThrough", '<s>hello</s>', selectAll, {'mac': tr ue, 'win': true}[editingBehavior]); 102 testQueryCommandState("strikeThrough", '<s>hello</s>', selectAll, {'mac': tr ue, 'win': true}[editingBehavior]);
103 testQueryCommandState("strikeThrough", '<s>hello</s> world', selectAll, {'ma c': true, 'win': false}[editingBehavior]); 103 testQueryCommandState("strikeThrough", '<s>hello</s> world', selectAll, {'ma c': true, 'win': false}[editingBehavior]);
104 testQueryCommandState("strikeThrough", 'hello <s>world</s>', selectAll, {'ma c': false, 'win': false}[editingBehavior]); 104 testQueryCommandState("strikeThrough", 'hello <s>world</s>', selectAll, {'ma c': false, 'win': false}[editingBehavior]);
105 testQueryCommandState("strikeThrough", '<s><div>hello world</div></s>', sele ctAll, {'mac': true, 'win': true}[editingBehavior]); 105 testQueryCommandState("strikeThrough", '<s><div>hello world</div></s>', sele ctAll, {'mac': true, 'win': true}[editingBehavior]);
106 testQueryCommandState("strikeThrough", '<s><u><div>hello world WebKit</div>< /u></s>', selectSecondWord, {'mac': true, 'win': true}[editingBehavior]); 106 testQueryCommandState("strikeThrough", '<s><u><div>hello world WebKit</div>< /u></s>', selectSecondWord, {'mac': true, 'win': true}[editingBehavior]);
107 testQueryCommandState("strikeThrough", '<u><s>hello</s> world</u> WebKit', s electSecondWord, {'mac': false, 'win': false}[editingBehavior]); 107 testQueryCommandState("strikeThrough", '<u><s>hello</s> world</u> WebKit', s electSecondWord, {'mac': false, 'win': false}[editingBehavior]);
108 testQueryCommandState("strikeThrough", 'hello <s>world WebKit</s>', selectSe condWord, {'mac': true, 'win': true}[editingBehavior]); 108 testQueryCommandState("strikeThrough", 'hello <s>world WebKit</s>', selectSe condWord, {'mac': true, 'win': true}[editingBehavior]);
109 testQueryCommandState("strikeThrough", 'hello <s>world WebKit</s>', selectFi rstTwoWords, {'mac': false, 'win': false}[editingBehavior]); 109 testQueryCommandState("strikeThrough", 'hello <s>world WebKit</s>', selectFi rstTwoWords, {'mac': false, 'win': true}[editingBehavior]);
110 } 110 }
111 111
112 runTests('win'); 112 runTests('win');
113 debug('') 113 debug('')
114 runTests('mac'); 114 runTests('mac');
115 115
116 //document.body.removeChild(testContainer); 116 //document.body.removeChild(testContainer);
117 var successfullyParsed = true; 117 var successfullyParsed = true;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698