Sha256: 1cf4281051d4cd32d2d9c46ede2751e60eece6ca9390c7ade54196cd5ee11284

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 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
end

Version data entries

1 entries across 1 versions & 1 rubygems

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