Sha256: 2ca8d8d3520ba37e1d8bf04986663c28d640d14fd61bd396c5a157a31426069b

Contents?: true

Size: 1.71 KB

Versions: 10

Compression:

Stored size: 1.71 KB

Contents

require 'spec_helper'

describe SCSSLint::Linter::SingleLinePerProperty do
  context 'when properties are each on their own line' do
    let(:css) { <<-CSS }
      p {
        color: #fff;
        margin: 0;
        padding: 5px;
      }
    CSS

    it { should_not report_lint }
  end

  context 'when two properties share a line' do
    let(:css) { <<-CSS }
      p {
        color: #fff;
        margin: 0; padding: 5px;
      }
    CSS

    it { should_not report_lint line: 2 }
    it { should report_lint line: 3, count: 1 }
  end

  context 'when multiple properties share a line' do
    let(:css) { <<-CSS }
      p {
        color: #fff; margin: 0; padding: 5px;
      }
    CSS

    it { should report_lint line: 2, count: 2 }
  end

  context 'when multiple properties share a line on a single line rule set' do
    let(:css) { <<-CSS }
      p { color: #fff; margin: 0; padding: 5px; }
    CSS

    context 'and single line rule sets are allowed' do
      let(:linter_config) { { 'allow_single_line_rule_sets' => true } }

      it { should_not report_lint }
    end

    context 'and single line rule sets are not allowed' do
      let(:linter_config) { { 'allow_single_line_rule_sets' => false } }

      it { should report_lint }
    end
  end

  context 'when a single line rule set contains a single property' do
    let(:css) { <<-CSS }
      p { color: #fff; }
    CSS

    context 'and single line rule sets are allowed' do
      let(:linter_config) { { 'allow_single_line_rule_sets' => true } }

      it { should_not report_lint }
    end

    context 'and single line rule sets are not allowed' do
      let(:linter_config) { { 'allow_single_line_rule_sets' => false } }

      it { should report_lint }
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
scss-lint-0.33.0 spec/scss_lint/linter/single_line_per_property_spec.rb
scss-lint-0.32.0 spec/scss_lint/linter/single_line_per_property_spec.rb
scss-lint-0.31.0 spec/scss_lint/linter/single_line_per_property_spec.rb
scss-lint-0.30.0 spec/scss_lint/linter/single_line_per_property_spec.rb
scss-lint-0.29.0 spec/scss_lint/linter/single_line_per_property_spec.rb
scss-lint-0.28.0 spec/scss_lint/linter/single_line_per_property_spec.rb
scss-lint-0.27.0 spec/scss_lint/linter/single_line_per_property_spec.rb
scss-lint-0.26.2 spec/scss_lint/linter/single_line_per_property_spec.rb
scss-lint-0.26.1 spec/scss_lint/linter/single_line_per_property_spec.rb
scss-lint-0.26.0 spec/scss_lint/linter/single_line_per_property_spec.rb