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.60.0 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.59.0 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.58.0 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.57.1 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.57.0 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.56.0 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.55.0 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.54.0 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.53.0 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.52.0 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.51.0 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.50.3 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.50.2 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.50.1 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.50.0 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.49.0 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.48.0 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.47.1 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.47.0 spec/scss_lint/linter/hex_validation_spec.rb
scss_lint-0.46.0 spec/scss_lint/linter/hex_validation_spec.rb