Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1.0.4 #27

Merged
merged 3 commits into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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