FIX: Unresponsive post buttons due to Ask AI highlight (#635)

This commit is contained in:
Keegan George 2024-05-21 13:58:37 -07:00 committed by GitHub
parent 3a9080dd14
commit 59e63a2da9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -59,7 +59,7 @@ export default class AIHelperOptionsMenu extends Component {
highlightSelectedText() {
const postId = this.args.outletArgs.data.quoteState.postId;
const postElement = document.querySelector(
`article[data-post-id='${postId}']`
`article[data-post-id='${postId}'] .cooked`
);
if (!postElement) {
@ -135,7 +135,7 @@ export default class AIHelperOptionsMenu extends Component {
const postId = this.args.outletArgs.data.quoteState.postId;
const postElement = document.querySelector(
`article[data-post-id='${postId}']`
`article[data-post-id='${postId}'] .cooked`
);
if (!postElement) {

View File

@ -65,6 +65,14 @@ RSpec.describe "AI Post helper", type: :system, js: true do
expect(post_ai_helper).to have_no_highlighted_text
end
it "allows post control buttons to still be functional after clicking the AI button" do
select_post_text(post)
post_ai_helper.click_ai_button
topic_page.click_like_reaction_for(post)
wait_for { post.reload.like_count == 1 }
expect(post.like_count).to eq(1)
end
context "when using explain mode" do
let(:mode) { CompletionPrompt::EXPLAIN }