<commit_before>postcss = require('../lib/postcss')

Stylesheet = require('../lib/postcss/stylesheet')

describe 'postcss()', ->

  it 'creates processors list', ->
    postcss().should.eql { processors: [] }

  it 'saves processors list', ->
    a = -> 1
    b = -> 2
    postcss(a, b).should.eql { processors: [a, b] }

  describe 'parse()', ->

    it 'parses CSS', ->
      stylesheet = postcss.parse('a { }')
      stylesheet.should.be.an.instanceof(Stylesheet)

    it 'throws with file name', ->
      error = null
      try
        postcss.parse('a {', file: 'a.css')
      catch e
        error = e

      e.file.should.eql    'a.css'
      e.message.should.eql 'Unclosed block at line 1:1 in a.css'

describe 'PostCSS', ->
<commit_msg>Add postprocess integration test<commit_after>postcss = require('../lib/postcss')

Stylesheet = require('../lib/postcss/stylesheet')

describe 'postcss()', ->

  it 'creates processors list', ->
    postcss().should.eql { processors: [] }

  it 'saves processors list', ->
    a = -> 1
    b = -> 2
    postcss(a, b).should.eql { processors: [a, b] }

  it 'processes CSS', ->
    processor = postcss (css) ->
      css.eachRule (rule) ->
        return unless rule.selector.match(/::(before|after)/)
        unless rule.decls.some( (i) -> i.prop == 'content' )
          rule.prepend(prop: 'content', value: '""')

    processor.process('a::before{}').should.eql('a::before{content: ""}')

  describe 'parse()', ->

    it 'parses CSS', ->
      stylesheet = postcss.parse('a { }')
      stylesheet.should.be.an.instanceof(Stylesheet)

    it 'throws with file name', ->
      error = null
      try
        postcss.parse('a {', file: 'a.css')
      catch e
        error = e

      e.file.should.eql    'a.css'
      e.message.should.eql 'Unclosed block at line 1:1 in a.css'

describe 'PostCSS', ->

{'fraction_non_alphanumeric': 0.1771397616468039, 'fraction_numerical': 0.004333694474539545, 'mean_word_length': 2.452336448598131, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, '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': '3784956', 'n_tokens_mistral': 651, 'n_tokens_neox': 618, 'n_words': 143}