-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from qld-gov-au/release-v1.0.4
Release v1.0.4
- Loading branch information
Showing
6 changed files
with
194 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.