Skip to content

Latest commit

 

History

History
604 lines (560 loc) · 10.9 KB

snapshots.ts.md

File metadata and controls

604 lines (560 loc) · 10.9 KB

Snapshot report for test/snapshots.ts

The actual snapshot is saved in snapshots.ts.snap.

Generated by AVA.

universal selector

parse1('*')

{
  list: [
    {
      namespace: null,
      specificity: [
        0,
        0,
        0,
      ],
      type: 'universal',
    },
  ],
  specificity: [
    0,
    0,
    0,
  ],
  type: 'compound',
}

universal selector with empty namespace

parse1('|*')

{
  list: [
    {
      namespace: '',
      specificity: [
        0,
        0,
        0,
      ],
      type: 'universal',
    },
  ],
  specificity: [
    0,
    0,
    0,
  ],
  type: 'compound',
}

universal selector with non-empty namespace

parse1('foo|*')

{
  list: [
    {
      namespace: 'foo',
      specificity: [
        0,
        0,
        0,
      ],
      type: 'universal',
    },
  ],
  specificity: [
    0,
    0,
    0,
  ],
  type: 'compound',
}

tag selector with non-empty namespace

parse1('foo|bar')

{
  list: [
    {
      name: 'bar',
      namespace: 'foo',
      specificity: [
        0,
        0,
        1,
      ],
      type: 'tag',
    },
  ],
  specificity: [
    0,
    0,
    1,
  ],
  type: 'compound',
}

class selector

parse1('.class')

{
  list: [
    {
      name: 'class',
      specificity: [
        0,
        1,
        0,
      ],
      type: 'class',
    },
  ],
  specificity: [
    0,
    1,
    0,
  ],
  type: 'compound',
}

id selector

parse1('#id')

{
  list: [
    {
      name: 'id',
      specificity: [
        1,
        0,
        0,
      ],
      type: 'id',
    },
  ],
  specificity: [
    1,
    0,
    0,
  ],
  type: 'compound',
}

attribute presence selector

parse1('[attr]')

{
  list: [
    {
      name: 'attr',
      namespace: null,
      specificity: [
        0,
        1,
        0,
      ],
      type: 'attrPresence',
    },
  ],
  specificity: [
    0,
    1,
    0,
  ],
  type: 'compound',
}

attribute value selector

parse1('[attr $= "value"]')

{
  list: [
    {
      matcher: '$=',
      modifier: null,
      name: 'attr',
      namespace: null,
      specificity: [
        0,
        1,
        0,
      ],
      type: 'attrValue',
      value: 'value',
    },
  ],
  specificity: [
    0,
    1,
    0,
  ],
  type: 'compound',
}

attribute value selector with modifier

parse1('[attr $= "value" S]')

{
  list: [
    {
      matcher: '$=',
      modifier: 's',
      name: 'attr',
      namespace: null,
      specificity: [
        0,
        1,
        0,
      ],
      type: 'attrValue',
      value: 'value',
    },
  ],
  specificity: [
    0,
    1,
    0,
  ],
  type: 'compound',
}

compound selector

parse1('p.class#id[attr][attr2^=value]')

{
  list: [
    {
      name: 'p',
      namespace: null,
      specificity: [
        0,
        0,
        1,
      ],
      type: 'tag',
    },
    {
      name: 'class',
      specificity: [
        0,
        1,
        0,
      ],
      type: 'class',
    },
    {
      name: 'id',
      specificity: [
        1,
        0,
        0,
      ],
      type: 'id',
    },
    {
      name: 'attr',
      namespace: null,
      specificity: [
        0,
        1,
        0,
      ],
      type: 'attrPresence',
    },
    {
      matcher: '^=',
      modifier: null,
      name: 'attr2',
      namespace: null,
      specificity: [
        0,
        1,
        0,
      ],
      type: 'attrValue',
      value: 'value',
    },
  ],
  specificity: [
    1,
    3,
    1,
  ],
  type: 'compound',
}

complex selector (with combinators)

parse1('.foo || .bar .baz + .qux')

