Sha256: 3e4ef576d0a5655e814b83df27ec336ac05044b7c054bbb4360fd4803c93d4ac

Contents?: true

Size: 1.53 KB

Versions: 10

Compression:

Stored size: 1.53 KB

Contents

require 'spec_helper'

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

    it { should_not report_lint }
  end

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

    it { should report_lint line: 2 }
  end

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

    it { should report_lint line: 2 }
  end

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

    it { should_not report_lint }
  end

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

    it { should report_lint line: 2 }
  end

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

    it { should report_lint line: 2 }
  end

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

    it { should_not report_lint }
  end

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

    it { should_not report_lint }
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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