Sha256: d0b45867310fa5213c3dc8a880aa5c0714a44bef3426bc5a759ea0f1ee6d688f

Contents?: true

Size: 1.23 KB

Versions: 40

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

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

    it { should_not report_lint }
  end

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

    it { should report_lint line: 1 }
  end

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

    it { should_not report_lint }
  end

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

    it { should_not report_lint }
  end

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

    it { should report_lint line: 1 }
  end

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

    it { should report_lint line: 1 }
  end

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

    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(:scss) { <<-SCSS }
        #identifier,
        .class,
        a {
        }
      SCSS

      it { should report_lint line: 1 }
    end
  end
end

Version data entries

40 entries across 40 versions & 3 rubygems

Version Path
scss_lint-0.45.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.44.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.43.2 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.43.1 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.43.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.42.2 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.42.1 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.42.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.41.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.40.1 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.40.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.39.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.38.0 spec/scss_lint/linter/id_selector_spec.rb
scss-lint-0.38.0 spec/scss_lint/linter/id_selector_spec.rb
scss-lint-bliss-1.0.0 spec/scss_lint/linter/id_selector_spec.rb
scss-lint-0.37.0 spec/scss_lint/linter/id_selector_spec.rb
scss-lint-0.36.1 spec/scss_lint/linter/id_selector_spec.rb
scss-lint-0.36.0 spec/scss_lint/linter/id_selector_spec.rb
scss-lint-0.35.0 spec/scss_lint/linter/id_selector_spec.rb
scss-lint-0.34.0 spec/scss_lint/linter/id_selector_spec.rb