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.

File typescript Oxide 7 imports

Entity Profile

Dependency Diagram

graph LR
  5a5c9d67_8d84_06bd_ad39_e33e27331bc0["selector-parser.test.ts"]
  44cf1398_18e8_9bac_e42c_f3766b1fa98f["selector-parser.ts"]
  5a5c9d67_8d84_06bd_ad39_e33e27331bc0 --> 44cf1398_18e8_9bac_e42c_f3766b1fa98f
  de3fcfd2_5ef8_b401_5628_afca528d4073["parse"]
  5a5c9d67_8d84_06bd_ad39_e33e27331bc0 --> de3fcfd2_5ef8_b401_5628_afca528d4073
  3d8fd16a_e231_9a51_bd56_8f9f2b44612b["toCss"]
  5a5c9d67_8d84_06bd_ad39_e33e27331bc0 --> 3d8fd16a_e231_9a51_bd56_8f9f2b44612b
  1b8f1c54_b1e9_e18d_0719_b7ad92808185["walk.ts"]
  5a5c9d67_8d84_06bd_ad39_e33e27331bc0 --> 1b8f1c54_b1e9_e18d_0719_b7ad92808185
  4982d9ce_98d4_85d9_44af_7cc47b93c482["walk"]
  5a5c9d67_8d84_06bd_ad39_e33e27331bc0 --> 4982d9ce_98d4_85d9_44af_7cc47b93c482
  47187d1b_a6f7_f734_0752_446b87b5cd9e["WalkAction"]
  5a5c9d67_8d84_06bd_ad39_e33e27331bc0 --> 47187d1b_a6f7_f734_0752_446b87b5cd9e
  f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3["vitest"]
  5a5c9d67_8d84_06bd_ad39_e33e27331bc0 --> f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3
  style 5a5c9d67_8d84_06bd_ad39_e33e27331bc0 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 Oxide 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: Oxide, directory: packages/tailwindcss/src).

Analyze Your Own Codebase

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

Try Supermodel Free