Sha256: 97cf8bbb64b8f64a97bffa12a4faa1887ddb16052ef02550142cd21e76e22b01

Contents?: true

Size: 1.91 KB

Versions: 1

Compression:

Stored size: 1.91 KB

Contents

require 'spec_helper'

describe SCSSLint::Linter::ColorVariable do
  context 'when a color literal is used in a variable declaration' do
    let(:scss) { <<-SCSS }
      $my-color: #f00;
    SCSS

    it { should_not report_lint }
  end

  context 'when a color literal is used in a property' do
    let(:scss) { <<-SCSS }
      p {
        color: #f00;
      }
    SCSS

    it { should report_lint line: 2 }
  end

  context 'when a color literal is used in a function call' do
    let(:scss) { <<-SCSS }
      p {
        color: my-func(#f00);
      }
    SCSS

    it { should report_lint line: 2 }
  end

  context 'when a color literal is used in a mixin' do
    let(:scss) { <<-SCSS }
      p {
        @include my-mixin(#f00);
      }
    SCSS

    it { should report_lint line: 2 }
  end

  context 'when a color literal is used in a shorthand property' do
    let(:scss) { <<-SCSS }
      p {
        border: 1px solid #f00;
      }
    SCSS

    it { should report_lint line: 2 }
  end

  context 'when a number is used in a property' do
    let(:scss) { <<-SCSS }
      p {
        z-index: 9000;
        transition-duration: 250ms;
      }
    SCSS

    it { should_not report_lint }
  end

  context 'when a non-color keyword is used in a property' do
    let(:scss) { <<-SCSS }
      p {
        overflow: hidden;
      }
    SCSS

    it { should_not report_lint }
  end

  context 'when a variable is used in a property' do
    let(:scss) { <<-SCSS }
      p {
        color: $my-color;
      }
    SCSS

    it { should_not report_lint }
  end

  context 'when a variable is used in a function call' do
    let(:scss) { <<-SCSS }
      p {
        color: my-func($my-color);
      }
    SCSS

    it { should_not report_lint }
  end

  context 'when a variable is used in a shorthand property' do
    let(:scss) { <<-SCSS }
      p {
        border: 1px solid $my-color;
      }
    SCSS

    it { should_not report_lint }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scss-lint-0.34.0 spec/scss_lint/linter/color_variable_spec.rb