Sha256: d32f6a6a0f790b0327da8c80f9799e27daf0c44980d818bd341e6f841969b875

Contents?: true

Size: 1.59 KB

Versions: 10

Compression:

Stored size: 1.59 KB

Contents

require 'spec_helper'

describe SCSSLint::Linter::Comment do
  context 'when no comments exist' do
    let(:scss) { <<-SCSS }
      p {
        margin: 0;
      }
    SCSS

    it { should_not report_lint }
  end

  context 'when comment is a single line comment' do
    let(:scss) { '// Single line comment' }

    it { should_not report_lint }
  end

  context 'when comment is a single line comment at the end of a line' do
    let(:scss) { <<-SCSS }
      p {
        margin: 0; // Comment at end of line
      }
    SCSS

    it { should_not report_lint }
  end

  context 'when comment is a multi-line comment' do
    let(:scss) { <<-SCSS }
      h1 {
        color: #eee;
      }
      /*
       * This is a multi-line comment that should report a lint
       */
      p {
        color: #DDD;
      }
    SCSS

    it { should report_lint line: 4 }
  end

  context 'when multi-line-style comment is a at the end of a line' do
    let(:scss) { <<-SCSS }
      h1 {
        color: #eee; /* This is a comment */
      }
    SCSS

    it { should report_lint line: 2 }
  end

  context 'when multi-line comment is allowed by config' do
    let(:linter_config) { { 'allowed' => '^[/\\* ]*Copyright' } }
    let(:scss) { <<-SCSS }
      /* Copyright someone. */
      a {
        color: #DDD;
      }
    SCSS

    it { should_not report_lint }
  end

  context 'when multi-line comment is not allowed by config' do
    let(:linter_config) { { 'allowed' => '^[/\\* ]*Copyright' } }
    let(:scss) { <<-SCSS }
      /* Other multiline. */
      p {
        color: #DDD;
      }
    SCSS

    it { should report_lint }
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
scss_lint-0.42.2 spec/scss_lint/linter/comment_spec.rb
scss_lint-0.42.1 spec/scss_lint/linter/comment_spec.rb
scss_lint-0.42.0 spec/scss_lint/linter/comment_spec.rb
scss_lint-0.41.0 spec/scss_lint/linter/comment_spec.rb
scss_lint-0.40.1 spec/scss_lint/linter/comment_spec.rb
scss_lint-0.40.0 spec/scss_lint/linter/comment_spec.rb
scss_lint-0.39.0 spec/scss_lint/linter/comment_spec.rb
scss_lint-0.38.0 spec/scss_lint/linter/comment_spec.rb
scss-lint-0.38.0 spec/scss_lint/linter/comment_spec.rb
scss-lint-bliss-1.0.0 spec/scss_lint/linter/comment_spec.rb