mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-07-08 15:22:47 +00:00
test added
This commit is contained in:
parent
a44fc68342
commit
78bd1d9112
@ -240,7 +240,6 @@ export default class AiSummaryModal extends Component {
|
|||||||
{{didInsert this.generateSummary}}
|
{{didInsert this.generateSummary}}
|
||||||
{{on "click" this.onSummaryTextClick}}
|
{{on "click" this.onSummaryTextClick}}
|
||||||
role="button"
|
role="button"
|
||||||
tabindex="0"
|
|
||||||
>
|
>
|
||||||
<article
|
<article
|
||||||
class={{concatClass
|
class={{concatClass
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { getOwner } from "@ember/owner";
|
||||||
import { click, visit } from "@ember/test-helpers";
|
import { click, visit } from "@ember/test-helpers";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
import { cloneJSON } from "discourse/lib/object";
|
import { cloneJSON } from "discourse/lib/object";
|
||||||
@ -97,10 +98,19 @@ acceptance("Topic - Summary", function (needs) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let appEventTriggered = 0;
|
||||||
|
const appEvents = getOwner(this).lookup("service:app-events");
|
||||||
|
appEvents.on("ai_summary_link_clicked", this, () => appEventTriggered++);
|
||||||
|
|
||||||
await click(".generated-summary a");
|
await click(".generated-summary a");
|
||||||
assert
|
assert
|
||||||
.dom(".ai-summary-box .generated-summary p")
|
.dom(".ai-summary-box .generated-summary p")
|
||||||
.hasText(finalSummaryResult, "Retains final summary after clicking link");
|
.hasText(finalSummaryResult, "Retains final summary after clicking link");
|
||||||
|
assert.equal(
|
||||||
|
appEventTriggered,
|
||||||
|
1,
|
||||||
|
"ai_summary_link_clicked appEvent triggered once"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user