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.60.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.59.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.58.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.57.1 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.57.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.56.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.55.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.54.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.53.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.52.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.51.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.50.3 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.50.2 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.50.1 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.50.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.49.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.48.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.47.1 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.47.0 spec/scss_lint/linter/id_selector_spec.rb
scss_lint-0.46.0 spec/scss_lint/linter/id_selector_spec.rb