| ... | @@ -28,25 +28,7 @@ describe Banzai::Filter::SuggestionFilter do |
... | @@ -28,25 +28,7 @@ describe Banzai::Filter::SuggestionFilter do |
|
|
let(:data_attr) { Banzai::Filter::SyntaxHighlightFilter::LANG_PARAMS_ATTR }
|
|
let(:data_attr) { Banzai::Filter::SyntaxHighlightFilter::LANG_PARAMS_ATTR }
|
|
|
let(:input) { %(<pre class="code highlight js-syntax-highlight suggestion" #{data_attr}="-3+2"><code>foo\n</code></pre>) }
|
|
let(:input) { %(<pre class="code highlight js-syntax-highlight suggestion" #{data_attr}="-3+2"><code>foo\n</code></pre>) }
|
|
|
|
|
|
|
|
context 'feature disabled' do
|
|
it 'element has correct data-lang-params' do
|
|
|
before do
|
|
|
|
|
stub_feature_flags(multi_line_suggestions: false)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'removes data-lang-params if it matches a multi-line suggestion param' do
|
|
|
|
|
doc = filter(input, default_context)
|
|
|
|
|
pre = doc.css('pre').first
|
|
|
|
|
|
|
|
|
|
expect(pre[data_attr]).to be_nil
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'feature enabled' do
|
|
|
|
|
before do
|
|
|
|
|
stub_feature_flags(multi_line_suggestions: true)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'keeps data-lang-params' do
|
|
|
|
|
doc = filter(input, default_context)
|
|
doc = filter(input, default_context)
|
|
|
pre = doc.css('pre').first
|
|
pre = doc.css('pre').first
|
|
|
|
|
|
| ... | @@ -54,4 +36,3 @@ describe Banzai::Filter::SuggestionFilter do |
... | @@ -54,4 +36,3 @@ describe Banzai::Filter::SuggestionFilter do |
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
end |
|
end |
|
|
end |
|
|