<commit_before>import {
  ruleTester,
  warningFreeBasics,
} from "../../../testUtils"
import rule, { ruleName, messages } from ".."

const testRule = ruleTester(rule, ruleName)

testRule({
  // regular string
  "text-transform": ["uppercase"],
  // regexes
  "transform": [ "/scale3d/", "/rotate3d/", "/translate3d/" ],
  // mixed string and regex
  "color": [ "red", "green", "blue", "/^sea/" ],
}, tr => {
  warningFreeBasics(tr)

  tr.ok("a { color: pink; }")
  tr.ok("a { color: lightgreen; }")
  tr.ok("a { text-transform: lowercase; }")
  tr.ok("a { transform: matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0) translate(12px, 50%); }")

  tr.ok("a { color: /* red */ pink; }", "ignore value within comments")
  tr.ok("a::before { color: \"red\"}", "ignore value within quotes")

  tr.ok("a { color: $red; }", "ignore preprocessor variable includes value")
  tr.ok("a { color: --some-red; }", "ignore css variable includes value")

  tr.notOk("a { color: red; }", {
    message: messages.rejected("color", "red"),
    line: 1,
    column: 16,
  })

  tr.notOk("a { color: green }", {
    message: messages.rejected("color", "green"),
    line: 1,
    column: 20,
  })

  tr.notOk("a { text-transform: uppercase; }", {
    message: messages.rejected("text-transform", "uppercase"),
    line: 1,
    column: 28,
  })

  tr.notOk("a { transform: scale3d(1, 2, 3) }", {
    message: messages.rejected("transform", "scale3d(1, 2, 3)"),
    line: 1,
    column: 39,
  })

  tr.notOk("a { -webkit-transform: scale3d(1, 2, 3) }", {
    message: messages.rejected("-webkit-transform", "scale3d(1, 2, 3)"),
    column: 25,
  })

  tr.ok("a { color: darkseagreen }", {
    message: messages.rejected("color", "darkseagreen"),
    column: 25,
  })
  tr.notOk("a { color: seagreen }", {
    message: messages.rejected("color", "seagreen"),
    column: 25,
  })

})<commit_msg>Fix column numbers in test<commit_after>import {
  ruleTester,
  warningFreeBasics,
} from "../../../testUtils"
import rule, { ruleName, messages } from ".."

const testRule = ruleTester(rule, ruleName)

testRule({
  // regular string
  "text-transform": ["uppercase"],
  // regexes
  "transform": [ "/scale3d/", "/rotate3d/", "/translate3d/" ],
  // mixed string and regex
  "color": [ "red", "green", "blue", "/^sea/" ],
}, tr => {
  warningFreeBasics(tr)

  tr.ok("a { color: pink; }")
  tr.ok("a { color: lightgreen; }")
  tr.ok("a { text-transform: lowercase; }")
  tr.ok("a { transform: matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0) translate(12px, 50%); }")

  tr.ok("a { color: /* red */ pink; }", "ignore value within comments")
  tr.ok("a::before { color: \"red\"}", "ignore value within quotes")

  tr.ok("a { color: $red; }", "ignore preprocessor variable includes value")
  tr.ok("a { color: --some-red; }", "ignore css variable includes value")

  tr.notOk("a { color: red; }", {
    message: messages.rejected("color", "red"),
    line: 1,
    column: 5,
  })

  tr.notOk("a { color: green }", {
    message: messages.rejected("color", "green"),
    line: 1,
    column: 5,
  })

  tr.notOk("a { text-transform: uppercase; }", {
    message: messages.rejected("text-transform", "uppercase"),
    line: 1,
    column: 5,
  })

  tr.notOk("a { transform: scale3d(1, 2, 3) }", {
    message: messages.rejected("transform", "scale3d(1, 2, 3)"),
    line: 1,
    column: 5,
  })

  tr.notOk("a { -webkit-transform: scale3d(1, 2, 3) }", {
    message: messages.rejected("-webkit-transform", "scale3d(1, 2, 3)"),
    column: 5,
  })

  tr.ok("a { color: darkseagreen }", {
    message: messages.rejected("color", "darkseagreen"),
    column: 5,
  })
  tr.notOk("a { color: seagreen }", {
    message: messages.rejected("color", "seagreen"),
    column: 5,
  })

})
{'fraction_non_alphanumeric': 0.2172043010752688, 'fraction_numerical': 0.02661290322580645, 'mean_word_length': 3.281933256616801, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6956206', 'n_tokens_mistral': 1460, 'n_tokens_neox': 1378, 'n_words': 318}