feat: Updated the design of the category page (#8165)

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Sivin Varghese
2023-11-09 07:33:16 +05:30
committed by GitHub
parent 268e26625b
commit 950f085e80
8 changed files with 77 additions and 44 deletions

View File

@@ -119,4 +119,19 @@ describe PortalHelper do
end
end
end
describe '#render_category_content' do
let(:markdown_content) { 'This is a *test* markdown content' }
let(:plain_text_content) { 'This is a test markdown content' }
let(:renderer) { instance_double(ChatwootMarkdownRenderer) }
before do
allow(ChatwootMarkdownRenderer).to receive(:new).with(markdown_content).and_return(renderer)
allow(renderer).to receive(:render_markdown_to_plain_text).and_return(plain_text_content)
end
it 'converts markdown to plain text' do
expect(helper.render_category_content(markdown_content)).to eq(plain_text_content)
end
end
end

View File

@@ -2,6 +2,7 @@ require 'rails_helper'
RSpec.describe ChatwootMarkdownRenderer do
let(:markdown_content) { 'This is a *test* content with ^markdown^' }
let(:plain_text_content) { 'This is a test content with markdown' }
let(:doc) { instance_double(CommonMarker::Node) }
let(:renderer) { described_class.new(markdown_content) }
let(:markdown_renderer) { instance_double(CustomMarkdownRenderer) }
@@ -44,4 +45,16 @@ RSpec.describe ChatwootMarkdownRenderer do
expect(rendered_message).to be_html_safe
end
end
describe '#render_markdown_to_plain_text' do
let(:rendered_content) { renderer.render_markdown_to_plain_text }
before do
allow(doc).to receive(:to_plaintext).and_return(plain_text_content)
end
it 'renders the markdown content to plain text' do
expect(rendered_content).to eq(plain_text_content)
end
end
end