foo', [[10, 'div'], [0, '
foo
']]);
+ await assertRanges('
foo
', [[10, 'div'], [0, '
foo
']]);
});
- test('Attribute Name', () => {
- assertRanges('
foo
', [
+ test('Attribute Name', async () => {
+ await assertRanges('
foo
', [
[5, 'class'],
[5, `class="foo"`],
[1, `div class="foo"`],
[0, `
foo
`]
]);
- assertRanges('
foo
', [
+ await assertRanges('
foo
', [
[5, 'class'],
[5, `class="foo"`],
[1, `div class="foo"`],
[0, `
foo
`]
]);
- assertRanges('
foo
', [
+ await assertRanges('
foo
', [
[5, 'class'],
[5, `class="foo"`],
[1, `div class="foo"`],
@@ -67,28 +67,28 @@ suite('HTML SelectionRange', () => {
]);
});
- test('Attribute Value', () => {
- assertRanges('
foo
', [
+ test('Attribute Value', async () => {
+ await assertRanges('
foo
', [
[11, `"foo"`],
[5, `class="foo"`],
[1, `div class="foo"`],
[0, `
foo
`]
]);
- assertRanges('
foo
', [
+ await assertRanges('
foo
', [
[11, `"foo"`],
[5, `class="foo"`],
[1, `div class="foo"`],
[0, `
foo
`]
]);
- assertRanges('
foo
', [
+ await assertRanges('
foo
', [
[12, 'foo'],
[11, `"foo"`],
[5, `class="foo"`],
[1, `div class="foo"`],
[0, `
foo
`]
]);
- assertRanges('
foo
', [
+ await assertRanges('
foo
', [
[12, 'foo'],
[11, `"foo"`],
[5, `class="foo"`],
@@ -97,8 +97,8 @@ suite('HTML SelectionRange', () => {
]);
});
- test('Unquoted Attribute Value', () => {
- assertRanges('
foo
', [
+ test('Unquoted Attribute Value', async () => {
+ await assertRanges('
foo
', [
[11, 'foo'],
[5, 'class=foo'],
[1, 'div class=foo'],
@@ -106,8 +106,8 @@ suite('HTML SelectionRange', () => {
]);
});
- test('Multiple Attribute Value', () => {
- assertRanges('
foo
', [
+ test('Multiple Attribute Value', async () => {
+ await assertRanges('
foo
', [
[21, 'bar'],
[20, `"bar"`],
[17, `id="bar"`],
@@ -116,8 +116,8 @@ suite('HTML SelectionRange', () => {
]);
});
- test('Self closing tags', () => {
- assertRanges('
', [
+ test('Self closing tags', async () => {
+ await assertRanges('
', [
[11, 'foo'],
[10, '"foo"'],
[4, 'class="foo"'],
@@ -126,13 +126,13 @@ suite('HTML SelectionRange', () => {
]);
//Todo@Pine: We need the range `br` too. Sync with Joh to see what selection ranges should provider return.
- assertRanges('
', [[1, 'br class="foo"'], [0, '
']]);
+ await assertRanges('
', [[1, 'br class="foo"'], [0, '
']]);
});
- test('Nested', () => {
- assertRanges('
', [[10, 'foo'], [5, '
foo
'], [0, '
']]);
+ test('Nested', async () => {
+ await assertRanges('
', [[10, 'foo'], [5, '
foo
'], [0, '
']]);
- assertRanges('
', [
+ await assertRanges('
', [
[9, 'foo'],
[6, '
foo
'],
[5, '\n
foo
\n'],
@@ -140,8 +140,8 @@ suite('HTML SelectionRange', () => {
]);
});
- test('Void elements', () => {
- assertRanges(`
`, [
+ test('Void elements', async () => {
+ await assertRanges(`
`, [
[15, 'UTF-8'],
[14, "'UTF-8'"],
[6, "charset='UTF-8'"],
@@ -149,14 +149,14 @@ suite('HTML SelectionRange', () => {
[0, "
"]
]);
- assertRanges(`
`, [
+ await assertRanges(`
`, [
[6, 'charset'],
[6, "charset='UTF-8'"],
[1, "meta charset='UTF-8'"],
[0, "
"]
]);
- assertRanges(`
`, [
+ await assertRanges(`
`, [
[12, 'charset'],
[12, "charset='UTF-8'"],
[7, "meta charset='UTF-8'"],
@@ -165,17 +165,17 @@ suite('HTML SelectionRange', () => {
]);
});
- test('Unmatching tags', () => {
- assertRanges('
', [[0, "
"]]);
+ test('Unmatching tags', async () => {
+ await assertRanges('
', [[0, "
"]]);
});
- test('Unhandled', () => {
+ test('Unhandled', async () => {
// We do not handle comments. This semantic selection is handled by VS Code's default provider, which returns
// - foo
// -
- assertRanges('', [[6, '']]);
+ await assertRanges('', [[6, '']]);
// Same for DOCTYPE
- assertRanges('', [[11, '']]);
+ await assertRanges('', [[11, '']]);
});
});
diff --git a/src/test/symbols.test.ts b/src/test/symbols.test.ts
index a5f937f4..47aec3d6 100644
--- a/src/test/symbols.test.ts
+++ b/src/test/symbols.test.ts
@@ -12,37 +12,37 @@ suite('HTML Symbols', () => {
const TEST_URI = "test://test/test.html";
- const testSymbolInformationsFor = function (value: string, expected: SymbolInformation[]) {
+ const testSymbolInformationsFor = async function (value: string, expected: SymbolInformation[]) {
const ls = htmlLanguageService.getLanguageService();
const document = TextDocument.create(TEST_URI, 'html', 0, value);
- const htmlDoc = ls.parseHTMLDocument(document);
+ const htmlDoc = await ls.parseHTMLDocument(document);
const symbols = ls.findDocumentSymbols(document, htmlDoc);
assert.deepEqual(symbols, expected);
};
- const testDocumentSymbolsFor = function (value: string, expected: DocumentSymbol[]) {
+ const testDocumentSymbolsFor = async function (value: string, expected: DocumentSymbol[]) {
const ls = htmlLanguageService.getLanguageService();
const document = TextDocument.create(TEST_URI, 'html', 0, value);
- const htmlDoc = ls.parseHTMLDocument(document);
+ const htmlDoc = await ls.parseHTMLDocument(document);
const symbols = ls.findDocumentSymbols2(document, htmlDoc);
assert.deepEqual(symbols, expected);
};
- test('Simple', () => {
- testSymbolInformationsFor('
', [
+ test('Simple', async () => {
+ await testSymbolInformationsFor('
', [
{ containerName: '', name: 'div', kind:
SymbolKind.Field, location: Location.create(TEST_URI, Range.create(0, 0, 0, 11)) }
]);
- testSymbolInformationsFor('',
+ await testSymbolInformationsFor('',
[
{ containerName: '', name: 'div', kind: SymbolKind.Field, location: Location.create(TEST_URI, Range.create(0, 0, 0, 53)) },
{ containerName: 'div', name: 'input#test.checkbox', kind: SymbolKind.Field, location: Location.create(TEST_URI, Range.create(0, 5, 0, 47)) }
]
);
- testDocumentSymbolsFor('', [
+ await testDocumentSymbolsFor('', [
DocumentSymbol.create('div', undefined, SymbolKind.Field, Range.create(0, 0, 0, 11), Range.create(0, 0, 0, 11))
]);
- testDocumentSymbolsFor('',
+ await testDocumentSymbolsFor('',
[
DocumentSymbol.create('div', undefined, SymbolKind.Field, Range.create(0, 0, 0, 53), Range.create(0, 0, 0, 53), [
DocumentSymbol.create('input#test.checkbox', undefined, SymbolKind.Field, Range.create(0, 5, 0, 47), Range.create(0, 5, 0, 47))
@@ -51,7 +51,7 @@ suite('HTML Symbols', () => {
);
});
- test('Id and classes', function () {
+ test('Id and classes', async () => {
const content = '';
const expected1 = [
@@ -60,7 +60,7 @@ suite('HTML Symbols', () => {
{ name: 'div.a.b', kind: SymbolKind.Field, containerName: 'body#Foo.bar', location: Location.create(TEST_URI, Range.create(0, 43, 0, 66)) },
];
- testSymbolInformationsFor(content, expected1);
+ await testSymbolInformationsFor(content, expected1);
const expected2: DocumentSymbol[] = [
DocumentSymbol.create("html#root", undefined, SymbolKind.Field, Range.create(0, 0, 0, 80), Range.create(0, 0, 0, 80), [
@@ -69,10 +69,10 @@ suite('HTML Symbols', () => {
])
])
];
- testDocumentSymbolsFor(content, expected2);
+ await testDocumentSymbolsFor(content, expected2);
});
- test('Self closing', function () {
+ test('Self closing', async () => {
const content = '
';
const expected1 = [
@@ -81,7 +81,7 @@ suite('HTML Symbols', () => {
{ name: 'br#Bar', kind: SymbolKind.Field, containerName: 'html', location: Location.create(TEST_URI, Range.create(0, 19, 0, 30)) },
];
- testSymbolInformationsFor(content, expected1);
+ await testSymbolInformationsFor(content, expected1);
const expected2: DocumentSymbol[] = [
DocumentSymbol.create("html", undefined, SymbolKind.Field, Range.create(0, 0, 0, 37), Range.create(0, 0, 0, 37), [
@@ -89,10 +89,10 @@ suite('HTML Symbols', () => {
DocumentSymbol.create("br#Bar", undefined, SymbolKind.Field, Range.create(0, 19, 0, 30), Range.create(0, 19, 0, 30))
])
];
- testDocumentSymbolsFor(content, expected2);
+ await testDocumentSymbolsFor(content, expected2);
});
- test('No attrib', function () {
+ test('No attrib', async () => {
const content = '';
const expected = [
@@ -101,7 +101,7 @@ suite('HTML Symbols', () => {
{ name: 'div', kind: SymbolKind.Field, containerName: 'body', location: Location.create(TEST_URI, Range.create(0, 12, 0, 23)) }
];
- testSymbolInformationsFor(content, expected);
+ await testSymbolInformationsFor(content, expected);
const expected2: DocumentSymbol[] = [
DocumentSymbol.create("html", undefined, SymbolKind.Field, Range.create(0, 0, 0, 37), Range.create(0, 0, 0, 37), [
@@ -110,6 +110,6 @@ suite('HTML Symbols', () => {
])
])
];
- testDocumentSymbolsFor(content, expected2);
+ await testDocumentSymbolsFor(content, expected2);
});
});