DEV: Fix pretender in poll tests ()

This commit is contained in:
Jarek Radosz 2022-07-21 10:53:21 +02:00 committed by GitHub
parent e509c54b4c
commit c700cf3213
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -12,6 +12,7 @@ let requests = 0;
module("Integration | Component | Widget | discourse-poll", function (hooks) { module("Integration | Component | Widget | discourse-poll", function (hooks) {
setupRenderingTest(hooks); setupRenderingTest(hooks);
hooks.beforeEach(function () {
pretender.put("/polls/vote", () => { pretender.put("/polls/vote", () => {
++requests; ++requests;
return [ return [
@ -42,6 +43,7 @@ module("Integration | Component | Widget | discourse-poll", function (hooks) {
}, },
]; ];
}); });
});
const template = hbs` const template = hbs`
<MountWidget <MountWidget
@ -160,13 +162,10 @@ module("Integration | Component | Widget | discourse-poll", function (hooks) {
}); });
await render(template); await render(template);
assert.ok(exists(".poll-buttons .cast-votes[disabled=true]")); assert.ok(exists(".poll-buttons .cast-votes[disabled=true]"));
await click("li[data-poll-option-id='1f972d1df351de3ce35a787c89faad29']"); await click("li[data-poll-option-id='1f972d1df351de3ce35a787c89faad29']");
await click(".poll-buttons .cast-votes"); await click(".poll-buttons .cast-votes");
assert.ok(exists(".chosen")); assert.ok(exists(".chosen"));
}); });
}); });