# frozen_string_literal: true

# Autogenerated code. This code was generated by bin/gen-specs.rb. DO NOT EDIT.
# Edits will be lost once the generator is run again.

RSpec.describe "css-parsing-tests: one_component_value.json" do
  it "parses \"\"" do
    style = ""
    tok = MiniCSS::CSS::Tokenizer.new(style, allow_unicode_ranges: true)
    tok.tokenize
    par = MiniCSS::CSS::Parser.new(tok.tokens)
    sheet = [par.parse_component_value]
    r = MiniCSS::AST.convert(sheet)

    match_ast(r) do
      consume_error("empty")
    end
  end

  it "parses \" \"" do
    style = " "
    tok = MiniCSS::CSS::Tokenizer.new(style, allow_unicode_ranges: true)
    tok.tokenize
    par = MiniCSS::CSS::Parser.new(tok.tokens)
    sheet = [par.parse_component_value]
    r = MiniCSS::AST.convert(sheet)

    match_ast(r) do
      consume_error("empty")
    end
  end

  it "parses \"/**/\"" do
    style = "/**/"
    tok = MiniCSS::CSS::Tokenizer.new(style, allow_unicode_ranges: true)
    tok.tokenize
    par = MiniCSS::CSS::Parser.new(tok.tokens)
    sheet = [par.parse_component_value]
    r = MiniCSS::AST.convert(sheet)

    match_ast(r) do
      consume_error("empty")
    end
  end

  it "parses \"  /**/\\t/* a */\\n\\n\"" do
    style = "  /**/\t/* a */\n\n"
    tok = MiniCSS::CSS::Tokenizer.new(style, allow_unicode_ranges: true)
    tok.tokenize
    par = MiniCSS::CSS::Parser.new(tok.tokens)
    sheet = [par.parse_component_value]
    r = MiniCSS::AST.convert(sheet)

    match_ast(r) do
      consume_error("empty")
    end
  end

  it "parses \".\"" do
    style = "."
    tok = MiniCSS::CSS::Tokenizer.new(style, allow_unicode_ranges: true)
    tok.tokenize
    par = MiniCSS::CSS::Parser.new(tok.tokens)
    sheet = [par.parse_component_value]
    r = MiniCSS::AST.convert(sheet)

    match_ast(r) do
      delim "."
    end
  end

  it "parses \"a\"" do
    style = "a"
    tok = MiniCSS::CSS::Tokenizer.new(style, allow_unicode_ranges: true)
    tok.tokenize
    par = MiniCSS::CSS::Parser.new(tok.tokens)
    sheet = [par.parse_component_value]
    r = MiniCSS::AST.convert(sheet)

    match_ast(r) do
      ident "a"
    end
  end

  it "parses \"/**/ 4px\"" do
    style = "/**/ 4px"
    tok = MiniCSS::CSS::Tokenizer.new(style, allow_unicode_ranges: true)
    tok.tokenize
    par = MiniCSS::CSS::Parser.new(tok.tokens)
    sheet = [par.parse_component_value]
    r = MiniCSS::AST.convert(sheet)

    match_ast(r) do
      dimension(4, :integer, "px")
    end
  end

  it "parses \"rgba(100%, 0%, 50%, .5)\"" do
    style = "rgba(100%, 0%, 50%, .5)"
    tok = MiniCSS::CSS::Tokenizer.new(style, allow_unicode_ranges: true)
    tok.tokenize
    par = MiniCSS::CSS::Parser.new(tok.tokens)
    sheet = [par.parse_component_value]
    r = MiniCSS::AST.convert(sheet)

    match_ast(r) do
      function("rgba") do
        percentage(100, :integer)
        delim ","
        delim " "
        percentage(0, :integer)
        delim ","
        delim " "
        percentage(50, :integer)
        delim ","
        delim " "
        number 0.5, :number
      end
    end
  end

  it "parses \" /**/ { foo: bar; @baz [)\"" do
    style = " /**/ { foo: bar; @baz [)"
    tok = MiniCSS::CSS::Tokenizer.new(style, allow_unicode_ranges: true)
    tok.tokenize
    par = MiniCSS::CSS::Parser.new(tok.tokens)
    sheet = [par.parse_component_value]
    r = MiniCSS::AST.convert(sheet)

    match_ast(r) do
      block("{") do
        delim " "
        ident "foo"
        delim ":"
        delim " "
        ident "bar"
        delim ";"
        delim " "
        at_keyword("baz")
        delim " "
        block("[") do
          consume_error(")")
        end
      end
    end
  end

  it "parses \".foo\"" do
    style = ".foo"
    tok = MiniCSS::CSS::Tokenizer.new(style, allow_unicode_ranges: true)
    tok.tokenize
    par = MiniCSS::CSS::Parser.new(tok.tokens)
    sheet = [par.parse_component_value]
    r = MiniCSS::AST.convert(sheet)

    match_ast(r) do
      consume_error("extra-input")
    end
  end

end