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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/style/script-tests/push-down-inline-styles.js

Issue 2800723002: Ensure we never remove the style attribute when syncing it from CSSOM. (Closed)
Patch Set: Nits Created 3 years, 8 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 we push down inline styles properly.'); 1 description('Test to make sure we push down inline styles properly.');
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 testSingleToggle(toggleCommand, initialContents, expectedContents) 7 function testSingleToggle(toggleCommand, initialContents, expectedContents)
8 { 8 {
9 testContainer.innerHTML = initialContents; 9 testContainer.innerHTML = initialContents;
10 if (document.getElementById('test')) 10 if (document.getElementById('test'))
11 window.getSelection().selectAllChildren(document.getElementById('test')) ; 11 window.getSelection().selectAllChildren(document.getElementById('test')) ;
12 else 12 else
13 window.getSelection().selectAllChildren(testContainer); 13 window.getSelection().selectAllChildren(testContainer);
14 document.execCommand('styleWithCSS', false, 'false'); 14 document.execCommand('styleWithCSS', false, 'false');
15 document.execCommand(toggleCommand, false, null); 15 document.execCommand(toggleCommand, false, null);
16 if (testContainer.innerHTML === expectedContents) { 16 if (testContainer.innerHTML === expectedContents) {
17 testPassed(toggleCommand + " converted " + initialContents + " to " + ex pectedContents); 17 testPassed(toggleCommand + " converted " + initialContents + " to " + ex pectedContents);
18 } else { 18 } else {
19 testFailed(toggleCommand + " converted " + initialContents + " to " + te stContainer.innerHTML + ", expected " + expectedContents); 19 testFailed(toggleCommand + " converted " + initialContents + " to " + te stContainer.innerHTML + ", expected " + expectedContents);
20 } 20 }
21 } 21 }
22 22
23 23
24 testSingleToggle("bold", '<span style="font-weight: 900;"> <div>text</div> </spa n>', ' <div>text</div> '); 24 testSingleToggle("bold", '<span style="font-weight: 900;"> <div>text</div> </spa n>', ' <div style="">text</div> ');
25 testSingleToggle("bold", '<span style="font-weight: 900;"><div>text</div></span> ', '<div>text</div>'); 25 testSingleToggle("bold", '<span style="font-weight: 900;"><div>text</div></span> ', '<div style="">text</div>');
26 testSingleToggle("bold", '<span style="font-weight: 900;"><div id="test">hello</ div><div>world</div></span>', '<div id="test">hello</div><div style="font-weight : 900;">world</div>'); 26 testSingleToggle("bold", '<span style="font-weight: 900;"><div id="test">hello</ div><div>world</div></span>', '<div id="test" style="">hello</div><div style="fo nt-weight: 900;">world</div>');
27 testSingleToggle("bold", '<div style="font-weight: bold;">hello<div id="test">wo rld</div></div>', '<div><b>hello</b><div id="test">world</div></div>'); 27 testSingleToggle("bold", '<div style="font-weight: bold;">hello<div id="test">wo rld</div></div>', '<div style=""><b>hello</b><div id="test" style="">world</div> </div>');
28 testSingleToggle("bold", '<span style="font-weight: bold;">hello<span id="test"> world</div></div>', '<b>hello</b><span id="test">world</span>'); 28 testSingleToggle("bold", '<span style="font-weight: bold;">hello<span id="test"> world</div></div>', '<b>hello</b><span id="test" style="">world</span>');
29 testSingleToggle("bold", '<span style="font-style: italic; font-weight: bold;">h ello<span id="test">world</div></div>', '<span style="font-style: italic;"><b>he llo</b><span id="test">world</span></span>'); 29 testSingleToggle("bold", '<span style="font-style: italic; font-weight: bold;">h ello<span id="test">world</div></div>', '<span style="font-style: italic;"><b>he llo</b><span id="test" style="">world</span></span>');
30 testSingleToggle("bold", '<span style="font-weight: bold;"><div id="test">hello< /div><div style="font-weight: normal;"><div>world</div>webkit</div>', '<div id=" test">hello</div><div>world</div>webkit'); 30 testSingleToggle("bold", '<span style="font-weight: bold;"><div id="test">hello< /div><div style="font-weight: normal;"><div>world</div>webkit</div>', '<div id=" test">hello</div><div>world</div>webkit');
31 testSingleToggle("italic", '<span style="font-style: italic;"><div>hello</div></ span>', '<div>hello</div>'); 31 testSingleToggle("italic", '<span style="font-style: italic;"><div>hello</div></ span>', '<div style="">hello</div>');
32 testSingleToggle("italic", '<span style="font-style: italic;"><div id="test">hel lo</div><span style="font-style: oblique;">world</span>', '<div id="test">hello< /div><span style="font-style: oblique;">world</span>'); 32 testSingleToggle("italic", '<span style="font-style: italic;"><div id="test">hel lo</div><span style="font-style: oblique;">world</span>', '<div id="test" style= "">hello</div><span style="font-style: oblique;">world</span>');
33 testSingleToggle("italic", '<span style="font-style: italic; font-weight: bold;" ><div>hello</div></span>', '<span style="font-weight: bold;"><div>hello</div></s pan>'); 33 testSingleToggle("italic", '<span style="font-style: italic; font-weight: bold;" ><div>hello</div></span>', '<span style="font-weight: bold;"><div style="">hello </div></span>');
34 testSingleToggle("italic", '<span style="font-style: italic; text-decoration: li ne-through;"><div>hello</div></span>', '<span style="text-decoration: line-throu gh;"><div>hello</div></span>'); 34 testSingleToggle("italic", '<span style="font-style: italic; text-decoration: li ne-through;"><div>hello</div></span>', '<span style="text-decoration: line-throu gh;"><div style="">hello</div></span>');
35 testSingleToggle("italic", '<span style="font-style: italic;">hello<div id="test ">world</div><blockquote>webkit</blockquote></span>', '<i>hello</i><div id="test ">world</div><blockquote style="font-style: italic;">webkit</blockquote>'); 35 testSingleToggle("italic", '<span style="font-style: italic;">hello<div id="test ">world</div><blockquote>webkit</blockquote></span>', '<i>hello</i><div id="test " style="">world</div><blockquote style="font-style: italic;">webkit</blockquote >');
36 testSingleToggle("italic", '<span style="font-style: italic;">hello <span id="te st">world</span> webkit</span>', '<i>hello </i><span id="test">world</span><i> w ebkit</i>'); 36 testSingleToggle("italic", '<span style="font-style: italic;">hello <span id="te st">world</span> webkit</span>', '<i>hello </i><span id="test" style="">world</s pan><i> webkit</i>');
37 testSingleToggle("underline", '<span style="text-decoration: underline;"><div id ="test">hello</div>world</span>', '<div id="test">hello</div><u>world</u>'); 37 testSingleToggle("underline", '<span style="text-decoration: underline;"><div id ="test">hello</div>world</span>', '<div id="test" style="">hello</div><u>world</ u>');
38 testSingleToggle("underline", '<span style="text-decoration: underline;"><div id ="test">hello</div><blockquote>world<br>webkit</blockquote></span>', '<div id="t est">hello</div><blockquote style="text-decoration-line: underline;">world<br>we bkit</blockquote>'); 38 testSingleToggle("underline", '<span style="text-decoration: underline;"><div id ="test">hello</div><blockquote>world<br>webkit</blockquote></span>', '<div id="t est" style="">hello</div><blockquote style="text-decoration-line: underline;">wo rld<br>webkit</blockquote>');
39 testSingleToggle("underline", '<span style="text-decoration: underline;">hello<d iv id="test">world</div>webkit</u>', '<u>hello</u><div id="test">world</div><u>w ebkit</u>'); 39 testSingleToggle("underline", '<span style="text-decoration: underline;">hello<d iv id="test">world</div>webkit</u>', '<u>hello</u><div id="test" style="">world< /div><u>webkit</u>');
40 testSingleToggle("underline", 40 testSingleToggle("underline",
41 '<div style="text-decoration: underline;"><div>hello</span></div><div id="te st">webkit</div><span style="font-style: italic;">rocks</span>', 41 '<div style="text-decoration: underline;"><div>hello</span></div><div id="te st">webkit</div><span style="font-style: italic;">rocks</span>',
42 '<div><div style="text-decoration-line: underline;">hello</span></div><div i d="test">webkit</div><u><span style="font-style: italic;">rocks</span></u></div> '); 42 '<div><div style="text-decoration-line: underline;">hello</span></div><div i d="test" style="">webkit</div><u><span style="font-style: italic;">rocks</span>< /u></div>');
43 testSingleToggle("underline", '<span style="text-decoration-line: underline;"><d iv style="text-decoration-line: line-through;">hello</div><div id="test">world</ div></span>', '<div style="text-decoration-line: underline line-through;">hello< /div><div id="test">world</div>'); 43 testSingleToggle("underline", '<span style="text-decoration-line: underline;"><d iv style="text-decoration-line: line-through;">hello</div><div id="test">world</ div></span>', '<div style="text-decoration-line: underline line-through;">hello< /div><div id="test" style="">world</div>');
44 testSingleToggle("strikeThrough", '<span style="text-decoration-line: line-throu gh;"><div id="test">hello</div><div style="text-decoration-line: underline;">wor ld</div></span>', '<div id="test">hello</div><div style="text-decoration-line: l ine-through underline;">world</div>'); 44 testSingleToggle("strikeThrough", '<span style="text-decoration-line: line-throu gh;"><div id="test">hello</div><div style="text-decoration-line: underline;">wor ld</div></span>', '<div id="test" style="">hello</div><div style="text-decoratio n-line: line-through underline;">world</div>');
45 45
46 document.body.removeChild(testContainer); 46 document.body.removeChild(testContainer);
47 47
48 var successfullyParsed = true; 48 var successfullyParsed = true;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698