| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../inspector-test.js"></script> | 3 <script src="../../inspector-test.js"></script> |
| 4 <script src="../../debugger-test.js"></script> | 4 <script src="../../debugger-test.js"></script> |
| 5 <script src="../../elements-test.js"></script> | 5 <script src="../../elements-test.js"></script> |
| 6 <script src="../../workspace-test.js"></script> | 6 <script src="../../workspace-test.js"></script> |
| 7 <script src="../../isolated-filesystem-test.js"></script> | 7 <script src="../../isolated-filesystem-test.js"></script> |
| 8 <script> | 8 <script> |
| 9 function loadStylesheet(line0, line1, line2) | 9 function loadStylesheet(line0, line1, line2) |
| 10 { | 10 { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 var fs = new InspectorTest.TestFileSystem(fileSystemPath); | 34 var fs = new InspectorTest.TestFileSystem(fileSystemPath); |
| 35 fs.root.addFile("foo.css", "#inspected {\n color: red;\n}\n"); | 35 fs.root.addFile("foo.css", "#inspected {\n color: red;\n}\n"); |
| 36 InspectorTest.addResult("Adding file system mapping."); | 36 InspectorTest.addResult("Adding file system mapping."); |
| 37 fs.addFileMapping("http://localhost:8000/inspector/elements/styles/"
, "/"); | 37 fs.addFileMapping("http://localhost:8000/inspector/elements/styles/"
, "/"); |
| 38 fs.reportCreated(fileSystemCreated); | 38 fs.reportCreated(fileSystemCreated); |
| 39 | 39 |
| 40 var uiSourceCode; | 40 var uiSourceCode; |
| 41 | 41 |
| 42 function fileSystemCreated() | 42 function fileSystemCreated() |
| 43 { | 43 { |
| 44 var fileSystemProjectId = WebInspector.FileSystemWorkspaceBindin
g.projectId(fileSystemPath); | 44 var fileSystemProjectId = Bindings.FileSystemWorkspaceBinding.pr
ojectId(fileSystemPath); |
| 45 uiSourceCode = WebInspector.workspace.uiSourceCode(fileSystemPro
jectId, "file:///var/www/foo.css"); | 45 uiSourceCode = Workspace.workspace.uiSourceCode(fileSystemProjec
tId, "file:///var/www/foo.css"); |
| 46 InspectorTest.showUISourceCode(uiSourceCode, didShowScriptSource
); | 46 InspectorTest.showUISourceCode(uiSourceCode, didShowScriptSource
); |
| 47 } | 47 } |
| 48 | 48 |
| 49 function didShowScriptSource(sourceFrame) | 49 function didShowScriptSource(sourceFrame) |
| 50 { | 50 { |
| 51 dumpUISourceCodeContents(); | 51 dumpUISourceCodeContents(); |
| 52 InspectorTest.addResult("Loading stylesheet with sourceURL:"); | 52 InspectorTest.addResult("Loading stylesheet with sourceURL:"); |
| 53 InspectorTest.cssModel.addEventListener(WebInspector.CSSModel.Ev
ents.StyleSheetAdded, stylesheetLoaded); | 53 InspectorTest.cssModel.addEventListener(SDK.CSSModel.Events.Styl
eSheetAdded, stylesheetLoaded); |
| 54 InspectorTest.evaluateInPage("loadStylesheet()"); | 54 InspectorTest.evaluateInPage("loadStylesheet()"); |
| 55 } | 55 } |
| 56 | 56 |
| 57 function stylesheetLoaded(event) | 57 function stylesheetLoaded(event) |
| 58 { | 58 { |
| 59 if (!event.data.sourceURL.includes("foo.css")) | 59 if (!event.data.sourceURL.includes("foo.css")) |
| 60 return; | 60 return; |
| 61 InspectorTest.cssModel.removeEventListener(WebInspector.CSSModel
.Events.StyleSheetAdded, stylesheetLoaded); | 61 InspectorTest.cssModel.removeEventListener(SDK.CSSModel.Events.S
tyleSheetAdded, stylesheetLoaded); |
| 62 InspectorTest.addResult("Stylesheet loaded."); | 62 InspectorTest.addResult("Stylesheet loaded."); |
| 63 InspectorTest.selectNodeAndWaitForStyles("inspected", nodeSelect
ed); | 63 InspectorTest.selectNodeAndWaitForStyles("inspected", nodeSelect
ed); |
| 64 } | 64 } |
| 65 | 65 |
| 66 function nodeSelected() | 66 function nodeSelected() |
| 67 { | 67 { |
| 68 InspectorTest.addResult("Dumping matched rules:"); | 68 InspectorTest.addResult("Dumping matched rules:"); |
| 69 InspectorTest.dumpSelectedElementStyles(true); | 69 InspectorTest.dumpSelectedElementStyles(true); |
| 70 InspectorTest.addResult("Editing styles from elements panel:"); | 70 InspectorTest.addResult("Editing styles from elements panel:"); |
| 71 treeElement = InspectorTest.getMatchedStylePropertyTreeItem("col
or"); | 71 treeElement = InspectorTest.getMatchedStylePropertyTreeItem("col
or"); |
| 72 treeElement.startEditing(); | 72 treeElement.startEditing(); |
| 73 treeElement.nameElement.textContent = "color"; | 73 treeElement.nameElement.textContent = "color"; |
| 74 treeElement.nameElement.dispatchEvent(InspectorTest.createKeyEve
nt("Enter")); | 74 treeElement.nameElement.dispatchEvent(InspectorTest.createKeyEve
nt("Enter")); |
| 75 | 75 |
| 76 // Commit editing. | 76 // Commit editing. |
| 77 treeElement.valueElement.textContent = "green"; | 77 treeElement.valueElement.textContent = "green"; |
| 78 treeElement.valueElement.firstChild.select(); | 78 treeElement.valueElement.firstChild.select(); |
| 79 treeElement.valueElement.dispatchEvent(InspectorTest.createKeyEv
ent("Enter")); | 79 treeElement.valueElement.dispatchEvent(InspectorTest.createKeyEv
ent("Enter")); |
| 80 uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.W
orkingCopyCommitted, stylesEdited, this); | 80 uiSourceCode.addEventListener(Workspace.UISourceCode.Events.Work
ingCopyCommitted, stylesEdited, this); |
| 81 } | 81 } |
| 82 | 82 |
| 83 function stylesEdited() | 83 function stylesEdited() |
| 84 { | 84 { |
| 85 InspectorTest.addResult("Styles edited."); | 85 InspectorTest.addResult("Styles edited."); |
| 86 InspectorTest.addResult("Dumping matched rules:"); | 86 InspectorTest.addResult("Dumping matched rules:"); |
| 87 InspectorTest.dumpSelectedElementStyles(true); | 87 InspectorTest.dumpSelectedElementStyles(true); |
| 88 dumpUISourceCodeContents(); | 88 dumpUISourceCodeContents(); |
| 89 InspectorTest.addResult("All done."); | 89 InspectorTest.addResult("All done."); |
| 90 next(); | 90 next(); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 ]); | 93 ]); |
| 94 }; | 94 }; |
| 95 </script> | 95 </script> |
| 96 </head> | 96 </head> |
| 97 <body onload="runTest()"> | 97 <body onload="runTest()"> |
| 98 <div id="inspected"></div> | 98 <div id="inspected"></div> |
| 99 <p>Tests file system project mappings.</p> | 99 <p>Tests file system project mappings.</p> |
| 100 </body> | 100 </body> |
| 101 </html> | 101 </html> |
| OLD | NEW |