Sha256: 5af71e24b48cdafab7619d3af3d3f235f236ec4f7baa9463cddc1d49475be327

Contents?: true

Size: 1.33 KB

Versions: 11

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe SCSSLint::Linter::UnnecessaryMantissa do
  context 'when value is zero' do
    let(:scss) { <<-SCSS }
      p {
        margin: 0;
        padding: func(0);
        top: 0em;
      }
    SCSS

    it { should_not report_lint }
  end

  context 'when value contains no mantissa' do
    let(:scss) { <<-SCSS }
      p {
        margin: 1;
        padding: func(1);
        top: 1em;
      }
    SCSS

    it { should_not report_lint }
  end

  context 'when value contains a mantissa with a zero' do
    let(:scss) { <<-SCSS }
      p {
        margin: 1.0;
        padding: func(1.0);
        top: 1.0em;
      }
    SCSS

    it { should report_lint line: 2 }
    it { should report_lint line: 3 }
    it { should report_lint line: 4 }
  end

  context 'when value contains a mantissa with multiple zeroes' do
    let(:scss) { <<-SCSS }
      p {
        margin: 1.000;
        padding: func(1.000);
        top: 1.000em;
      }
    SCSS

    it { should report_lint line: 2 }
    it { should report_lint line: 3 }
    it { should report_lint line: 4 }
  end

  context 'when value contains a mantissa with multiple zeroes followed by a number' do
    let(:scss) { <<-SCSS }
      p {
        margin: 1.0001;
        padding: func(1.0001);
        top: 1.0001em;
      }
    SCSS

    it { should_not report_lint }
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
scss_lint-0.40.1 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss_lint-0.40.0 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss_lint-0.39.0 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss_lint-0.38.0 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss-lint-0.38.0 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss-lint-bliss-1.0.0 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss-lint-0.37.0 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss-lint-0.36.1 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss-lint-0.36.0 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss-lint-0.35.0 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss-lint-0.34.0 spec/scss_lint/linter/unnecessary_mantissa_spec.rb