4 <p>This test ensures WebKit merges text decorations in the typing style and the focused element's style property.</p>
5 <div id="test" contenteditable>hello world</div>
9 testRunner.dumpAsText();
11 function queryTextDecorations() {
13 if (document.queryCommandState('underline'))
14 result += 'underline';
15 if (document.queryCommandState('strikeThrough')) {
18 result += 'strikeThrough';
23 function runTest(command, inlineStyle) {
24 document.writeln('Test to set ' + command + ' by typing command and add ' + inlineStyle + ' as inline style:');
25 var test = document.getElementById('test');
26 test.style.textDecoration = null;
27 window.getSelection().collapse(test, 0);
28 document.execCommand(command, false, null);
29 test.style.textDecoration = inlineStyle;
30 if (queryTextDecorations() != 'underline strikeThrough')
31 document.writeln('FAIL: got "' + queryTextDecorations() + '" but expected "underline strikeThrough"');
33 document.writeln('PASS');
37 runTest('strikeThrough', 'underline');
38 window.getSelection().collapse(test, 1);
39 runTest('underline', 'line-through');