Sha256: e187eff773fce9c8c62eba20524c029e0f47ebf0a548be0ed1949698262765b9

Contents?: true

Size: 1.4 KB

Versions: 5

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

describe SCSSLint::Linter::CapitalizationInSelector do
  context 'when selector is all lowercase' do
    let(:css) { <<-CSS }
      span {
      }
    CSS

    it { should_not report_lint }
  end

  context 'when selector is lowercase with non-alphabetic characters' do
    let(:css) { <<-CSS }
      .foo-bar {
      }
    CSS

    it { should_not report_lint }
  end

  context 'when selector is camelCase' do
    let(:css) { <<-CSS }
      .fooBar {
      }
    CSS

    it { should report_lint line: 1 }
  end

  context 'when selector is UPPER CASE' do
    let(:css) { <<-CSS }
      SPAN {
      }
    CSS

    it { should report_lint line: 1 }
  end

  context 'when attribute selector has attribute containing uppercase letters' do
    let(:css) { <<-CSS }
      [dataText] {
      }
    CSS

    it { should report_lint line: 1 }
  end

  context 'when attribute selector has value containing uppercase letters' do
    let(:css) { <<-CSS }
      [data-text=someText] {
      }
    CSS

    it { should_not report_lint }
  end

  context 'when a selector name is whitelisted' do
    let(:linter_config) { { 'ignored_names' => %w[Foo] } }
    let(:css) { '.Foo {}' }

    it { should_not report_lint }
  end

  context 'when a certain type of selector is ignored' do
    let(:linter_config) { { 'ignored_types' => %w[class] } }
    let(:css) { '.Foo {}' }

    it { should_not report_lint }
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
scss-lint-0.28.0 spec/scss_lint/linter/capitalization_in_selector_spec.rb
scss-lint-0.27.0 spec/scss_lint/linter/capitalization_in_selector_spec.rb
scss-lint-0.26.2 spec/scss_lint/linter/capitalization_in_selector_spec.rb
scss-lint-0.26.1 spec/scss_lint/linter/capitalization_in_selector_spec.rb
scss-lint-0.26.0 spec/scss_lint/linter/capitalization_in_selector_spec.rb