Sha256: c047bb550ef0227acc9eb52449adc43eb08419e79adc53bcbbe5aff1d38debaa

Contents?: true

Size: 1.58 KB

Versions: 1

Compression:

Stored size: 1.58 KB

Contents

require 'spec_helper'

describe SCSSLint::Linter::BangFormat do
  context 'when no bang is used' do
    let(:css) { <<-CSS }
      p {
        color: #000;
      }
    CSS

    it { should_not report_lint }
  end

  context 'when !important is used correctly' do
    let(:css) { <<-CSS }
      p {
        color: #000 !important;
      }
    CSS

    it { should_not report_lint }
  end

  context 'when !important has no space before' do
    let(:css) { <<-CSS }
      p {
        color: #000!important;
      }
    CSS

    it { should report_lint line: 2 }
  end

  context 'when !important has a space after' do
    let(:css) { <<-CSS }
      p {
        color: #000 ! important;
      }
    CSS

    it { should report_lint line: 2 }
  end

  context 'when !important has a space after and config allows it' do
    let(:linter_config) { { 'space_before_bang' => true, 'space_after_bang' => true } }

    let(:css) { <<-CSS }
      p {
        color: #000 ! important;
      }
    CSS

    it { should_not report_lint }
  end

  context 'when !important has a space before but config does not allow it' do
    let(:linter_config) { { 'space_before_bang' => false, 'space_after_bang' => true } }

    let(:css) { <<-CSS }
      p {
        color: #000 ! important;
      }
    CSS

    it { should report_lint line: 2 }
  end

  context 'when !important has no spaces around and config allows it' do
    let(:linter_config) { { 'space_before_bang' => false, 'space_after_bang' => false } }

    let(:css) { <<-CSS }
      p {
        color: #000!important;
      }
    CSS

    it { should_not report_lint }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scss-lint-0.30.0 spec/scss_lint/linter/bang_format_spec.rb