Sha256: f82e7e055ba22ecc3b56c1d1f57b869f27f44d7c4c71471e586f3cb188ca6339

Contents?: true

Size: 1.7 KB

Versions: 14

Compression:

Stored size: 1.7 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

  context 'when a decimal value appears in a single-quoted string' do
    let(:scss) { <<-SCSS }
      p {
        content: '1.0';
      }
    SCSS

    it { should_not report_lint }
  end

  context 'when a decimal value appears in a double-quoted string' do
    let(:scss) { <<-SCSS }
      p {
        content: "1.0";
      }
    SCSS

    it { should_not report_lint }
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
scss_lint-0.49.0 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss_lint-0.48.0 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss_lint-0.47.1 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss_lint-0.47.0 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss_lint-0.46.0 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss_lint-0.45.0 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss_lint-0.44.0 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss_lint-0.43.2 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss_lint-0.43.1 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss_lint-0.43.0 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss_lint-0.42.2 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss_lint-0.42.1 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss_lint-0.42.0 spec/scss_lint/linter/unnecessary_mantissa_spec.rb
scss_lint-0.41.0 spec/scss_lint/linter/unnecessary_mantissa_spec.rb