mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 04:33:37 +08:00
e3b6be15b8
The "migration to Glimmer" has been broken out here from #27155 to make the review process less onerous and reduce change risk: * DEV: migrates most of the widget code to Glimmer in prep for IRV additions * NB This already incorporates significant amounts of review and feedback from the prior PR. * NB because there was significant additional feedback relating to older Poll code that I've improved with feedback, there are some additional changes here that are general improvements to the plugin and not specific to IRV nor Glimmer! * There should be no trace of IRV code here. Once this is finalised and merged we can continue to progress with #27155.
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
import { click, render } from "@ember/test-helpers";
|
|
import hbs from "htmlbars-inline-precompile";
|
|
import { module, test } from "qunit";
|
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
|
import { count, query } from "discourse/tests/helpers/qunit-helpers";
|
|
import I18n from "I18n";
|
|
|
|
module("Poll | Component | poll-buttons-dropdown", function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
test("Renders a clickable dropdown menu with a close option", async function (assert) {
|
|
this.setProperties({
|
|
closed: false,
|
|
voters: [],
|
|
isStaff: true,
|
|
isMe: false,
|
|
topicArchived: false,
|
|
groupableUserFields: [],
|
|
isAutomaticallyClosed: false,
|
|
dropDownClick: () => {},
|
|
});
|
|
|
|
await render(hbs`<PollButtonsDropdown
|
|
@closed={{this.closed}}
|
|
@voters={{this.voters}}
|
|
@isStaff={{this.isStaff}}
|
|
@isMe={{this.isMe}}
|
|
@topicArchived={{this.topicArchived}}
|
|
@groupableUserFields={{this.groupableUserFields}}
|
|
@isAutomaticallyClosed={{this.isAutomaticallyClosed}}
|
|
@dropDownClick={{this.dropDownClick}}
|
|
/>`);
|
|
|
|
await click(".widget-dropdown-header");
|
|
|
|
assert.strictEqual(count("li.dropdown-menu__item"), 1);
|
|
|
|
assert.strictEqual(
|
|
query("li.dropdown-menu__item span").textContent.trim(),
|
|
I18n.t("poll.close.label"),
|
|
"displays the poll Close action"
|
|
);
|
|
});
|
|
});
|