{
  list: [
    {
      name: 'qux',
      specificity: [
        0,
        1,
        0,
      ],
      type: 'class',
    },
    {
      combinator: '+',
      left: {
        list: [
          {
            name: 'baz',
            specificity: [
              0,
              1,
              0,
            ],
            type: 'class',
          },
          {
            combinator: ' ',
            left: {
              list: [
                {
                  name: 'bar',
                  specificity: [
                    0,
                    1,
                    0,
                  ],
                  type: 'class',
                },
                {
                  combinator: '||',
                  left: {
                    list: [
                      {
                        name: 'foo',
                        specificity: [
                          0,
                          1,
                          0,
                        ],
                        type: 'class',
                      },
                    ],
                    specificity: [
                      0,
                      1,
                      0,
                    ],
                    type: 'compound',
                  },
                  specificity: [
                    0,
                    1,
                    0,
                  ],
                  type: 'combinator',
                },
              ],
              specificity: [
                0,
                2,
                0,
              ],
              type: 'compound',
            },
            specificity: [
              0,
              2,
              0,
            ],
            type: 'combinator',
          },
        ],
        specificity: [
          0,
          3,
          0,
        ],
        type: 'compound',
      },
      specificity: [
        0,
        3,
        0,
      ],
      type: 'combinator',
    },
  ],
  specificity: [
    0,
    4,
    0,
  ],
  type: 'compound',
}

list selector

parse('.foo,.bar,.baz')

{
  list: [
    {
      list: [
        {
          name: 'foo',
          specificity: [
            0,
            1,
            0,
          ],
          type: 'class',
        },
      ],
      specificity: [
        0,
        1,
        0,
      ],
      type: 'compound',
    },
    {
      list: [
        {
          name: 'bar',
          specificity: [
            0,
            1,
            0,
          ],
          type: 'class',
        },
      ],
      specificity: [
        0,
        1,
        0,
      ],
      type: 'compound',
    },
    {
      list: [
        {
          name: 'baz',
          specificity: [
            0,
            1,
            0,
          ],
          type: 'class',
        },
      ],
      specificity: [
        0,
        1,
        0,
      ],
      type: 'compound',
    },
  ],
  type: 'list',
}

non-ascii and escape sequences

parse1('.♫ .\" .\22\22 \.22 .\000022 22\ \+\ 22\ ')

{
  list: [
    {
      name: '"22 + 22 ',
      specificity: [
        0,
        1,
        0,
      ],
      type: 'class',
    },
    {
      combinator: ' ',
      left: {
        list: [
          {
            name: '"".22',
            specificity: [
              0,
              1,
              0,
            ],
            type: 'class',
          },
          {
            combinator: ' ',
            left: {
              list: [
                {
                  name: '"',
                  specificity: [
                    0,
                    1,
                    0,
                  ],
                  type: 'class',
                },
                {
                  combinator: ' ',
                  left: {
                    list: [
                      {
                        name: '♫',
                        specificity: [
                          0,
                          1,
                          0,
                        ],
                        type: 'class',
                      },
                    ],
                    specificity: [
                      0,
                      1,
                      0,
                    ],
                    type: 'compound',
                  },
                  specificity: [
                    0,
                    1,
                    0,
                  ],
                  type: 'combinator',
                },
              ],
              specificity: [
                0,
                2,
                0,
              ],
              type: 'compound',
            },
            specificity: [
              0,
              2,
              0,
            ],
            type: 'combinator',
          },
        ],
        specificity: [
          0,
          3,
          0,
        ],
        type: 'compound',
      },
      specificity: [
        0,
        3,
        0,
      ],
      type: 'combinator',
    },
  ],
  specificity: [
    0,
    4,
    0,
  ],
  type: 'compound',
}

emoji in selectors

parse1('.👩‍🚀\d83d\dc69\200d\d83d\de80 \1f469\200d\1f680')

{
  list: [
    {
      name: '👩‍🚀👩‍🚀👩‍🚀',
      specificity: [
        0,
        1,
        0,
      ],
      type: 'class',
    },
  ],
  specificity: [
    0,
    1,
    0,
  ],
  type: 'compound',
}