bring back css tests (#160326)

This commit is contained in:
Martin Aeschlimann 2022-09-07 19:43:47 +02:00 committed by GitHub
parent 28c330caf0
commit 440e61ffab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 18 deletions

View file

@ -74,7 +74,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
if (!Array.isArray(workspaceFolders)) {
workspaceFolders = [];
if (params.rootPath) {
workspaceFolders.push({ name: '', uri: URI.file(params.rootPath).toString() });
workspaceFolders.push({ name: '', uri: URI.file(params.rootPath).toString(true) });
}
}

View file

@ -60,8 +60,8 @@ suite('Completions', () => {
}
test('CSS url() Path completion', async function () {
const testUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString();
const folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString() }];
const testUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString(true);
const folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString(true) }];
await assertCompletions('html { background-image: url("./|")', {
items: [
@ -119,8 +119,8 @@ suite('Completions', () => {
});
test('CSS url() Path Completion - Unquoted url', async function () {
const testUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString();
const folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString() }];
const testUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString(true);
const folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString(true) }];
await assertCompletions('html { background-image: url(./|)', {
items: [
@ -148,8 +148,8 @@ suite('Completions', () => {
});
test('CSS @import Path completion', async function () {
const testUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString();
const folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString() }];
const testUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString(true);
const folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString(true) }];
await assertCompletions(`@import './|'`, {
items: [
@ -171,8 +171,8 @@ suite('Completions', () => {
* For SCSS, `@import 'foo';` can be used for importing partial file `_foo.scss`
*/
test('SCSS @import Path completion', async function () {
const testCSSUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString();
const folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString() }];
const testCSSUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString(true);
const folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString(true) }];
/**
* We are in a CSS file, so no special treatment for SCSS partial files
@ -184,7 +184,7 @@ suite('Completions', () => {
]
}, testCSSUri, folders);
const testSCSSUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/scss/main.scss')).toString();
const testSCSSUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/scss/main.scss')).toString(true);
await assertCompletions(`@import './|'`, {
items: [
{ label: '_foo.scss', resultText: `@import './foo'` }
@ -193,8 +193,8 @@ suite('Completions', () => {
});
test('Completion should ignore files/folders starting with dot', async function () {
const testUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString();
const folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString() }];
const testUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString(true);
const folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString(true) }];
await assertCompletions('html { background-image: url("../|")', {
count: 4

View file

@ -58,7 +58,7 @@ suite('Links', () => {
return URI.file(resolve(__dirname, '../../test/linksTestFixtures', path)).toString(true);
}
test.skip('url links', async function () {
test('url links', async function () {
const testUri = getTestResource('about.css');
const folders = [{ name: 'x', uri: getTestResource('') }];
@ -68,7 +68,7 @@ suite('Links', () => {
);
});
test.skip('node module resolving', async function () {
test('node module resolving', async function () {
const testUri = getTestResource('about.css');
const folders = [{ name: 'x', uri: getTestResource('') }];
@ -78,7 +78,7 @@ suite('Links', () => {
);
});
test.skip('node module subfolder resolving', async function () {
test('node module subfolder resolving', async function () {
const testUri = getTestResource('subdir/about.css');
const folders = [{ name: 'x', uri: getTestResource('') }];

View file

@ -27,11 +27,11 @@ export function getDocumentContext(documentUri: string, workspaceFolders: Worksp
if (ref[0] === '/') { // resolve absolute path against the current workspace folder
const folderUri = getRootFolder();
if (folderUri) {
return folderUri + ref.substr(1);
return folderUri + ref.substring(1);
}
}
base = base.substr(0, base.lastIndexOf('/') + 1);
return Utils.resolvePath(URI.parse(base), ref).toString();
base = base.substring(0, base.lastIndexOf('/') + 1);
return Utils.resolvePath(URI.parse(base), ref).toString(true);
},
};
}