|
1 |
| -import { test } from 'vitest' |
2 |
| -import { withFixture } from '../common' |
| 1 | +import { expect } from 'vitest' |
| 2 | +import { css, defineTest, html, js, json, symlinkTo } from '../../src/testing' |
| 3 | +import dedent from 'dedent' |
| 4 | +import { createClient } from '../utils/client' |
3 | 5 |
|
4 |
| -withFixture('multi-config-content', (c) => { |
5 |
| - test.concurrent('multi-config with content config - 1', async ({ expect }) => { |
6 |
| - let textDocument = await c.openDocument({ text: '<div class="bg-foo">', dir: 'one' }) |
7 |
| - let res = await c.sendRequest('textDocument/hover', { |
8 |
| - textDocument, |
9 |
| - position: { line: 0, character: 13 }, |
| 6 | +defineTest({ |
| 7 | + name: 'multi-config with content config', |
| 8 | + fs: { |
| 9 | + 'tailwind.config.one.js': js` |
| 10 | + module.exports = { |
| 11 | + content: ['./one/**/*'], |
| 12 | + theme: { |
| 13 | + extend: { |
| 14 | + colors: { |
| 15 | + foo: 'red', |
| 16 | + }, |
| 17 | + }, |
| 18 | + }, |
| 19 | + } |
| 20 | + `, |
| 21 | + 'tailwind.config.two.js': js` |
| 22 | + module.exports = { |
| 23 | + content: ['./two/**/*'], |
| 24 | + theme: { |
| 25 | + extend: { |
| 26 | + colors: { |
| 27 | + foo: 'blue', |
| 28 | + }, |
| 29 | + }, |
| 30 | + }, |
| 31 | + } |
| 32 | + `, |
| 33 | + }, |
| 34 | + prepare: async ({ root }) => ({ client: await createClient({ root }) }), |
| 35 | + handle: async ({ client }) => { |
| 36 | + let one = await client.open({ |
| 37 | + lang: 'html', |
| 38 | + name: 'one/index.html', |
| 39 | + text: '<div class="bg-foo">', |
10 | 40 | })
|
11 | 41 |
|
12 |
| - expect(res).toEqual({ |
| 42 | + let two = await client.open({ |
| 43 | + lang: 'html', |
| 44 | + name: 'two/index.html', |
| 45 | + text: '<div class="bg-foo">', |
| 46 | + }) |
| 47 | + |
| 48 | + // <div class="bg-foo"> |
| 49 | + // ^ |
| 50 | + let hoverOne = await one.hover({ line: 0, character: 13 }) |
| 51 | + let hoverTwo = await two.hover({ line: 0, character: 13 }) |
| 52 | + |
| 53 | + expect(hoverOne).toEqual({ |
13 | 54 | contents: {
|
14 | 55 | language: 'css',
|
15 |
| - value: |
16 |
| - '.bg-foo {\n --tw-bg-opacity: 1;\n background-color: rgb(255 0 0 / var(--tw-bg-opacity, 1)) /* #ff0000 */;\n}', |
| 56 | + value: dedent` |
| 57 | + .bg-foo { |
| 58 | + --tw-bg-opacity: 1; |
| 59 | + background-color: rgb(255 0 0 / var(--tw-bg-opacity, 1)) /* #ff0000 */; |
| 60 | + } |
| 61 | + `, |
| 62 | + }, |
| 63 | + range: { |
| 64 | + start: { line: 0, character: 12 }, |
| 65 | + end: { line: 0, character: 18 }, |
17 | 66 | },
|
18 |
| - range: { start: { line: 0, character: 12 }, end: { line: 0, character: 18 } }, |
19 |
| - }) |
20 |
| - }) |
21 |
| - |
22 |
| - test.concurrent('multi-config with content config - 2', async ({ expect }) => { |
23 |
| - let textDocument = await c.openDocument({ text: '<div class="bg-foo">', dir: 'two' }) |
24 |
| - let res = await c.sendRequest('textDocument/hover', { |
25 |
| - textDocument, |
26 |
| - position: { line: 0, character: 13 }, |
27 | 67 | })
|
28 | 68 |
|
29 |
| - expect(res).toEqual({ |
| 69 | + expect(hoverTwo).toEqual({ |
30 | 70 | contents: {
|
31 | 71 | language: 'css',
|
32 |
| - value: |
33 |
| - '.bg-foo {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 255 / var(--tw-bg-opacity, 1)) /* #0000ff */;\n}', |
| 72 | + value: dedent` |
| 73 | + .bg-foo { |
| 74 | + --tw-bg-opacity: 1; |
| 75 | + background-color: rgb(0 0 255 / var(--tw-bg-opacity, 1)) /* #0000ff */; |
| 76 | + } |
| 77 | + `, |
| 78 | + }, |
| 79 | + range: { |
| 80 | + start: { line: 0, character: 12 }, |
| 81 | + end: { line: 0, character: 18 }, |
34 | 82 | },
|
35 |
| - range: { start: { line: 0, character: 12 }, end: { line: 0, character: 18 } }, |
36 | 83 | })
|
37 |
| - }) |
| 84 | + }, |
38 | 85 | })
|
0 commit comments