mirror of
https://github.com/discourse/discourse.git
synced 2025-03-20 07:35:31 +08:00
DEV: Fix pretender in poll tests (#17587)
This commit is contained in:
parent
e509c54b4c
commit
c700cf3213
@ -12,35 +12,37 @@ let requests = 0;
|
||||
module("Integration | Component | Widget | discourse-poll", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
pretender.put("/polls/vote", () => {
|
||||
++requests;
|
||||
return [
|
||||
200,
|
||||
{ "Content-Type": "application/json" },
|
||||
{
|
||||
poll: {
|
||||
name: "poll",
|
||||
type: "regular",
|
||||
status: "open",
|
||||
results: "always",
|
||||
options: [
|
||||
{
|
||||
id: "1f972d1df351de3ce35a787c89faad29",
|
||||
html: "yes",
|
||||
votes: 1,
|
||||
},
|
||||
{
|
||||
id: "d7ebc3a9beea2e680815a1e4f57d6db6",
|
||||
html: "no",
|
||||
votes: 0,
|
||||
},
|
||||
],
|
||||
voters: 1,
|
||||
chart_type: "bar",
|
||||
hooks.beforeEach(function () {
|
||||
pretender.put("/polls/vote", () => {
|
||||
++requests;
|
||||
return [
|
||||
200,
|
||||
{ "Content-Type": "application/json" },
|
||||
{
|
||||
poll: {
|
||||
name: "poll",
|
||||
type: "regular",
|
||||
status: "open",
|
||||
results: "always",
|
||||
options: [
|
||||
{
|
||||
id: "1f972d1df351de3ce35a787c89faad29",
|
||||
html: "yes",
|
||||
votes: 1,
|
||||
},
|
||||
{
|
||||
id: "d7ebc3a9beea2e680815a1e4f57d6db6",
|
||||
html: "no",
|
||||
votes: 0,
|
||||
},
|
||||
],
|
||||
voters: 1,
|
||||
chart_type: "bar",
|
||||
},
|
||||
vote: ["1f972d1df351de3ce35a787c89faad29"],
|
||||
},
|
||||
vote: ["1f972d1df351de3ce35a787c89faad29"],
|
||||
},
|
||||
];
|
||||
];
|
||||
});
|
||||
});
|
||||
|
||||
const template = hbs`
|
||||
@ -160,13 +162,10 @@ module("Integration | Component | Widget | discourse-poll", function (hooks) {
|
||||
});
|
||||
|
||||
await render(template);
|
||||
|
||||
assert.ok(exists(".poll-buttons .cast-votes[disabled=true]"));
|
||||
|
||||
await click("li[data-poll-option-id='1f972d1df351de3ce35a787c89faad29']");
|
||||
|
||||
await click(".poll-buttons .cast-votes");
|
||||
|
||||
assert.ok(exists(".chosen"));
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user