Sha256: efce4e9096126a99e7668c935f4d204e7006492971779e3a14853e0bed5f54d6

Contents?: true

Size: 1005 Bytes

Versions: 6

Compression:

Stored size: 1005 Bytes

Contents

require 'spec_helper'

describe Slacken::Filters::SanitizeTable, dsl: true do
  describe '#valid?' do
    subject { described_class.new.valid?(component) }

    context 'when a pre tag occurs in a table' do
      let(:component) do
        c(:table,
          c(:thead,
            c(:tr,
              c(:th, text('Header1')),
              c(:th, text('Header2')))),
          c(:tbody,
            c(:tr,
              c(:td, text('Content1')),
              c(:td, c(:pre, (text('Content2')))))))
      end

      it { is_expected.to be_falsey }
    end

    context 'when only allowed tags occur in a table' do
      let(:component) do
        c(:table,
          c(:thead,
            c(:tr,
              c(:th, text('Header1')),
              c(:th, c(:span, c(:i, text('Header2')))))),
          c(:tbody,
            c(:tr,
              c(:td, c(:code, text('Content1'))),
              c(:td, c(:strong, text('Content2'))))))
      end

      it { is_expected.to be_truthy }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
slacken-0.1.6 spec/slacken/filters/sanitize_table_spec.rb
slacken-0.1.5 spec/slacken/filters/sanitize_table_spec.rb
slacken-0.1.4 spec/slacken/filters/sanitize_table_spec.rb
slacken-0.1.3 spec/slacken/filters/sanitize_table_spec.rb
slacken-0.1.2 spec/slacken/filters/sanitize_table_spec.rb
slacken-0.1.1 spec/slacken/filters/sanitize_table_spec.rb