Home

tailwind-ctp-intellisense @5742c36c2a405bb75642c24e8849a344ea81bb9c - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tailwind-ctp-intellisense / packages / tailwindcss-language-server / tests / diagnostics / diagnostics.test.js
- raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { expect, test } from 'vitest'
import { withFixture } from '../common'
import * as fs from 'node:fs/promises'

withFixture('basic', (c) => {
  function testFixture(fixture) {
    test(fixture, async () => {
      fixture = await fs.readFile(`tests/diagnostics/${fixture}.json`, 'utf8')

      let { code, expected, language = 'html' } = JSON.parse(fixture)

      let promise = new Promise((resolve) => {
        c.onNotification('textDocument/publishDiagnostics', ({ diagnostics }) => {
          resolve(diagnostics)
        })
      })

      let doc = await c.openDocument({ text: code, lang: language })
      let diagnostics = await promise

      expected = JSON.parse(JSON.stringify(expected).replaceAll('{{URI}}', doc.uri))

      expect(diagnostics).toEqual(expected)
    })
  }

  testFixture('css-conflict/simple')
  testFixture('css-conflict/variants-negative')
  testFixture('css-conflict/variants-positive')
  testFixture('css-conflict/jsx-concat-negative')
  testFixture('css-conflict/jsx-concat-positive')
  testFixture('css-conflict/css')
  testFixture('css-conflict/css-multi-rule')
  testFixture('css-conflict/css-multi-prop')
  testFixture('invalid-screen/simple')
  testFixture('invalid-theme/simple')
})