FEATURE: Add a preview to the poll builder (#7988)

* FEATURE: Add a preview to the poll builder

* Use selectKit helper in the poll preview test

* Extract the mobile-specific poll builder form CSS
This commit is contained in:
Jarek Radosz
2019-08-13 15:49:40 +02:00
committed by Robin Ward
parent 6374dc7d51
commit 6a65e5312b
7 changed files with 107 additions and 69 deletions

View File

@ -1,3 +1,4 @@
import selectKit from "helpers/select-kit-helper";
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
import { displayPollBuilderButton } from "discourse/plugins/poll/helpers/display-poll-builder-button";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
@ -51,3 +52,15 @@ test("staff - with insufficient trust level", assert => {
);
});
});
test("poll preview", async assert => {
displayPollBuilderButton();
const popupMenu = selectKit(".toolbar-popup-menu-options");
await popupMenu.expand();
await popupMenu.selectRowByValue("showPollBuilder");
await fillIn(".poll-textarea textarea", "First option\nSecond option");
assert.equal(find(".d-editor-preview li:first-child").text(), "First option");
assert.equal(find(".d-editor-preview li:last-child").text(), "Second option");
});