mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
Update deprecated html language features
This commit is contained in:
parent
135142e497
commit
1469a9840f
|
@ -23,24 +23,24 @@ export function assertCompletion(completions: CompletionList, expected: ItemDesc
|
|||
return completion.label === expected.label;
|
||||
});
|
||||
if (expected.notAvailable) {
|
||||
assert.equal(matches.length, 0, `${expected.label} should not existing is results`);
|
||||
assert.strictEqual(matches.length, 0, `${expected.label} should not existing is results`);
|
||||
return;
|
||||
}
|
||||
|
||||
assert.equal(matches.length, 1, `${expected.label} should only existing once: Actual: ${completions.items.map(c => c.label).join(', ')}`);
|
||||
assert.strictEqual(matches.length, 1, `${expected.label} should only existing once: Actual: ${completions.items.map(c => c.label).join(', ')}`);
|
||||
let match = matches[0];
|
||||
if (expected.documentation) {
|
||||
assert.equal(match.documentation, expected.documentation);
|
||||
assert.strictEqual(match.documentation, expected.documentation);
|
||||
}
|
||||
if (expected.kind) {
|
||||
assert.equal(match.kind, expected.kind);
|
||||
assert.strictEqual(match.kind, expected.kind);
|
||||
}
|
||||
if (expected.resultText && match.textEdit) {
|
||||
const edit = TextEdit.is(match.textEdit) ? match.textEdit : TextEdit.replace(match.textEdit.replace, match.textEdit.newText);
|
||||
assert.equal(TextDocument.applyEdits(document, [edit]), expected.resultText);
|
||||
assert.strictEqual(TextDocument.applyEdits(document, [edit]), expected.resultText);
|
||||
}
|
||||
if (expected.command) {
|
||||
assert.deepEqual(match.command, expected.command);
|
||||
assert.deepStrictEqual(match.command, expected.command);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ export async function testCompletionFor(value: string, expected: { count?: numbe
|
|||
let list = await mode.doComplete!(document, position, context);
|
||||
|
||||
if (expected.count) {
|
||||
assert.equal(list.items.length, expected.count);
|
||||
assert.strictEqual(list.items.length, expected.count);
|
||||
}
|
||||
if (expected.items) {
|
||||
for (let item of expected.items) {
|
||||
|
|
|
@ -12,9 +12,9 @@ suite('HTML Document Context', () => {
|
|||
const rootFolders = [{ name: '', uri: 'file:///users/test/' }];
|
||||
|
||||
let context = getDocumentContext(docURI, rootFolders);
|
||||
assert.equal(context.resolveReference('/', docURI), 'file:///users/test/');
|
||||
assert.equal(context.resolveReference('/message.html', docURI), 'file:///users/test/message.html');
|
||||
assert.equal(context.resolveReference('message.html', docURI), 'file:///users/test/folder/message.html');
|
||||
assert.equal(context.resolveReference('message.html', 'file:///users/test/'), 'file:///users/test/message.html');
|
||||
assert.strictEqual(context.resolveReference('/', docURI), 'file:///users/test/');
|
||||
assert.strictEqual(context.resolveReference('/message.html', docURI), 'file:///users/test/message.html');
|
||||
assert.strictEqual(context.resolveReference('message.html', docURI), 'file:///users/test/folder/message.html');
|
||||
assert.strictEqual(context.resolveReference('message.html', 'file:///users/test/'), 'file:///users/test/message.html');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -23,7 +23,7 @@ suite('HTML Embedded Support', () => {
|
|||
const docRegions = embeddedSupport.getDocumentRegions(htmlLanguageService, document);
|
||||
const languageId = docRegions.getLanguageAtPosition(position);
|
||||
|
||||
assert.equal(languageId, expectedLanguageId);
|
||||
assert.strictEqual(languageId, expectedLanguageId);
|
||||
}
|
||||
|
||||
function assertEmbeddedLanguageContent(value: string, languageId: string, expectedContent: string): void {
|
||||
|
@ -31,7 +31,7 @@ suite('HTML Embedded Support', () => {
|
|||
|
||||
const docRegions = embeddedSupport.getDocumentRegions(htmlLanguageService, document);
|
||||
const content = docRegions.getEmbeddedDocument(languageId);
|
||||
assert.equal(content.getText(), expectedContent);
|
||||
assert.strictEqual(content.getText(), expectedContent);
|
||||
}
|
||||
|
||||
test('Styles', function (): any {
|
||||
|
|
|
@ -30,7 +30,7 @@ async function assertRanges(lines: string[], expected: ExpectedIndentRange[], me
|
|||
actualRanges[i] = r(actual[i].startLine, actual[i].endLine, actual[i].kind);
|
||||
}
|
||||
actualRanges = actualRanges.sort((r1, r2) => r1.startLine - r2.startLine);
|
||||
assert.deepEqual(actualRanges, expected, message);
|
||||
assert.deepStrictEqual(actualRanges, expected, message);
|
||||
}
|
||||
|
||||
function r(startLine: number, endLine: number, kind?: string): ExpectedIndentRange {
|
||||
|
|
|
@ -41,7 +41,7 @@ suite('HTML Embedded Formatting', () => {
|
|||
let result = await format(languageModes, document, range, formatOptions, undefined, { css: true, javascript: true });
|
||||
|
||||
let actual = TextDocument.applyEdits(document, result);
|
||||
assert.equal(actual, expected, message);
|
||||
assert.strictEqual(actual, expected, message);
|
||||
}
|
||||
|
||||
async function assertFormatWithFixture(fixtureName: string, expectedPath: string, options?: any, formatOptions?: FormattingOptions): Promise<void> {
|
||||
|
|
|
@ -34,7 +34,7 @@ async function testRename(value: string, newName: string, expectedDocContent: st
|
|||
}
|
||||
|
||||
const newDocContent = TextDocument.applyEdits(document, edits);
|
||||
assert.equal(newDocContent, expectedDocContent, `Expected: ${expectedDocContent}\nActual: ${newDocContent}`);
|
||||
assert.strictEqual(newDocContent, expectedDocContent, `Expected: ${expectedDocContent}\nActual: ${newDocContent}`);
|
||||
} else {
|
||||
assert.fail('should have javascriptMode but no')
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import 'mocha';
|
||||
import * as assert from 'assert';
|
||||
import { getLanguageModes, ClientCapabilities, TextDocument, SelectionRange} from '../modes/languageModes';
|
||||
import { getLanguageModes, ClientCapabilities, TextDocument, SelectionRange } from '../modes/languageModes';
|
||||
import { getSelectionRanges } from '../modes/selectionRanges';
|
||||
import { getNodeFSRequestService } from '../node/nodeFs';
|
||||
|
||||
|
@ -23,7 +23,7 @@ async function assertRanges(content: string, expected: (number | string)[][]): P
|
|||
|
||||
const document = TextDocument.create('test://foo.html', 'html', 1, content);
|
||||
const actualRanges = await getSelectionRanges(languageModes, document, [document.positionAt(offset)]);
|
||||
assert.equal(actualRanges.length, 1);
|
||||
assert.strictEqual(actualRanges.length, 1);
|
||||
const offsetPairs: [number, string][] = [];
|
||||
let curr: SelectionRange | undefined = actualRanges[0];
|
||||
while (curr) {
|
||||
|
@ -32,7 +32,7 @@ async function assertRanges(content: string, expected: (number | string)[][]): P
|
|||
}
|
||||
|
||||
message += `${JSON.stringify(offsetPairs)}\n but should give:\n${JSON.stringify(expected)}\n`;
|
||||
assert.deepEqual(offsetPairs, expected, message);
|
||||
assert.deepStrictEqual(offsetPairs, expected, message);
|
||||
}
|
||||
|
||||
suite('HTML SelectionRange', () => {
|
||||
|
|
|
@ -40,7 +40,7 @@ async function assertTokens(lines: string[], expected: ExpectedToken[], ranges?:
|
|||
lastLine = line;
|
||||
lastCharacter = character;
|
||||
}
|
||||
assert.deepEqual(actualRanges, expected, message);
|
||||
assert.deepStrictEqual(actualRanges, expected, message);
|
||||
}
|
||||
|
||||
function t(startLine: number, character: number, length: number, tokenClassifiction: string): ExpectedToken {
|
||||
|
|
|
@ -16,7 +16,7 @@ suite('HTML Words', () => {
|
|||
let actualRange = words.getWordAtText(value, offset, wordRegex);
|
||||
assert(actualRange.start <= offset);
|
||||
assert(actualRange.start + actualRange.length >= offset);
|
||||
assert.equal(value.substr(actualRange.start, actualRange.length), expected);
|
||||
assert.strictEqual(value.substr(actualRange.start, actualRange.length), expected);
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,4 +41,4 @@ suite('HTML Words', () => {
|
|||
assertWord('console.log("hello");\n\r |var x1 = new F<A>(a, b);', 'var');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue