A platform for community discussion. Free, open, simple.
DEV: correctly tests text is rendered in replies (#20845)
Joffrey JAFFEUX05174a6abd39
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-composer-message-details.hbs b/plugins/chat/assets/javascripts/discourse/components/chat-composer-message-details.hbsindex fcc65c8c996..37763906d32 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-composer-message-details.hbs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-composer-message-details.hbs@@ -3,9 +3,9 @@{{d-icon this.icon}}<ChatUserAvatar @user={{this.message.user}} /><span class="chat-reply__username">{{this.message.user.username}}</span>- <span class="chat-reply__excerpt">{{replace-emoji- this.message.excerpt- }}</span>+ <span class="chat-reply__excerpt">+ {{replace-emoji this.message.excerpt}}+ </span></div><FlatButtondiff --git a/plugins/chat/spec/system/chat_channel_spec.rb b/plugins/chat/spec/system/chat_channel_spec.rbindex c61d8c16291..970ad56bf30 100644--- a/plugins/chat/spec/system/chat_channel_spec.rb+++ b/plugins/chat/spec/system/chat_channel_spec.rb@@ -189,7 +189,7 @@ RSpec.describe "Chat channel", type: :system, js: true doendend- context "when replying to message that has tags" do+ context "when replying to message that has HTML tags" dofab!(:other_user) { Fabricate(:user) }fab!(:message_2) doFabricate(@@ -208,12 +208,10 @@ RSpec.describe "Chat channel", type: :system, js: true dosign_in(current_user)end- xit "escapes the reply-to line" do+ it "renders text in the reply-to" dochat.visit_channel(channel_1)- expect(find(".chat-reply .chat-reply__excerpt")["innerHTML"].strip).to eq(- "<mark>not marked</mark>",- )+ expect(find(".chat-reply .chat-reply__excerpt")["innerHTML"].strip).to eq("not marked")endenddiff --git a/plugins/chat/spec/system/chat_composer_spec.rb b/plugins/chat/spec/system/chat_composer_spec.rbindex 105d0cf4c4b..572770996d2 100644--- a/plugins/chat/spec/system/chat_composer_spec.rb+++ b/plugins/chat/spec/system/chat_composer_spec.rb@@ -31,6 +31,19 @@ RSpec.describe "Chat composer", type: :system, js: true dotext: message_1.user.username,)end++ context "with HTML tags" do+ before { message_1.update!(message: "<mark>not marked</mark>") }++ it "renders text in the details" do+ chat.visit_channel(channel_1)+ channel.reply_to(message_1)++ expect(+ find(".chat-composer-message-details .chat-reply__excerpt")["innerHTML"].strip,+ ).to eq("not marked")+ end+ endendcontext "when editing a message" do