Sha256: 4eb25cb4fbb57ab61fc3837e80eddda649b80ce7ad8153fea47bb2bdeb589611

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'

describe SCSSLint::Linter::IdSelector do
  context 'when rule is a type' do
    let(:css) { 'p {}' }

    it { should_not report_lint }
  end

  context 'when rule is an ID' do
    let(:css) { '#identifier {}' }

    it { should report_lint line: 1 }
  end

  context 'when rule is a class' do
    let(:css) { '.class {}' }

    it { should_not report_lint }
  end

  context 'when rule is a type with a class' do
    let(:css) { 'a.class {}' }

    it { should_not report_lint }
  end

  context 'when rule is a type with an ID' do
    let(:css) { 'a#identifier {}' }

    it { should report_lint line: 1 }
  end

  context 'when rule is an ID with a pseudo-selector' do
    let(:css) { '#identifier:active {}' }

    it { should report_lint line: 1 }
  end

  context 'when rule contains a nested rule with type and ID' do
    let(:css) { <<-CSS }
      p {
        a#identifier {}
      }
    CSS

    it { should report_lint line: 2 }
  end

  context 'when rule contains multiple selectors' do
    context 'when all of the selectors are just IDs, classes, or types' do
      let(:css) { <<-CSS }
        #identifier,
        .class,
        a {
        }
      CSS

      it { should report_lint line: 1 }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
scss-lint-0.33.0 spec/scss_lint/linter/id_selector_spec.rb
scss-lint-0.32.0 spec/scss_lint/linter/id_selector_spec.rb
scss-lint-0.31.0 spec/scss_lint/linter/id_selector_spec.rb