| OLD | NEW |
| 1 description('Test to make sure we push down inline styles properly.'); | 1 description('Test to make sure we push down inline styles properly.'); |
| 2 | 2 |
| 3 if (window.internals) | 3 if (window.internals) |
| 4 internals.settings.setEditingBehavior('mac'); | 4 internals.settings.setEditingBehavior('mac'); |
| 5 var testContainer = document.createElement("div"); | 5 var testContainer = document.createElement("div"); |
| 6 testContainer.contentEditable = true; | 6 testContainer.contentEditable = true; |
| 7 document.body.appendChild(testContainer); | 7 document.body.appendChild(testContainer); |
| 8 | 8 |
| 9 function testSingleToggle(toggleCommand, selector, initialContents, expectedCont
ents) | 9 function testSingleToggle(toggleCommand, selector, initialContents, expectedCont
ents) |
| 10 { | 10 { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 return 'second word'; | 42 return 'second word'; |
| 43 } | 43 } |
| 44 | 44 |
| 45 function selectLastTwoWords(container) { | 45 function selectLastTwoWords(container) { |
| 46 window.getSelection().collapse(container, container.childNodes.length); | 46 window.getSelection().collapse(container, container.childNodes.length); |
| 47 window.getSelection().modify('extend', 'backward', 'word'); | 47 window.getSelection().modify('extend', 'backward', 'word'); |
| 48 window.getSelection().modify('extend', 'backward', 'word'); | 48 window.getSelection().modify('extend', 'backward', 'word'); |
| 49 return 'last two words'; | 49 return 'last two words'; |
| 50 } | 50 } |
| 51 | 51 |
| 52 testSingleToggle("bold", selectFirstWord, '<b><div>hello</div> world</b>', '<div
>hello</div><b> world</b>'); | 52 testSingleToggle("bold", selectFirstWord, '<b><div>hello</div> world</b>', '<div
style="">hello</div><b> world</b>'); |
| 53 testSingleToggle("bold", selectFirstWord, '<b><div>hello</div>world</b>', '<div>
hello</div><b>world</b>'); | 53 testSingleToggle("bold", selectFirstWord, '<b><div>hello</div>world</b>', '<div
style="">hello</div><b>world</b>'); |
| 54 testSingleToggle("bold", selectFirstWord, '<b><div>hello</div><em>world</em></b>
', '<div>hello</div><em style="font-weight: bold;">world</em>'); | 54 testSingleToggle("bold", selectFirstWord, '<b><div>hello</div><em>world</em></b>
', '<div style="">hello</div><em style="font-weight: bold;">world</em>'); |
| 55 testSingleToggle("bold", selectSecondWord, '<b>hello <div>world</div></b>', '<b>
hello </b><div>world</div>'); | 55 testSingleToggle("bold", selectSecondWord, '<b>hello <div>world</div></b>', '<b>
hello </b><div style="">world</div>'); |
| 56 testSingleToggle("bold", selectSecondWord, '<b><em>hello</em> <div>world</div></
b>', '<em style="font-weight: bold;">hello</em> <div>world</div>'); | 56 testSingleToggle("bold", selectSecondWord, '<b><em>hello</em> <div>world</div></
b>', '<em style="font-weight: bold;">hello</em> <div style="">world</div>'); |
| 57 testSingleToggle("bold", selectAll, '<b> <div>text</div> </b>', ' <div>text</div
> '); | 57 testSingleToggle("bold", selectAll, '<b> <div>text</div> </b>', ' <div style="">
text</div> '); |
| 58 testSingleToggle("bold", selectAll, '<b><strike><div>text</div></strike></b>', '
<strike><div>text</div></strike>'); | 58 testSingleToggle("bold", selectAll, '<b><strike><div>text</div></strike></b>', '
<strike style=""><div style="">text</div></strike>'); |
| 59 testSingleToggle("bold", selectFirstWord, '<b><div>hello</div><div>world</div></
b>', '<div>hello</div><div style="font-weight: bold;">world</div>'); | 59 testSingleToggle("bold", selectFirstWord, '<b><div>hello</div><div>world</div></
b>', '<div style="">hello</div><div style="font-weight: bold;">world</div>'); |
| 60 testSingleToggle("bold", selectFirstWord, '<b><div>hello</div><div style="font-w
eight: normal;">world</div>webkit</b>', '<div>hello</div><div style="font-weight
: normal;">world</div><b>webkit</b>'); | 60 testSingleToggle("bold", selectFirstWord, '<b><div>hello</div><div style="font-w
eight: normal;">world</div>webkit</b>', '<div style="">hello</div><div style="fo
nt-weight: normal;">world</div><b>webkit</b>'); |
| 61 testSingleToggle("bold", selectSecondWord, '<b style="font-style: italic;">hello
world</b>', '<b style="font-style: italic;">hello</b><span style="font-style: i
talic;"> world</span>'); | 61 testSingleToggle("bold", selectSecondWord, '<b style="font-style: italic;">hello
world</b>', '<b style="font-style: italic;">hello</b><span style="font-style: i
talic;"> world</span>'); |
| 62 | 62 |
| 63 testSingleToggle("underline", selectSecondWord, '<u>hello <b>world</b> webkit</u
>', '<u>hello</u> <b>world</b><u> webkit</u>'); | 63 testSingleToggle("underline", selectSecondWord, '<u>hello <b>world</b> webkit</u
>', '<u>hello</u> <b style="">world</b><u> webkit</u>'); |
| 64 testSingleToggle("underline", selectLastTwoWords, '<u>hello <b>world</b> webkit<
/u>', '<u>hello </u><b>world</b> webkit'); | 64 testSingleToggle("underline", selectLastTwoWords, '<u>hello <b>world</b> webkit<
/u>', '<u>hello </u><b style="">world</b> webkit'); |
| 65 testSingleToggle("underline", selectLastTwoWords, '<u>hello <b>world webkit</b><
/u>', '<u>hello </u><b>world webkit</b>'); | 65 testSingleToggle("underline", selectLastTwoWords, '<u>hello <b>world webkit</b><
/u>', '<u>hello </u><b style="">world webkit</b>'); |
| 66 testSingleToggle("underline", selectSecondWord, '<u>hello <b>world webkit</b></u
>', '<u>hello</u> <b>world<u> webkit</u></b>'); | 66 testSingleToggle("underline", selectSecondWord, '<u>hello <b>world webkit</b></u
>', '<u>hello</u> <b style="">world<u> webkit</u></b>'); |
| 67 testSingleToggle("underline", selectSecondWord, '<u><b>hello world</b> webkit</u
>', '<b><u>hello</u> world</b><u> webkit</u>'); | 67 testSingleToggle("underline", selectSecondWord, '<u><b>hello world</b> webkit</u
>', '<b style=""><u>hello</u> world</b><u> webkit</u>'); |
| 68 testSingleToggle("underline", selectSecondWord, '<u><strike>hello world</strike>
</u>', '<strike><u>hello</u> world</strike>'); | 68 testSingleToggle("underline", selectSecondWord, '<u><strike>hello world</strike>
</u>', '<strike style=""><u>hello</u> world</strike>'); |
| 69 testSingleToggle("underline", selectSecondWord, '<u><strike>hello world webkit</
strike></u>', '<strike><u>hello</u> world<u> webkit</u></strike>'); | 69 testSingleToggle("underline", selectSecondWord, '<u><strike>hello world webkit</
strike></u>', '<strike style=""><u>hello</u> world<u> webkit</u></strike>'); |
| 70 testSingleToggle("underline", selectSecondWord, '<u><strike>hello world</strike>
webkit</u>', '<strike><u>hello</u> world</strike><u> webkit</u>'); | 70 testSingleToggle("underline", selectSecondWord, '<u><strike>hello world</strike>
webkit</u>', '<strike style=""><u>hello</u> world</strike><u> webkit</u>'); |
| 71 testSingleToggle("underline", selectSecondWord, '<u>hello <em><code>world webkit
</code></em> rocks</u>', '<u>hello</u> <em><code>world<u> webkit</u></code></em>
<u> rocks</u>'); | 71 testSingleToggle("underline", selectSecondWord, '<u>hello <em><code>world webkit
</code></em> rocks</u>', '<u>hello</u> <em style=""><code style="">world<u> webk
it</u></code></em><u> rocks</u>'); |
| 72 | 72 |
| 73 testSingleToggle("strikeThrough", selectAll, '<s style="color: blue;">hello worl
d</strike>', '<span style="color: blue;">hello world</span>'); | 73 testSingleToggle("strikeThrough", selectAll, '<s style="color: blue;">hello worl
d</strike>', '<span style="color: blue;">hello world</span>'); |
| 74 testSingleToggle("strikeThrough", selectFirstWord, '<s style="color: blue;"><div
>hello</div> <b>world</b> webkit</strike>', '<span style="color: blue;"><div>hel
lo</div> <b style="text-decoration-line: line-through;">world</b><strike> webkit
</strike></span>'); | 74 testSingleToggle("strikeThrough", selectFirstWord, '<s style="color: blue;"><div
>hello</div> <b>world</b> webkit</strike>', '<span style="color: blue;"><div sty
le="">hello</div> <b style="text-decoration-line: line-through;">world</b><strik
e> webkit</strike></span>'); |
| 75 | 75 |
| 76 document.body.removeChild(testContainer); | 76 document.body.removeChild(testContainer); |
| 77 | 77 |
| 78 var successfullyParsed = true; | 78 var successfullyParsed = true; |
| OLD | NEW |