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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/undo/remove-css-property-and-remove-style.html

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 <script src="../../resources/dump-as-markup.js"></script> 1 <script src="../../resources/dump-as-markup.js"></script>
2 <p>This tests removing style attribute after removing CSS property. Undo should bring back the CSS property we removed.</p> 2 <p>This tests removing style after removing CSS property. Undo should bring back the CSS property we removed.</p>
3 <div id="test" contenteditable><span style="font-weight: 900;">test</span></div> 3 <div id="test" contenteditable><span style="font-weight: 900;">test</span></div>
4 <script> 4 <script>
5 5
6 Markup.description('This tests removing style attribute after removing CSS prope rty. Undo should bring back the CSS property we removed.'); 6 Markup.description('This tests removing style after removing CSS property. Undo should bring back the CSS property we removed.');
7 7
8 Markup.dump('test', 'Initially "test" should be bold wrapped with a span'); 8 Markup.dump('test', 'Initially "test" should be bold wrapped with a span');
9 window.getSelection().selectAllChildren(test); 9 window.getSelection().selectAllChildren(test);
10 document.execCommand('bold', false, null); 10 document.execCommand('bold', false, null);
11 Markup.dump('test', 'Unbolding should remove the CSS style and also remove the s pan'); 11 Markup.dump('test', 'Unbolding should remove the CSS style and also remove the s pan');
12 12
13 document.execCommand('undo', false, null); 13 document.execCommand('undo', false, null);
14 Markup.dump('test', 'Undo should bring back both the span and style attribute so that "test" is once again bold'); 14 Markup.dump('test', 'Undo should bring back both the span and style so that "tes t" is once again bold');
15 15
16 document.execCommand('redo', false, null); 16 document.execCommand('redo', false, null);
17 Markup.dump('test', 'Redo should unbold "test" and there should be no span'); 17 Markup.dump('test', 'Redo should unbold "test" and there should be no span');
18 18
19 document.execCommand('undo', false, null); 19 document.execCommand('undo', false, null);
20 Markup.dump('test', 'Undo once more'); 20 Markup.dump('test', 'Undo once more');
21 21
22 document.getElementById('test').innerHTML = '<span style="font-weight: 900;">tes t</span>'; 22 document.getElementById('test').innerHTML = '<span style="font-weight: 900;">tes t</span>';
23 var span = document.getElementById('test').firstChild; 23 var span = document.getElementById('test').firstChild;
24 span.id = 'test_span'; 24 span.id = 'test_span';
25 span.title = 'hello, world'; 25 span.title = 'hello, world';
26 window.getSelection().selectAllChildren(test); 26 window.getSelection().selectAllChildren(test);
27 Markup.dump('test', 'Reset, and added id and title'); 27 Markup.dump('test', 'Reset, and added id and title');
28 28
29 document.execCommand('bold', false, null); 29 document.execCommand('bold', false, null);
30 Markup.dump('test', 'Unbolding should remove the CSS style but shouldn\'t remove the span'); 30 Markup.dump('test', 'Unbolding should remove the CSS style but shouldn\'t remove the span');
31 31
32 document.execCommand('undo', false, null); 32 document.execCommand('undo', false, null);
33 Markup.dump('test', 'Undo should restore the style attribute and "test" should b e bold'); 33 Markup.dump('test', 'Undo should restore the style and "test" should be bold');
34 34
35 document.execCommand('redo', false, null); 35 document.execCommand('redo', false, null);
36 Markup.dump('test', 'Redo should remove the style attribute again'); 36 Markup.dump('test', 'Redo should remove the style again');
37 37
38 document.getElementById('test').innerHTML = '<span style="font-weight: 900;">tes t</span>'; 38 document.getElementById('test').innerHTML = '<span style="font-weight: 900;">tes t</span>';
39 var span = document.getElementById('test').firstChild; 39 var span = document.getElementById('test').firstChild;
40 span.style.color = 'blue'; 40 span.style.color = 'blue';
41 window.getSelection().selectAllChildren(test); 41 window.getSelection().selectAllChildren(test);
42 Markup.dump('test', 'Reset, and added color:blue'); 42 Markup.dump('test', 'Reset, and added color:blue');
43 43
44 document.execCommand('bold', false, null); 44 document.execCommand('bold', false, null);
45 Markup.dump('test', 'Unbolding should remove the font-weight but shouldn\'t remo ve the style attribute'); 45 Markup.dump('test', 'Unbolding should remove the font-weight but shouldn\'t remo ve the style ');
46 46
47 document.execCommand('undo', false, null); 47 document.execCommand('undo', false, null);
48 Markup.dump('test', 'Undo should reset the style attribute so that "test" is bot h bold and blue'); 48 Markup.dump('test', 'Undo should reset the style so that "test" is both bold and blue');
49 49
50 document.execCommand('redo', false, null); 50 document.execCommand('redo', false, null);
51 Markup.dump('test', 'Redo should only remove font-weight and leave "test" blue') ; 51 Markup.dump('test', 'Redo should only remove font-weight and leave "test" blue') ;
52 52
53 document.execCommand('foreColor', false, "#000000"); 53 document.execCommand('foreColor', false, "#000000");
54 Markup.dump('test', 'Setting the forecolor to black should remove both the style attribute and the span'); 54 Markup.dump('test', 'Setting the forecolor to black should remove both the style and the span');
55 55
56 document.execCommand('undo', false, null); 56 document.execCommand('undo', false, null);
57 Markup.dump('test', 'Undo should make "test" blue again'); 57 Markup.dump('test', 'Undo should make "test" blue again');
58 58
59 </script> 59 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698