Skip to content

Commit 74a70fd

Browse files
committed
test: unit tests for new css code hints
1 parent bb19286 commit 74a70fd

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/extensions/default/CSSCodeHints/unittests.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,17 @@ define(function (require, exports, module) {
261261
expect(testDocument.getLine(13)).toBe(" display: block");
262262
});
263263

264+
it("should insert full prop-value hint", function () {
265+
testDocument.replaceRange(";", { line: 12, ch: 5 });
266+
testEditor.setCursorPos({ line: 13, ch: 5 }); // cursor after 'display: '
267+
selectHint(CSSCodeHints.cssPropHintProvider, "display: block;");
268+
expect(testDocument.getLine(13)).toBe(" display: block;: "); // the : comes from existing location
269+
});
270+
264271
it("should insert prop-name directly after semicolon", function () {
265272
testEditor.setCursorPos({ line: 10, ch: 19 }); // cursor after red;
266-
selectHint(CSSCodeHints.cssPropHintProvider, "align-content");
267-
expect(testDocument.getLine(10)).toBe(" border-color: red;align-content: ");
273+
selectHint(CSSCodeHints.cssPropHintProvider, "display");
274+
expect(testDocument.getLine(10)).toBe(" border-color: red;display: ");
268275
});
269276

270277
it("should insert nothing but the closure(semicolon) if prop-value is fully written", function () {
@@ -277,9 +284,9 @@ define(function (require, exports, module) {
277284

278285
it("should insert prop-name before an existing one", function () {
279286
testEditor.setCursorPos({ line: 10, ch: 1 }); // cursor before border-color:
280-
selectHint(CSSCodeHints.cssPropHintProvider, "float");
281-
expect(testDocument.getLine(10)).toBe(" float: border-color: red;");
282-
expectCursorAt({ line: 10, ch: 8 });
287+
selectHint(CSSCodeHints.cssPropHintProvider, "margin");
288+
expect(testDocument.getLine(10)).toBe(" margin: border-color: red;");
289+
expectCursorAt({ line: 10, ch: 9 });
283290
});
284291

285292
it("should insert prop-name before an existing one when invoked with an implicit character", function () {

0 commit comments

Comments
 (0)