Sha256: 8cb38c2c64d8748d796438d11da55e67afc62819ca7a6a9391416200bc73de19

Contents?: true

Size: 1.55 KB

Versions: 8

Compression:

Stored size: 1.55 KB

Contents

require 'spec_helper'

describe SCSSLint::Linter::ColorKeyword do
  context 'when a color is specified as a hex' do
    let(:scss) { <<-SCSS }
      p {
        color: #fff;
      }
    SCSS

    it { should_not report_lint }
  end

  context 'when a color is specified as a keyword' do
    let(:scss) { <<-SCSS }
      p {
        color: white;
      }
    SCSS

    it { should report_lint line: 2 }
  end

  context 'when a color keyword exists in a shorthand property' do
    let(:scss) { <<-SCSS }
      p {
        border: 1px solid black;
      }
    SCSS

    it { should report_lint line: 2 }
  end

  context 'when a property contains a color keyword as a string' do
    let(:scss) { <<-SCSS }
      p {
        content: 'white';
      }
    SCSS

    it { should_not report_lint }
  end

  context 'when a function call contains a color keyword' do
    let(:scss) { <<-SCSS }
      p {
        color: function(red);
      }
    SCSS

    it { should report_lint line: 2 }
  end

  context 'when a mixin include contains a color keyword' do
    let(:scss) { <<-SCSS }
      p {
        @include some-mixin(red);
      }
    SCSS

    it { should report_lint line: 2 }
  end

  context 'when the "transparent" color keyword is used' do
    let(:scss) { <<-SCSS }
      p {
        @include mixin(transparent);
      }
    SCSS

    it { should_not report_lint }
  end

  context 'when color keyword appears in a string identifier' do
    let(:scss) { <<-SCSS }
      p {
        content: content-with-blue-in-name;
      }
    SCSS

    it { should_not report_lint }
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
scss_lint-0.38.0 spec/scss_lint/linter/color_keyword_spec.rb
scss-lint-0.38.0 spec/scss_lint/linter/color_keyword_spec.rb
scss-lint-bliss-1.0.0 spec/scss_lint/linter/color_keyword_spec.rb
scss-lint-0.37.0 spec/scss_lint/linter/color_keyword_spec.rb
scss-lint-0.36.1 spec/scss_lint/linter/color_keyword_spec.rb
scss-lint-0.36.0 spec/scss_lint/linter/color_keyword_spec.rb
scss-lint-0.35.0 spec/scss_lint/linter/color_keyword_spec.rb
scss-lint-0.34.0 spec/scss_lint/linter/color_keyword_spec.rb