Sha256: 8a759ff6204f479f5674dcac1b1f54a4eafbae38c063c7b61edbe1a41ed9a839

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe SCSSLint::Linter::UnnecessaryParentReference do
  context 'when an amperand precedes a direct descendant operator' do
    let(:css) { <<-CSS }
      p {
        & > a {}
      }
    CSS

    it { should report_lint line: 2 }
  end

  context 'when an amperand precedes a general child' do
    let(:css) { <<-CSS }
      p {
        & a {}
      }
    CSS

    it { should report_lint line: 2 }
  end

  context 'when an amperand is chained with class' do
    let(:css) { <<-CSS }
      p {
        &.foo {}
      }
    CSS

    it { should_not report_lint }
  end

  context 'when an amperand follows a direct descendant operator' do
    let(:css) { <<-CSS }
      p {
        .foo > & {}
      }
    CSS

    it { should_not report_lint }
  end

  context 'when an amperand is used in a comma sequence to DRY up code' do
    let(:css) { <<-CSS }
      p {
        &,
        .foo,
        .bar {
          margin: 0;
        }
      }
    CSS

    it { should_not report_lint }
  end

  context 'when an ampersand is used by itself' do
    let(:css) { <<-CSS }
      p {
        & {}
      }
    CSS

    it { should report_lint line: 2 }
  end

  context 'when an ampersand is used in concatentation' do
    let(:css) { <<-CSS }
      .icon {
        &-small {}
      }
    CSS

    it { should_not report_lint }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scss-lint-0.26.2 spec/scss_lint/linter/unnecessary_parent_reference_spec.rb
scss-lint-0.26.1 spec/scss_lint/linter/unnecessary_parent_reference_spec.rb