diff --git a/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js b/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js index 5b4f34f4469..ad199be1a3f 100644 --- a/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js +++ b/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js @@ -402,6 +402,6 @@ export default Controller.extend(ModalFunctionality, { @action updatePollType(pollType, event) { event?.preventDefault(); - this.pollType = pollType; + this.set("pollType", pollType); }, }); diff --git a/plugins/poll/assets/javascripts/discourse/templates/modal/poll-ui-builder.hbs b/plugins/poll/assets/javascripts/discourse/templates/modal/poll-ui-builder.hbs index e2f24afa90f..360c691e57b 100644 --- a/plugins/poll/assets/javascripts/discourse/templates/modal/poll-ui-builder.hbs +++ b/plugins/poll/assets/javascripts/discourse/templates/modal/poll-ui-builder.hbs @@ -1,15 +1,15 @@
- + {{i18n "poll.ui_builder.poll_type.regular"}} - + {{i18n "poll.ui_builder.poll_type.multiple"}} {{#if this.showNumber}} - + {{i18n "poll.ui_builder.poll_type.number"}} {{/if}} diff --git a/plugins/poll/test/javascripts/acceptance/poll-builder-enabled-test.js b/plugins/poll/test/javascripts/acceptance/poll-builder-enabled-test.js index 3321e07c6d9..8b86665f960 100644 --- a/plugins/poll/test/javascripts/acceptance/poll-builder-enabled-test.js +++ b/plugins/poll/test/javascripts/acceptance/poll-builder-enabled-test.js @@ -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) {