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

Side by Side Diff: LayoutTests/inspector-protocol/css/css-set-property-text-inline.html

Issue 211193006: DevTools: [CSS] use setStyleText as undo action for setPropertyText (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add testcase Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script>
4 <script type="text/javascript" src="css-protocol-test.js"></script>
5 <script type="text/javascript">
6 function test()
7 {
8 var setPropertyText;
9 var verifyProtocolError;
10 var dumpStyleSheet;
11
12 InspectorTest.sendCommandOrDie("CSS.enable", {}, onCSSEnabled);
13
14 function onCSSEnabled()
15 {
16 InspectorTest.requestNodeId("#reddiv", onNodeRecieved);
17 }
18
19 function onNodeRecieved(nodeId)
20 {
21 InspectorTest.sendCommandOrDie("CSS.getInlineStylesForNode", {
22 nodeId: nodeId,
23 }, onInlineStyleRecieved);
24 }
25
26 function onInlineStyleRecieved(result)
27 {
28 var styleSheetId = result.inlineStyle.styleId.styleSheetId;
29 setPropertyText = InspectorTest.setPropertyText.bind(InspectorTest, styl eSheetId, false);
30 verifyProtocolError = InspectorTest.setPropertyText.bind(InspectorTest, styleSheetId, true);
31 dumpStyleSheet = InspectorTest.dumpStyleSheetText.bind(null, styleSheetI d);
32 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styleSheetId }, onInitialStyleSheetText);
33 }
34
35 function onInitialStyleSheetText(result)
36 {
37 InspectorTest.log("==== Initial style sheet text ====");
38 InspectorTest.log(result.text);
39 InspectorTest.runTestSuite(testSuite);
40 }
41
42 var testSuite = [
43 function testEditProperty(next)
44 {
45 setPropertyText({
46 styleIndex: 0,
47 propertyIndex: 0,
48 overwrite: true,
49 text: "content: 'EDITED PROPERTY';"
50 }, InspectorTest.undoAndNext(next));
51 },
52
53 function testBreakingCommentEditProperty(next)
54 {
55 verifyProtocolError({
56 styleIndex: 0,
57 propertyIndex: 0,
58 overwrite: true,
59 text: "/*<--OPENED COMMENT"
60 }, next);
61 },
62
63 function testInsertFirstProperty(next)
64 {
65 setPropertyText({
66 styleIndex: 0,
67 propertyIndex: 0,
68 overwrite: false,
69 text: "content: 'INSERTED PROPERTY';"
70 }, InspectorTest.undoAndNext(next));
71 },
72
73 function testInsertMultipleProperties(next)
74 {
75 setPropertyText({
76 styleIndex: 0,
77 propertyIndex: 0,
78 overwrite: true,
79 text: "content: 'INSERTED #1';content: 'INSERTED #2';"
80 }, InspectorTest.undoAndNext(next));
81 },
82
83 function testInsertLastProperty(next)
84 {
85 setPropertyText({
86 styleIndex: 0,
87 propertyIndex: 2,
88 overwrite: false,
89 text: "content: 'INSERTED PROPERTY';"
90 }, InspectorTest.undoAndNext(next));
91 },
92 ];
93 }
94
95 </script>
96 </head>
97 <body onload="runTest();">
98 <div id="reddiv" style="color: red; border: 0px;">Some red text goes here</d iv>
99 </body>
100 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698