Home / File/ selector-parser.test.ts — tailwindcss Source File

selector-parser.test.ts — tailwindcss Source File

Architecture documentation for selector-parser.test.ts, a typescript file in the tailwindcss codebase. 7 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  be20a43f_a7c3_297e_7172_e930a08b4c28["selector-parser.test.ts"]
  8f1d0c03_e255_b7cc_896f_c8432ac0535a["selector-parser.ts"]
  be20a43f_a7c3_297e_7172_e930a08b4c28 --> 8f1d0c03_e255_b7cc_896f_c8432ac0535a
  42cc068a_55e9_a05d_7ba4_ce2742661765["parse"]
  be20a43f_a7c3_297e_7172_e930a08b4c28 --> 42cc068a_55e9_a05d_7ba4_ce2742661765
  9090c137_4d4b_1e4e_5ad3_3883d6b4533a["toCss"]
  be20a43f_a7c3_297e_7172_e930a08b4c28 --> 9090c137_4d4b_1e4e_5ad3_3883d6b4533a
  d1b39b63_c9d5_6c28_0206_0ddc8b895876["walk.ts"]
  be20a43f_a7c3_297e_7172_e930a08b4c28 --> d1b39b63_c9d5_6c28_0206_0ddc8b895876
  ed78da58_8727_ad98_120c_61f35cea357a["walk"]
  be20a43f_a7c3_297e_7172_e930a08b4c28 --> ed78da58_8727_ad98_120c_61f35cea357a
  7b34c369_d799_30f1_b751_6e3fd5349f6b["WalkAction"]
  be20a43f_a7c3_297e_7172_e930a08b4c28 --> 7b34c369_d799_30f1_b751_6e3fd5349f6b
  696bd648_5f24_1b59_8e8b_7a97a692869e["vitest"]
  be20a43f_a7c3_297e_7172_e930a08b4c28 --> 696bd648_5f24_1b59_8e8b_7a97a692869e
  style be20a43f_a7c3_297e_7172_e930a08b4c28 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { describe, expect, it } from 'vitest'
import { parse, toCss } from './selector-parser'
import { walk, WalkAction } from './walk'

describe('parse', () => {
  it('should parse a simple selector', () => {
    expect(parse('.foo')).toEqual([{ kind: 'selector', value: '.foo' }])
  })

  it('should parse a compound selector', () => {
    expect(parse('.foo.bar:hover#id')).toEqual([
      { kind: 'selector', value: '.foo' },
      { kind: 'selector', value: '.bar' },
      { kind: 'selector', value: ':hover' },
      { kind: 'selector', value: '#id' },
    ])
  })

  it('should parse a selector list', () => {
    expect(parse('.foo,.bar')).toEqual([
      { kind: 'selector', value: '.foo' },
      { kind: 'separator', value: ',' },
      { kind: 'selector', value: '.bar' },
    ])
  })

  it('should combine everything within attribute selectors', () => {
    expect(parse('.foo[bar="baz"]')).toEqual([
      { kind: 'selector', value: '.foo' },
      { kind: 'selector', value: '[bar="baz"]' },
    ])
  })

  it('should parse functions', () => {
    expect(parse('.foo:hover:not(.bar:focus)')).toEqual([
      { kind: 'selector', value: '.foo' },
      { kind: 'selector', value: ':hover' },
      {
        kind: 'function',
        nodes: [
          {
            kind: 'selector',
            value: '.bar',
          },
          {
            kind: 'selector',
            value: ':focus',
          },
        ],
        value: ':not',
      },
    ])
  })

  it('should handle next-children combinator', () => {
    expect(parse('.foo + p')).toEqual([
      { kind: 'selector', value: '.foo' },
      { kind: 'combinator', value: ' + ' },
      { kind: 'selector', value: 'p' },
    ])
// ... (146 more lines)

Domain

Frequently Asked Questions

What does selector-parser.test.ts do?
selector-parser.test.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the OxideEngine domain.
What does selector-parser.test.ts depend on?
selector-parser.test.ts imports 7 module(s): WalkAction, parse, selector-parser.ts, toCss, vitest, walk, walk.ts.
Where is selector-parser.test.ts in the architecture?
selector-parser.test.ts is located at packages/tailwindcss/src/selector-parser.test.ts (domain: OxideEngine, directory: packages/tailwindcss/src).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free