UX: move topic summary from DMenu to DModal (#992)

Co-authored-by: Keegan George <[email protected]>
This commit is contained in:
Kris
2024-12-03 13:30:15 -05:00
committed by GitHub
co-authored by Keegan George
parent ce6a2eca21
commit 8203bdfbc9
9 changed files with 171 additions and 178 deletions
@@ -22,7 +22,12 @@ acceptance("Topic - Summary", function (needs) {
});
server.get("/discourse-ai/summarization/t/1", () => {
return helper.response({});
return helper.response({
ai_topic_summary: {
summarized_text: "This a",
},
done: false,
});
});
});
@@ -39,7 +44,7 @@ acceptance("Topic - Summary", function (needs) {
ai_topic_summary: { summarized_text: partialSummary },
});
await click(".ai-topic-summarization");
await click(".ai-summarization-button");
assert
.dom(".ai-summary-box .generated-summary p")
@@ -63,7 +68,7 @@ acceptance("Topic - Summary", function (needs) {
.hasText(finalSummary, "Updates the summary with a final result");
assert
.dom(".ai-summary-box .summarized-on")
.dom(".ai-summary-modal .summarized-on")
.exists("summary metadata exists");
});
@@ -76,7 +81,7 @@ acceptance("Topic - Summary", function (needs) {
ai_topic_summary: { summarized_text: partialSummary },
});
await click(".ai-topic-summarization");
await click(".ai-summarization-button");
const finalSummaryCooked =
"In this post, <a href='/t/-/1/1'>bianca</a> said some stuff.";
const finalSummaryResult = "In this post, bianca said some stuff.";
@@ -128,20 +133,20 @@ acceptance("Topic - Summary - Anon", function (needs) {
test("displays cached summary immediately", async function (assert) {
await visit("/t/-/1");
await click(".ai-topic-summarization");
await click(".ai-summarization-button");
assert
.dom(".ai-summary-box .generated-summary p")
.hasText(finalSummary, "Updates the summary with the result");
assert
.dom(".ai-summary-box .summarized-on")
.dom(".ai-summary-modal .summarized-on")
.exists("summary metadata exists");
});
test("clicking outside of summary should not close the summary box", async function (assert) {
await visit("/t/-/1");
await click(".ai-topic-summarization");
await click(".ai-summarization-button");
await click("#main-outlet-wrapper");
assert.dom(".ai-summary-box").exists();
});