-
Notifications
You must be signed in to change notification settings - Fork 0
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 #34 from imrim12/feat/support-custom-form-wrapper
Feat/support custom form wrapper
- Loading branch information
Showing
31 changed files
with
821 additions
and
1,567 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,3 @@ | ||
|
||
|
||
|
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 |
---|---|---|
@@ -1,78 +1,79 @@ | ||
{ | ||
"type": "module", | ||
"version": "0.1.0", | ||
"description": "Form marKup Language", | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"nx": "nx", | ||
"build": "nx build", | ||
"build:all": "nx run-many --target=build --all", | ||
"typecheck": "nx run-many --target=typecheck --all", | ||
"test": "vitest run", | ||
"test:ui": "vitest --ui", | ||
"dev:docs": "vitepress dev docs", | ||
"serve:docs": "vitepress serve docs", | ||
"build:docs": "vitepress build docs", | ||
"prepare-husky": "husky install", | ||
"release": "release-it", | ||
"dev:vue": "pnpm -F ./sandbox dev", | ||
"dev:react": "pnpm -F ./sandbox-react dev" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/imrim12/formkl.git" | ||
}, | ||
"keywords": [ | ||
"form", | ||
"formkl", | ||
"formjs", | ||
"form", | ||
"generator", | ||
"schema" | ||
], | ||
"author": "thecodeorigin", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/imrim12/formkl/issues" | ||
}, | ||
"homepage": "https://github.com/imrim12/formkl#readme", | ||
"workspaces": [ | ||
"packages/**", | ||
"sandbox" | ||
], | ||
"dependencies": { | ||
"@formkl/elemento": "workspace:*", | ||
"@formkl/shared": "workspace:*", | ||
"@formkl/plugin-vite": "workspace:*", | ||
"@formkl/plugin-webpack": "workspace:*", | ||
"@formkl/vue": "workspace:*", | ||
"formkl": "workspace:*", | ||
"vitepress": "1.0.0-alpha.20" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^17.2.0", | ||
"@commitlint/config-conventional": "^17.2.0", | ||
"@nrwl/nx-cloud": "^15.0.2", | ||
"@nrwl/workspace": "^15.0.10", | ||
"@release-it/conventional-changelog": "^5.1.1", | ||
"@types/lodash": "^4.14.187", | ||
"@types/node": "^18.11.8", | ||
"@typescript-eslint/eslint-plugin": "^5.38.0", | ||
"@typescript-eslint/parser": "^5.38.0", | ||
"@vitejs/plugin-vue": "^3.1.2", | ||
"@vitejs/plugin-vue-jsx": "^2.0.1", | ||
"@vitest/ui": "^0.24.5", | ||
"@vue/test-utils": "^2.2.1", | ||
"eslint": "^8.23.1", | ||
"husky": "^8.0.2", | ||
"jsdom": "^20.0.2", | ||
"nx": "^15.0.0", | ||
"release-it": "^15.5.0", | ||
"rimraf": "^3.0.2", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^4.9.4", | ||
"vitest": "^0.24.4", | ||
"vue": "^3.2.41", | ||
"vue-tsc": "^1.0.9" | ||
} | ||
} | ||
"type": "module", | ||
"version": "0.1.0", | ||
"description": "Form marKup Language", | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"nx": "nx", | ||
"build": "nx build", | ||
"build:all": "nx run-many --target=build --all --exclude=@formkl/sandbox", | ||
"typecheck": "nx run-many --target=typecheck --all --exclude=@formkl/sandbox", | ||
"test": "vitest run", | ||
"test:ui": "vitest --ui", | ||
"dev:docs": "vitepress dev docs", | ||
"serve:docs": "vitepress serve docs", | ||
"build:docs": "vitepress build docs", | ||
"prepare-husky": "husky install", | ||
"release": "release-it", | ||
"dev:vue": "pnpm -F ./sandbox dev", | ||
"dev:react": "pnpm -F ./sandbox-react dev", | ||
"postinstall": "pnpm build:all" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/imrim12/formkl.git" | ||
}, | ||
"keywords": [ | ||
"form", | ||
"formkl", | ||
"formjs", | ||
"form", | ||
"generator", | ||
"schema" | ||
], | ||
"author": "thecodeorigin", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/imrim12/formkl/issues" | ||
}, | ||
"homepage": "https://github.com/imrim12/formkl#readme", | ||
"workspaces": [ | ||
"packages/**", | ||
"sandbox" | ||
], | ||
"dependencies": { | ||
"@formkl/elemento": "workspace:*", | ||
"@formkl/shared": "workspace:*", | ||
"@formkl/plugin-vite": "workspace:*", | ||
"@formkl/plugin-webpack": "workspace:*", | ||
"@formkl/vue": "workspace:*", | ||
"formkl": "workspace:*", | ||
"vitepress": "1.0.0-alpha.20" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^17.2.0", | ||
"@commitlint/config-conventional": "^17.2.0", | ||
"@nrwl/nx-cloud": "latest", | ||
"@nrwl/workspace": "latest", | ||
"@release-it/conventional-changelog": "^5.1.1", | ||
"@types/lodash": "^4.14.187", | ||
"@types/node": "^18.11.8", | ||
"@typescript-eslint/eslint-plugin": "^5.38.0", | ||
"@typescript-eslint/parser": "^5.38.0", | ||
"@vitejs/plugin-vue": "^3.1.2", | ||
"@vitejs/plugin-vue-jsx": "^2.0.1", | ||
"@vitest/ui": "^0.24.5", | ||
"@vue/test-utils": "^2.2.1", | ||
"eslint": "^8.23.1", | ||
"husky": "^8.0.2", | ||
"jsdom": "^20.0.2", | ||
"nx": "latest", | ||
"release-it": "^15.5.0", | ||
"rimraf": "^3.0.2", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^4.9.4", | ||
"vitest": "^0.24.4", | ||
"vue": "^3.2.41", | ||
"vue-tsc": "^1.0.9" | ||
} | ||
} |
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
58 changes: 58 additions & 0 deletions
58
packages/adapters/vue/src/__test__/basic-rendering.test.ts
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,58 @@ | ||
import { mount } from "@vue/test-utils"; | ||
|
||
import formklTheme from "@formkl/elemento"; | ||
|
||
import FormklPlugin, { Formkl } from ".."; | ||
import { Formkl as FormklType } from "@formkl/shared"; | ||
|
||
// @ts-ignore | ||
import formSyntax from "./syntax.form"; | ||
|
||
let form: FormklType = formSyntax; | ||
|
||
const mountOptions = { | ||
global: { | ||
plugins: [[FormklPlugin, { theme: formklTheme }]], | ||
}, | ||
propsData: { | ||
form, | ||
}, | ||
} as any; | ||
|
||
describe("Basic rendering usage including vite plugin.", () => { | ||
it("should mount the Formkl component correctly", () => { | ||
const wrapper = mount(Formkl, mountOptions); | ||
|
||
expect(wrapper).toBeTruthy(); | ||
}); | ||
|
||
it("should render the Formkl title correctly", () => { | ||
const wrapper = mount(Formkl, mountOptions); | ||
|
||
expect(wrapper.element.innerHTML).toContain(form.title); | ||
}); | ||
|
||
it("should render the Formkl description correctly", () => { | ||
const wrapper = mount(Formkl, mountOptions); | ||
|
||
expect(wrapper.element.innerHTML).toContain(form.description); | ||
}); | ||
|
||
it("should render the sections' titles correctly", () => { | ||
const wrapper = mount(Formkl, mountOptions); | ||
|
||
form.sections.forEach((section) => { | ||
expect(wrapper.element.innerHTML).toContain(section.title); | ||
}); | ||
}); | ||
|
||
it("should render the fields' labels correctly", () => { | ||
const wrapper = mount(Formkl, mountOptions); | ||
|
||
form.sections.forEach((section) => { | ||
section.fields.forEach((field) => { | ||
expect(wrapper.element.innerHTML).toContain(field.label); | ||
}); | ||
}); | ||
}); | ||
}); |
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,10 @@ | ||
formkl "Your Formkl example" "This form is generated by the formkl adapter" { | ||
multiple "Work Experience" has { | ||
require text; | ||
} | ||
"Personal Information" has { | ||
text; | ||
multiple paragraph; | ||
multiple text as "something"; | ||
} | ||
} |
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
Oops, something went wrong.
508edc7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
formkl-sandbox – ./
formkl-sandbox.vercel.app
formkl-sandbox-git-main-bittermeatball.vercel.app
formkl-sandbox-bittermeatball.vercel.app
sandbox.formkl.org
508edc7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
formkl-docs – ./
formkl-docs-bittermeatball.vercel.app
formkl-docs-git-main-bittermeatball.vercel.app
formkl.vercel.app
formkl.org