diff --git a/extensions/emmet/src/test/wrapWithAbbreviation.test.ts b/extensions/emmet/src/test/wrapWithAbbreviation.test.ts
index fa15a678751..a396ec26e7b 100644
--- a/extensions/emmet/src/test/wrapWithAbbreviation.test.ts
+++ b/extensions/emmet/src/test/wrapWithAbbreviation.test.ts
@@ -150,220 +150,127 @@ suite('Tests for Wrap with Abbreviations', () => {
`;
-
- return withRandomFileEditor(contents, 'html', (editor, _) => {
- editor.selections = [new Selection(2, 0, 2, 0)];
- const promise = wrapWithAbbreviation({ abbreviation: 'li.hello|c' });
- if (!promise) {
- assert.equal(1, 2, 'Wrap returned undefined instead of promise.');
- return Promise.resolve();
- }
- return promise.then(() => {
- assert.equal(editor.document.getText(), expectedContents);
- return Promise.resolve();
- });
+ return testWrapWithAbbreviation([new Selection(2, 0, 2, 0)], 'li.hello|c', expectedContents, contents);
});
-});
-test('Wrap with abbreviation entire node when cursor is on opening tag', () => {
- const contents = `
-
- hello
-
-`;
- const expectedContents = `
-
+ test('Wrap with abbreviation entire node when cursor is on opening tag', () => {
+ const contents = `
hello
-
-`;
-
- return withRandomFileEditor(contents, 'html', (editor, _) => {
- editor.selections = [new Selection(1, 1, 1, 1)];
- const promise = wrapWithAbbreviation({ abbreviation: 'div' });
- if (!promise) {
- assert.equal(1, 2, 'Wrap returned undefined instead of promise.');
- return Promise.resolve();
- }
- return promise.then(() => {
- assert.equal(editor.document.getText(), expectedContents);
- return Promise.resolve();
- });
+ `;
+ const expectedContents = `
+
+ `;
+ return testWrapWithAbbreviation([new Selection(1, 1, 1, 1)], 'div', expectedContents, contents);
});
-});
-test('Wrap with abbreviation entire node when cursor is on closing tag', () => {
- const contents = `
-
- hello
-
-`;
- const expectedContents = `
-
+ test('Wrap with abbreviation entire node when cursor is on closing tag', () => {
+ const contents = `
hello
-
-`;
-
- return withRandomFileEditor(contents, 'html', (editor, _) => {
- editor.selections = [new Selection(3, 1, 3, 1)];
- const promise = wrapWithAbbreviation({ abbreviation: 'div' });
- if (!promise) {
- assert.equal(1, 2, 'Wrap returned undefined instead of promise.');
- return Promise.resolve();
- }
- return promise.then(() => {
- assert.equal(editor.document.getText(), expectedContents);
- return Promise.resolve();
- });
+ `;
+ const expectedContents = `
+
+ `;
+ return testWrapWithAbbreviation([new Selection(3, 1, 3, 1)], 'div', expectedContents, contents);
});
-});
-test('Wrap with multiline abbreviation doesnt add extra spaces', () => {
- // Issue #29898
- const contents = `
-hello
-`;
- const expectedContents = `
-
-`;
-
- return withRandomFileEditor(contents, 'html', (editor, _) => {
- editor.selections = [new Selection(1, 2, 1, 2)];
- const promise = wrapWithAbbreviation({ abbreviation: 'ul>li>a' });
- if (!promise) {
- assert.equal(1, 2, 'Wrap returned undefined instead of promise.');
- return Promise.resolve();
- }
- return promise.then(() => {
- assert.equal(editor.document.getText(), expectedContents);
- return Promise.resolve();
- });
- });
-});
-
-test('Wrap individual lines with abbreviation', () => {
- const contents = `
-
- - This $10 is not a tabstop
- - hi.there
-
-`;
- const wrapIndividualLinesExpected = `
-
+ test('Wrap with multiline abbreviation doesnt add extra spaces', () => {
+ // Issue #29898
+ const contents = `
+ hello
+ `;
+ const expectedContents = `
- - This $10 is not a tabstop
- - hi.there
+ - hello
-
-`;
- return withRandomFileEditor(contents, 'html', (editor, _) => {
- editor.selections = [new Selection(2, 2, 3, 33)];
- const promise = wrapIndividualLinesWithAbbreviation({ abbreviation: 'ul>li.hello$*' });
- if (!promise) {
- assert.equal(1, 2, 'Wrap Individual Lines with Abbreviation returned undefined.');
- return Promise.resolve();
- }
- return promise.then(() => {
- assert.equal(editor.document.getText(), wrapIndividualLinesExpected);
- return Promise.resolve();
- });
+ `;
+ return testWrapWithAbbreviation([new Selection(1, 2, 1, 2)], 'ul>li>a', expectedContents, contents);
});
-});
-test('Wrap individual lines with abbreviation with extra space selected', () => {
- const contents = `
-
-`;
- const wrapIndividualLinesExpected = `
-
-`;
- return withRandomFileEditor(contents, 'html', (editor, _) => {
- editor.selections = [new Selection(2, 1, 4, 0)];
- const promise = wrapIndividualLinesWithAbbreviation({ abbreviation: 'ul>li.hello$*' });
- if (!promise) {
- assert.equal(1, 2, 'Wrap Individual Lines with Abbreviation returned undefined.');
- return Promise.resolve();
- }
- return promise.then(() => {
- assert.equal(editor.document.getText(), wrapIndividualLinesExpected);
- return Promise.resolve();
- });
- });
-});
-
-test('Wrap individual lines with abbreviation with comment filter', () => {
- const contents = `
-
-`;
- const wrapIndividualLinesExpected = `
-
-`;
- return withRandomFileEditor(contents, 'html', (editor, _) => {
- editor.selections = [new Selection(2, 2, 3, 33)];
- const promise = wrapIndividualLinesWithAbbreviation({ abbreviation: 'ul>li.hello*|c' });
- if (!promise) {
- assert.equal(1, 2, 'Wrap Individual Lines with Abbreviation returned undefined.');
- return Promise.resolve();
- }
- return promise.then(() => {
- assert.equal(editor.document.getText(), wrapIndividualLinesExpected);
- return Promise.resolve();
- });
- });
-});
-
-test('Wrap individual lines with abbreviation and trim', () => {
- const contents = `
+ test('Wrap individual lines with abbreviation', () => {
+ const contents = `
- • lorem ipsum
- • lorem ipsum
+ - This $10 is not a tabstop
+ - hi.there
`;
- const wrapIndividualLinesExpected = `
+ const wrapIndividualLinesExpected = `
- - lorem ipsum
- - lorem ipsum
+ - This $10 is not a tabstop
+ - hi.there
`;
- return withRandomFileEditor(contents, 'html', (editor, _) => {
- editor.selections = [new Selection(2, 3, 3, 16)];
- const promise = wrapIndividualLinesWithAbbreviation({ abbreviation: 'ul>li.hello$*|t' });
- if (!promise) {
- assert.equal(1, 2, 'Wrap Individual Lines with Abbreviation returned undefined.');
- return Promise.resolve();
- }
+ return testWrapIndividualLinesWithAbbreviation([new Selection(2, 2, 3, 33)], 'ul>li.hello$*', wrapIndividualLinesExpected, contents);
+ });
- return promise.then(() => {
- assert.equal(editor.document.getText(), wrapIndividualLinesExpected);
- return Promise.resolve();
- });
+ test('Wrap individual lines with abbreviation with extra space selected', () => {
+ const contents = `
+
+`;
+ const wrapIndividualLinesExpected = `
+
+`;
+ return testWrapIndividualLinesWithAbbreviation([new Selection(2, 1, 4, 0)], 'ul>li.hello$*', wrapIndividualLinesExpected, contents);
+ });
+
+ test('Wrap individual lines with abbreviation with comment filter', () => {
+ const contents = `
+
+`;
+ const wrapIndividualLinesExpected = `
+
+`;
+ return testWrapIndividualLinesWithAbbreviation([new Selection(2, 2, 3, 33)], 'ul>li.hello*|c', wrapIndividualLinesExpected, contents);
+ });
+
+ test('Wrap individual lines with abbreviation and trim', () => {
+ const contents = `
+
+ • lorem ipsum
+ • lorem ipsum
+
+ `;
+ const wrapIndividualLinesExpected = `
+
+
+ - lorem ipsum
+ - lorem ipsum
+
+
+ `;
+ return testWrapIndividualLinesWithAbbreviation([new Selection(2, 3, 3, 16)], 'ul>li.hello$*|t', wrapIndividualLinesExpected, contents);
});
-});
test('Wrap with abbreviation and format set to false', () => {
return workspace.getConfiguration('emmet').update('syntaxProfiles',{ 'html' : { 'format': false } } , ConfigurationTarget.Global).then(() => {