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

Unified Diff: third_party/WebKit/LayoutTests/inspector/sass/test-mapping-good.html

Issue 1641893002: DevTools: [SASS] introduce workspace/cssModel adapter for SASS processor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove settimeout from test Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/inspector/sass/test-mapping-good.html
diff --git a/third_party/WebKit/LayoutTests/inspector/sass/test-mapping-good.html b/third_party/WebKit/LayoutTests/inspector/sass/test-mapping-good.html
index 1b3079d47f26b7dfe2ee0b0a6a6ccd0c2097738a..2a8390ff243f58bfc45f27a3fd2f00421453259e 100644
--- a/third_party/WebKit/LayoutTests/inspector/sass/test-mapping-good.html
+++ b/third_party/WebKit/LayoutTests/inspector/sass/test-mapping-good.html
@@ -10,71 +10,42 @@
function test()
{
- var header = InspectorTest.cssModel.styleSheetHeaders().find(header => !!header.sourceMapURL)
- InspectorTest.loadSourceMap(header, onSourceMapLoaded);
- InspectorTest.waitForScriptSource("test-mapping-good.css", onCSSLoaded);
- InspectorTest.waitForScriptSource("test-mapping-good.scss", onSCSSLoaded);
-
- var cssAST;
- var sassModels = new Map();
- var sourceMap;
var mapping;
- function onCSSLoaded(uiSourceCode)
- {
- uiSourceCode.requestContent()
- .then(text => InspectorTest.parseCSS(uiSourceCode.url(), text))
- .then(ast => cssAST = ast)
- .then(maybeCreateMapping);
- }
-
- function onSCSSLoaded(uiSourceCode)
- {
- uiSourceCode.requestContent()
- .then(text => InspectorTest.parseSCSS(uiSourceCode.url(), text))
- .then(ast => sassModels.set(ast.document.url, ast))
- .then(maybeCreateMapping);
- }
-
- function onSourceMapLoaded(sm)
- {
- sourceMap = sm;
- maybeCreateMapping();
- }
+ var header = InspectorTest.cssModel.styleSheetHeaders().find(header => !!header.sourceMapURL);
+ InspectorTest.loadASTMapping(header, onMappingLoaded);
- function maybeCreateMapping()
+ function onMappingLoaded(map)
{
- if (!cssAST || !sassModels.size || !sourceMap)
- return;
- mapping = WebInspector.SASSLiveSourceMap.CSSToSASSMapping.fromSourceMap(sourceMap, cssAST, sassModels);
+ mapping = map;
if (!mapping.isValid()) {
InspectorTest.addResult("ERROR: mapping is not valid.");
InspectorTest.completeTest();
return;
}
- InspectorTest.validateMapping(mapping, cssAST, sassModels);
+ InspectorTest.validateMapping(mapping);
InspectorTest.runTestSuite(testSuite);
}
var testSuite = [
function testCSSRebase(next)
{
- var cssClone = cssAST.clone();
+ var cssClone = mapping.cssAST().clone();
cssClone.rules[0].properties[1].remove();
- var cssDiff = WebInspector.SASSSupport.diffModels(cssAST, cssClone);
+ var cssDiff = WebInspector.SASSSupport.diffModels(mapping.cssAST(), cssClone);
var newMapping = mapping.rebaseForCSSDiff(cssDiff);
if (!newMapping.isValid()) {
InspectorTest.addResult("ERROR: mapping is not valid.");
InspectorTest.completeTest();
return;
}
- InspectorTest.validateMapping(newMapping, cssClone, sassModels);
+ InspectorTest.validateMapping(newMapping);
next();
},
function testSCSSRebase(next)
{
- var sassAST = sassModels.valuesArray()[0];
+ var sassAST = mapping.sassModels().valuesArray()[0];
var sassClone = sassAST.clone();
sassClone.rules[1].properties[2].remove();
sassClone.rules[1].properties[1].remove();
@@ -85,9 +56,7 @@ function test()
InspectorTest.completeTest();
return;
}
- var sassModelsClone = new Map();
- sassModelsClone.set(sassClone.document.url, sassClone);
- InspectorTest.validateMapping(newMapping, cssAST, sassModelsClone);
+ InspectorTest.validateMapping(newMapping);
next();
},
];

Powered by Google App Engine
This is Rietveld 408576698