Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bring back css tests #160326

Merged
merged 1 commit into from Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion extensions/css-language-features/server/src/cssServer.ts
Expand Up @@ -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) });
}
}

Expand Down
22 changes: 11 additions & 11 deletions extensions/css-language-features/server/src/test/completion.test.ts
Expand Up @@ -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: [
Expand Down Expand Up @@ -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: [
Expand Down Expand Up @@ -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: [
Expand All @@ -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
Expand All @@ -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'` }
Expand All @@ -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
Expand Down
Expand Up @@ -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('') }];
Expand All @@ -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('') }];
Expand All @@ -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('') }];
Expand Down
Expand Up @@ -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);
},
};
}
Expand Down