Sha256: fd8069c7abe3ad55d542ff79ac42cbee5c7f5c26bb5247b718656575cc36f2e0

Contents?: true

Size: 1.04 KB

Versions: 26

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'

describe SCSSLint::Linter::HexValidation do
  context 'when rule is empty' do
    let(:scss) { <<-SCSS }
      p {
      }
    SCSS

    it { should_not report_lint }
  end

  context 'when rule contains valid hex codes or color keyword' do
    gradient_css = 'progid:DXImageTransform.Microsoft.gradient' \
                   '(startColorstr=#99000000, endColorstr=#99000000)'

    let(:scss) { <<-SCSS }
      p {
        background: #000;
        color: #FFFFFF;
        border-color: red;
        filter: #{gradient_css};
      }
    SCSS

    it { should_not report_lint }
  end

  context 'when rule contains invalid hex codes' do
    let(:scss) { <<-SCSS }
      p {
        background: #dd;
        color: #dddd;
      }
    SCSS

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

  context 'when rule contains hex codes in a longer string' do
    let(:scss) { <<-SCSS }
      p {
        content: 'foo#bad';
        content: 'foo #ba';
      }
    SCSS

    it { should report_lint line: 3 }
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
scss_lint-0.45.0 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.44.0 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.43.2 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.43.1 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.43.0 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.42.2 spec/scss_lint/linter/hex_validation_spec.rb