Skip to content

Commit 93b1581

Browse files
committed
test: color preview after code beautify integration tests
1 parent 5006c67 commit 93b1581

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

test/spec/Extn-CSSColorPreview-integ-test.js

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,42 @@ define(function (require, exports, module) {
179179
await __PR.closeFile();
180180
});
181181

182-
// todo test beautify, code changes, code changes at end of file, toggle color edit
182+
function _verifyExpectedColors(editor, lines) {
183+
let gutterMarker = editor.getGutterMarker(lines[0], GUTTER_NAME);
184+
__PR.validateEqual(areColorsEqual($(gutterMarker), "blue"), true);
185+
gutterMarker = editor.getGutterMarker(lines[1], GUTTER_NAME);
186+
__PR.validateEqual(areColorsEqual($(gutterMarker), "#00ff8c"), true);
187+
188+
// multiple colors
189+
validateMultipleColors(editor, lines[2], ["#00ff8c", "red"]);
190+
validateMultipleColors(editor, lines[3], ["#b7ff00", "green", "#3e4395"]);
191+
validateMultipleColors(editor, lines[4], ["#ff0090", "#802095", "#954e3e", "#454e3e"]);
192+
validateMultipleColors(editor, lines[5], ["#ff0090", "#802095", "#954e3e", "#454e3e"]);
193+
}
194+
195+
it(`should show color previews after beautify HTML code in ${fileName}`, async function () {
196+
if(["a.php", "a.jsx", "a.tsx"].includes(fileName) || fileName === "a.sass"){
197+
// the test sass, jsx, tsx and php files cant be beautified, so ignoring for now
198+
return;
199+
}
200+
const editor = await init();
201+
await __PR.execCommand(__PR.Commands.EDIT_BEAUTIFY_CODE);
202+
if(baseFileName === "base.css"){
203+
await __PR.awaitsFor(()=>{
204+
return editor.getLine(0) === ".class-one {";
205+
}, "for beautify complete");
206+
_verifyExpectedColors(editor, [8, 12, 15, 18, 21, 24]);
207+
await __PR.closeFile();
208+
return;
209+
}
210+
await __PR.awaitsFor(()=>{
211+
return editor.getLine(2) === " <head>";
212+
}, "for beautify complete");
213+
_verifyExpectedColors(editor, [8, 12, 13, 14, 15, 16]);
214+
await __PR.closeFile();
215+
});
216+
217+
// todo test code changes, code changes at end of file, toggle color edit
183218
}
184219

185220
const htmlFiles = ["a.html", "a.htm", "a.xhtml", "a.php", "a.jsp", "a.jsx", "a.tsx"];

0 commit comments

Comments
 (0)