<commit_before>/* See license.txt for terms of usage */
function runTest() {
  FBTest.loadScript("FBTestFireformat.js", this);
  var prefs = new FBTestFireformat.PrefHandler([
       "fireformatCssFormatter.wrapSize",
       "fireformatCssFormatter.selectorText.selectorsPerLine",
       "fireformatCssFormatter.selectorText.spaceCount",
       "fireformatCssFormatter.selectorText.indentLevel"
  ]);

  var formatter = Format.Formatters.getFormatter("com.incaseofstairs.fireformatCSSFormatter");
  function getStyle(selectorText) {
    var style = {
      type: CSSRule.STYLE_RULE,
      selectorText: selectorText,
      style: { cssText: "" }
    };
    return formatter.format(style).replace(/\s*\{[\S\s]*?\}[\S\s]*/, "");
  }
  
  // Formatting with a single token
  FBTest.compare(".single", getStyle(".single"), "Single Token");
  
  // Formatting with multiple tokens, no wrap
  prefs.setPrefs(80, 3, 1, 0);
  FBTest.compare(".single, .double, .triple", getStyle(".single, .double, .triple"), "Formatting with multiple tokens, no wrap");

  // Formatting with multiple tokens, token wrap, no indent
  prefs.setPrefs(80, 2, 1, 0);
  FBTest.compare(".single, .double,\n.triple", getStyle(".single, .double, .triple"), "Formatting with multiple tokens, token wrap, no indent");

  // Formatting with multiple tokens, token wrap, indent
  prefs.setPrefs(80, 2, 2, 1);
  FBTest.compare(".single,  .double,\n  .triple", getStyle(".single, .double, .triple"), "Formatting with multiple tokens, token wrap, indent");

  // Formatting with multiple tokens, char wrap, no indent
  prefs.setPrefs(10, 3, 1, 0);
  FBTest.compare(".single, .double,\n.triple", getStyle(".single, .double, .triple"), "Formatting with multiple tokens, char wrap, no indent");

  // Formatting with multiple tokens, char wrap, indent
  prefs.setPrefs(11, 3, 2, 1);
  FBTest.compare(".single,  .double,\n  .triple", getStyle(".single, .double, .triple"), "Formatting with multiple tokens, char wrap, indent");

  // Formatting with advanced selectors, char wrap, indent
  prefs.setPrefs(10, 3, 2, 1);
  FBTest.compare(".single[name] > DIV.test + *,\n  .double:focus,\n  .triple#myid", getStyle(".single[name] > DIV.test + *, .double:focus, .triple#myid"), "Multiple no wrap");


  // Formatting with comma strings in the selector
  prefs.setPrefs(10, 1, 2, 1);
  FBTest.compare(".single[test=\"fail, fail\"] > DIV.test + *,\n  .double:focus,\n  .triple#myid", getStyle(".single[test=\"fail, fail\"] > DIV.test + *, .double:focus, .triple#myid"), "Comma selector string 1");
  FBTest.compare(".single[test=\'fail, fail\'] > DIV.test + *,\n  .double:focus,\n  .triple#myid", getStyle(".single[test=\'fail, fail\'] > DIV.test + *, .double:focus, .triple#myid"), "Comma selector string 2");
  <commit_msg>Test for selector formatting with multiple classes.<commit_after>/* See license.txt for terms of usage */
function runTest() {
  FBTest.loadScript("FBTestFireformat.js", this);
  var prefs = new FBTestFireformat.PrefHandler([
       "fireformatCssFormatter.wrapSize",
       "fireformatCssFormatter.selectorText.selectorsPerLine",
       "fireformatCssFormatter.selectorText.spaceCount",
       "fireformatCssFormatter.selectorText.indentLevel"
  ]);

  var formatter = Format.Formatters.getFormatter("com.incaseofstairs.fireformatCSSFormatter");
  function getStyle(selectorText) {
    var style = {
      type: CSSRule.STYLE_RULE,
      selectorText: selectorText,
      style: { cssText: "" }
    };
    return formatter.format(style).replace(/\s*\{[\S\s]*?\}[\S\s]*/, "");
  }
  function getMultipleStyle() {
    var style = {
      cssRules: [
        {
          type: CSSRule.STYLE_RULE,
          selectorText: ".single",
          style: { cssText: "" }
        },
        {
          type: CSSRule.STYLE_RULE,
          selectorText: ".single[name] > DIV.test + *, .double:focus, .triple#myid",
          style: { cssText: "" }
        }
      ]
    };
    return formatter.format(style).replace(/\s*\{[\S\s]*?\}\s*/g, "|");
  }
  
  // Formatting with a single token
  FBTest.compare(".single", getStyle(".single"), "Single Token");
  
  // Formatting with multiple tokens, no wrap
  prefs.setPrefs(80, 3, 1, 0);
  FBTest.compare(".single, .double, .triple", getStyle(".single, .double, .triple"), "Formatting with multiple tokens, no wrap");

  // Formatting with multiple tokens, token wrap, no indent
  prefs.setPrefs(80, 2, 1, 0);
  FBTest.compare(".single, .double,\n.triple", getStyle(".single, .double, .triple"), "Formatting with multiple tokens, token wrap, no indent");

  // Formatting with multiple tokens, token wrap, indent
  prefs.setPrefs(80, 2, 2, 1);
  FBTest.compare(".single,  .double,\n  .triple", getStyle(".single, .double, .triple"), "Formatting with multiple tokens, token wrap, indent");

  // Formatting with multiple tokens, char wrap, no indent
  prefs.setPrefs(10, 3, 1, 0);
  FBTest.compare(".single, .double,\n.triple", getStyle(".single, .double, .triple"), "Formatting with multiple tokens, char wrap, no indent");

  // Formatting with multiple tokens, char wrap, indent
  prefs.setPrefs(11, 3, 2, 1);
  FBTest.compare(".single,  .double,\n  .triple", getStyle(".single, .double, .triple"), "Formatting with multiple tokens, char wrap, indent");

  // Formatting with advanced selectors, token wrap, indent
  prefs.setPrefs(80, 2, 1, 1);
  FBTest.compare(".single[name] > DIV.test + *, .double:focus,\n  .triple#myid", getStyle(".single[name] > DIV.test + *, .double:focus, .triple#myid"), "Formatting with advanced selectors, token wrap, indent");

  // Formatting with advanced selectors, char wrap, indent
  prefs.setPrefs(10, 3, 2, 1);
  FBTest.compare(".single[name] > DIV.test + *,\n  .double:focus,\n  .triple#myid", getStyle(".single[name] > DIV.test + *, .double:focus, .triple#myid"), "Formatting with advanced selectors, char wrap, indent");

  // Formatting with multiple rules, token wrap
  prefs.setPrefs(80, 2, 1, 1);
  FBTest.compare(".single|.single[name] > DIV.test + *, .double:focus,\n  .triple#myid|", getMultipleStyle(), "Formatting with multiple rules, token wrap");

  // Formatting with comma strings in the selector
  prefs.setPrefs(10, 1, 1, 1);
  FBTest.compare(".single[test=\"fail, fail\"] > DIV.test + *,\n  .double:focus,\n  .triple#myid", getStyle(".single[test=\"fail, fail\"] > DIV.test + *, .double:focus, .triple#myid"), "Comma selector string 1");
  FBTest.compare(".single[test=\'fail, fail\'] > DIV.test + *,\n  .double:focus,\n  .triple#myid", getStyle(".single[test=\'fail, fail\'] > DIV.test + *, .double:focus, .triple#myid"), "Comma selector string 2");
  

  
{'fraction_non_alphanumeric': 0.17114397826743133, 'fraction_numerical': 0.012677331723513431, 'mean_word_length': 3.809143686502177, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '3513499', 'n_tokens_mistral': 2275, 'n_tokens_neox': 2140, 'n_words': 533}