diff --git a/test/components/views/elements/PollCreateDialog-test.tsx b/test/components/views/elements/PollCreateDialog-test.tsx
index 62e05bd483..ba530b6f9d 100644
--- a/test/components/views/elements/PollCreateDialog-test.tsx
+++ b/test/components/views/elements/PollCreateDialog-test.tsx
@@ -37,29 +37,6 @@ afterAll(() => {
});
describe("PollCreateDialog", () => {
- it("doesn't allow submitting until there are options", () => {
- const dialog = mount(
- ,
- );
- expect(submitIsDisabled(dialog)).toBe(true);
- });
-
- it("does allow submitting when there are options and a question", () => {
- // Given a dialog with no info in (which I am unable to submit)
- const dialog = mount(
- ,
- );
- expect(submitIsDisabled(dialog)).toBe(true);
-
- // When I set some values in the boxes
- changeValue(dialog, "Question or topic", "Q");
- changeValue(dialog, "Option 1", "A1");
- changeValue(dialog, "Option 2", "A2");
-
- // Then I am able to submit
- expect(submitIsDisabled(dialog)).toBe(false);
- });
-
it("renders a blank poll", () => {
const dialog = mount(
,
@@ -85,6 +62,45 @@ describe("PollCreateDialog", () => {
changeValue(dialog, "Option 3", "Mu");
expect(dialog).toMatchSnapshot();
});
+
+ it("doesn't allow submitting until there are options", () => {
+ const dialog = mount(
+ ,
+ );
+ expect(submitIsDisabled(dialog)).toBe(true);
+ });
+
+ it("does allow submitting when there are options and a question", () => {
+ // Given a dialog with no info in (which I am unable to submit)
+ const dialog = mount(
+ ,
+ );
+ expect(submitIsDisabled(dialog)).toBe(true);
+
+ // When I set some values in the boxes
+ changeValue(dialog, "Question or topic", "Q");
+ changeValue(dialog, "Option 1", "A1");
+ changeValue(dialog, "Option 2", "A2");
+
+ // Then I am able to submit
+ expect(submitIsDisabled(dialog)).toBe(false);
+ });
+
+ it("displays a spinner after submitting", () => {
+ TestUtils.stubClient();
+ MatrixClientPeg.get().sendEvent = jest.fn(() => Promise.resolve());
+
+ const dialog = mount(
+ ,
+ );
+ changeValue(dialog, "Question or topic", "Q");
+ changeValue(dialog, "Option 1", "A1");
+ changeValue(dialog, "Option 2", "A2");
+ expect(dialog.find("Spinner").length).toBe(0);
+
+ dialog.find("button").simulate("click");
+ expect(dialog.find("Spinner").length).toBe(1);
+ });
});
function createRoom(): Room {
diff --git a/test/components/views/elements/__snapshots__/PollCreateDialog-test.tsx.snap b/test/components/views/elements/__snapshots__/PollCreateDialog-test.tsx.snap
index e780530ae2..5aba32898b 100644
--- a/test/components/views/elements/__snapshots__/PollCreateDialog-test.tsx.snap
+++ b/test/components/views/elements/__snapshots__/PollCreateDialog-test.tsx.snap
@@ -542,7 +542,7 @@ exports[`PollCreateDialog renders a blank poll 1`] = `
class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"
>
@@ -565,7 +565,7 @@ exports[`PollCreateDialog renders a blank poll 1`] = `
class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"
>
@@ -591,7 +591,7 @@ exports[`PollCreateDialog renders a blank poll 1`] = `
class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"
>
@@ -700,7 +700,7 @@ exports[`PollCreateDialog renders a blank poll 1`] = `
class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"
>
@@ -723,7 +723,7 @@ exports[`PollCreateDialog renders a blank poll 1`] = `
class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"
>
@@ -749,7 +749,7 @@ exports[`PollCreateDialog renders a blank poll 1`] = `
class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"
>
@@ -885,7 +885,7 @@ exports[`PollCreateDialog renders a blank poll 1`] = `
>
@@ -928,7 +928,7 @@ exports[`PollCreateDialog renders a blank poll 1`] = `
>
@@ -986,7 +986,7 @@ exports[`PollCreateDialog renders a blank poll 1`] = `
>
@@ -1661,7 +1661,7 @@ exports[`PollCreateDialog renders a question and some options 1`] = `
class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"
>
@@ -1684,7 +1684,7 @@ exports[`PollCreateDialog renders a question and some options 1`] = `
class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"
>
@@ -1710,7 +1710,7 @@ exports[`PollCreateDialog renders a question and some options 1`] = `
class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"
>
@@ -1736,7 +1736,7 @@ exports[`PollCreateDialog renders a question and some options 1`] = `
class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"
>
@@ -1844,7 +1844,7 @@ exports[`PollCreateDialog renders a question and some options 1`] = `
class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"
>
@@ -1867,7 +1867,7 @@ exports[`PollCreateDialog renders a question and some options 1`] = `
class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"
>
@@ -1893,7 +1893,7 @@ exports[`PollCreateDialog renders a question and some options 1`] = `
class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"
>
@@ -1919,7 +1919,7 @@ exports[`PollCreateDialog renders a question and some options 1`] = `
class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"
>
@@ -2054,7 +2054,7 @@ exports[`PollCreateDialog renders a question and some options 1`] = `
>
@@ -2097,7 +2097,7 @@ exports[`PollCreateDialog renders a question and some options 1`] = `
>
@@ -2155,7 +2155,7 @@ exports[`PollCreateDialog renders a question and some options 1`] = `
>
@@ -2213,7 +2213,7 @@ exports[`PollCreateDialog renders a question and some options 1`] = `
>