FIX: Ensure poll type toggle buttons function correctly (#18540)
Followup to 03b7b7d1bc
This commit is contained in:
parent
b75dc04a25
commit
a10a81244c
|
@ -402,6 +402,6 @@ export default Controller.extend(ModalFunctionality, {
|
|||
@action
|
||||
updatePollType(pollType, event) {
|
||||
event?.preventDefault();
|
||||
this.pollType = pollType;
|
||||
this.set("pollType", pollType);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<DModalBody @title="poll.ui_builder.title" @class="poll-ui-builder">
|
||||
<div class="input-group poll-type">
|
||||
<a href {{on "click" (fn this.updatePollType "regular")}} class="poll-type-value {{if this.isRegular "active"}}">
|
||||
<a href {{on "click" (fn this.updatePollType "regular")}} class="poll-type-value poll-type-value-regular {{if this.isRegular "active"}}">
|
||||
{{i18n "poll.ui_builder.poll_type.regular"}}
|
||||
</a>
|
||||
|
||||
<a href {{on "click" (fn this.updatePollType "multiple")}} class="poll-type-value {{if this.isMultiple "active"}}">
|
||||
<a href {{on "click" (fn this.updatePollType "multiple")}} class="poll-type-value poll-type-value-multiple {{if this.isMultiple "active"}}">
|
||||
{{i18n "poll.ui_builder.poll_type.multiple"}}
|
||||
</a>
|
||||
|
||||
{{#if this.showNumber}}
|
||||
<a href {{on "click" (fn this.updatePollType "number")}} class="poll-type-value {{if this.isNumber "active"}}">
|
||||
<a href {{on "click" (fn this.updatePollType "number")}} class="poll-type-value poll-type-value-number {{if this.isNumber "active"}}">
|
||||
{{i18n "poll.ui_builder.poll_type.number"}}
|
||||
</a>
|
||||
{{/if}}
|
||||
|
|
|
@ -3,6 +3,7 @@ import {
|
|||
exists,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click } from "@ember/test-helpers";
|
||||
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
|
||||
import { displayPollBuilderButton } from "discourse/plugins/poll/helpers/display-poll-builder-button";
|
||||
import { test } from "qunit";
|
||||
|
@ -24,6 +25,22 @@ acceptance("Poll Builder - polls are enabled", function (needs) {
|
|||
exists(".select-kit-row[data-value='showPollBuilder']"),
|
||||
"it shows the builder button"
|
||||
);
|
||||
|
||||
await click(".select-kit-row[data-value='showPollBuilder']");
|
||||
assert.true(
|
||||
exists(".poll-type-value-regular.active"),
|
||||
"regular type is active"
|
||||
);
|
||||
await click(".poll-type-value-multiple");
|
||||
assert.true(
|
||||
exists(".poll-type-value-multiple.active"),
|
||||
"multiple type is active"
|
||||
);
|
||||
await click(".poll-type-value-regular");
|
||||
assert.true(
|
||||
exists(".poll-type-value-regular.active"),
|
||||
"regular type is active"
|
||||
);
|
||||
});
|
||||
|
||||
test("regular user - insufficient trust level", async function (assert) {
|
||||
|
|
Loading…
Reference in New Issue