Skip to content

Commit

Permalink
Merge pull request #27 from qld-gov-au/release-v1.0.4
Browse files Browse the repository at this point in the history
Release v1.0.4
  • Loading branch information
devonpis authored Apr 13, 2022
2 parents b90191b + 6f3ae23 commit 0c38ace
Show file tree
Hide file tree
Showing 6 changed files with 194 additions and 199 deletions.
6 changes: 3 additions & 3 deletions src/config/createForm.options.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ module.exports = {
// Turn off default buttons
buttonSettings: {
showCancel: false,
showPrevious: false,
showNext: false,
showSubmit: false,
showPrevious: true,
showNext: true,
showSubmit: true,
},
i18n: {
en: {
Expand Down
27 changes: 27 additions & 0 deletions src/examples/SimpleWizard/SimpleWizard.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Canvas, Meta, Story } from "@storybook/addon-docs";
import * as FormioLoader from "../../helpers/FormioLoader";

<Meta title="Examples/SimpleWizard" />

# Simple wizard example

The demo below show the default presentation of a wizard form.

<Canvas withSource="open">
<Story name="initFormioMethod">
{() => {
setTimeout(() => {
FormioLoader.initFormio();
});
return `
<div id="formio"
class="qg-forms-v2"
data-formio
data-formio-project-name="dev-svcwlpuksmwawwk"
data-formio-form-name="simpleWizard"
data-formio-env-url="api.forms.platforms.qld.gov.au"
></div>
`;
}}
</Story>
</Canvas>
51 changes: 51 additions & 0 deletions src/examples/SimpleWizard/SimpleWizard.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import "@testing-library/jest-dom";
import userEvent from "@testing-library/user-event";
import { findByText } from "@testing-library/dom";
import * as FormioLoader from "../../helpers/FormioLoader";
import { formioRes } from "../../test/fixtures/simpleWizard";

// Functional test
test("SimpleWizard is functional", async () => {
const div = document.createElement("div");
div.innerHTML = `
<div id="formio"
class="qg-forms-v2"
data-formio
data-formio-project-name="dev-svcwlpuksmwawwk"
data-formio-form-name="simpleWizard"
data-formio-env-url="api.forms.platforms.qld.gov.au"
></div>
`;
document.body.append(div);
FormioLoader.initFormio();
jest.spyOn(Formio, "makeRequest").mockResolvedValueOnce(formioRes);

const label1 = await findByText(div, "Text Field1");
expect(label1).toBeVisible();

const next1 = await findByText(div, "Next");
expect(next1).toBeVisible();

const page2 = await findByText(div, "Page 2");
expect(page2).toBeVisible();
await userEvent.click(page2);

const next2 = await findByText(div, "Next");
expect(next2).toBeVisible();

const prev2 = await findByText(div, "Previous");
expect(prev2).toBeVisible();

const label2 = await findByText(div, "Text Field2");
expect(label2).toBeVisible();

const page3 = await findByText(div, "Page 3");
expect(page3).toBeVisible();
await userEvent.click(page3);

const prev3 = await findByText(div, "Previous");
expect(prev3).toBeVisible();

const submit = await findByText(div, "Submit Form");
expect(submit).toBeVisible();
});
2 changes: 1 addition & 1 deletion src/examples/SingleSignOn/SingleSignOn.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import SSOHighLevel from "../../stories/assets/SSO-HighLevel.png";
import SSOUserFlow from "../../stories/assets/SSO-UserFlow.png";
import { createSSoForm } from "./SingleSignOn";

<Meta title="Example/SingleSignOn" />
<Meta title="Examples/SingleSignOn" />

# Single SignOn

Expand Down
112 changes: 112 additions & 0 deletions src/test/fixtures/simpleWizard.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0c38ace

Please sign in to comment.