Skip to content

Commit

Permalink
[nextjs][react]The language of the form is changed after clicking the…
Browse files Browse the repository at this point in the history
… submit button (#1274)

* Make `sc_lang` as optional qs parameter

* [nextjs][react]The language of the form is changed after clicking the submit button

* Revert .test file

* Revert classname

* Update vmImage version to `ubuntu-latest`

* Quick fix for unit tests

* fix for sitecore-jss-cli

* Apply changes

* add transpile-only for rest of unit tests
  • Loading branch information
illiakovalenko authored Dec 23, 2022
1 parent b99ff23 commit 4dc4ca1
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 23 deletions.
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pr:

pool:
# todo: we dgaf what specific version of Linux is installed, is there any way to wildcard the version?
vmImage: 'Ubuntu-16.04'
vmImage: 'ubuntu-latest'

variables:
shouldPublish: $[or(eq(variables['Build.SourceBranch'], 'refs/heads/dev'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'))]
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"lint": "eslint ./src/**/*.ts",
"prepublishOnly": "npm run build",
"jss": "node ./dist/bin/jss.js",
"test": "mocha --require ts-node/register \"./src/**/*.test.ts\"",
"coverage": "nyc --require ts-node/register npm test"
"test": "mocha --require ts-node/register/transpile-only \"./src/**/*.test.ts\" --exit",
"coverage": "nyc --require ts-node/register/transpile-only npm test"
},
"engines": {
"node": ">=8.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-dev-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"watch": "npm run build -- --watch",
"clean": "del-cli dist types",
"lint": "eslint ./src/**/*.ts",
"test": "mocha --require ts-node/register \"./src/**/*.test.ts\"",
"test": "mocha --require ts-node/register/transpile-only \"./src/**/*.test.ts\" --exit",
"prepublishOnly": "npm run build",
"coverage": "nyc --require ts-node/register npm test"
"coverage": "nyc --require ts-node/register/transpile-only npm test"
},
"engines": {
"node": ">=8.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-forms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"build": "npm run clean && tsc",
"clean": "del-cli dist types",
"lint": "eslint ./src/**/*.ts",
"test": "mocha --require ts-node/register \"./src/**/*.test.ts\"",
"test": "mocha --require ts-node/register/transpile-only \"./src/**/*.test.ts\" --exit",
"prepublishOnly": "npm run build",
"coverage": "nyc --require ts-node/register npm test"
"coverage": "nyc --require ts-node/register/transpile-only npm test"
},
"engines": {
"node": ">=8.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-manifest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"build": "npm run clean && tsc",
"clean": "del-cli dist types",
"lint": "eslint ./src/**/*.ts",
"test": "mocha --require ts-node/register \"./src/**/*.test.ts\"",
"test": "mocha --require ts-node/register/transpile-only \"./src/**/*.test.ts\" --exit",
"prepublishOnly": "npm run build",
"generate": "npm run build && node ./dist/bin/manifest generate --files ./src/testData/**/*.sitecore.ts --compilers ts-node/register --appName testApp --outputPath ./sitecore/sitecore-import.json --language en",
"coverage": "nyc --require ts-node/register npm test"
"coverage": "nyc --require ts-node/register/transpile-only npm test"
},
"engines": {
"node": ">=8.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/sitecore-jss-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "npm run clean && tsc -p tsconfig.json && tsc -p tsconfig-esm.json",
"clean": "del-cli dist types",
"lint": "eslint ./src/**/*.tsx ./src/**/*.ts",
"test": "mocha --require ts-node/register --require ./src/tests/shim.ts ./src/tests/jsdom-setup.ts ./src/tests/enzyme-setup.ts \"./src/**/*.test.ts\" \"./src/**/*.test.tsx\"",
"test": "mocha --require ts-node/register/transpile-only --require ./src/tests/shim.ts ./src/tests/jsdom-setup.ts ./src/tests/enzyme-setup.ts \"./src/**/*.test.ts\" \"./src/**/*.test.tsx\" --exit",
"prepublishOnly": "npm run build",
"coverage": "nyc npm test"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"build": "npm run clean && tsc",
"clean": "del-cli dist types",
"lint": "eslint ./src/**/*.ts",
"test": "mocha --require ts-node/register \"./src/**/*.test.ts\"",
"test": "mocha --require ts-node/register/transpile-only \"./src/**/*.test.ts\" --exit",
"prepublishOnly": "npm run build",
"coverage": "nyc --require ts-node/register npm test"
"coverage": "nyc --require ts-node/register/transpile-only npm test"
},
"engines": {
"node": ">=8.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/sitecore-jss-react-forms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"build": "npm run clean && tsc",
"clean": "del-cli dist types",
"lint": "eslint ./src/**/*.tsx ./src/**/*.ts",
"test": "mocha --require ts-node/register --require ./src/tests/shim.ts ./src/tests/jsdom-setup.ts ./src/tests/enzyme-setup.ts \"./src/**/*.test.tsx\"",
"test": "mocha --require ts-node/register/transpile-only --require ./src/tests/shim.ts ./src/tests/jsdom-setup.ts ./src/tests/enzyme-setup.ts \"./src/**/*.test.tsx\" --exit",
"prepublishOnly": "npm run build"
},
"engines": {
Expand Down
7 changes: 6 additions & 1 deletion packages/sitecore-jss-react-forms/src/components/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface ErrorComponentProps {

export interface FormProps {
form: SitecoreForm;
language?: string;
fieldFactory?: FieldFactory;
sitecoreApiHost: string;
sitecoreApiKey: string;
Expand Down Expand Up @@ -97,7 +98,11 @@ export class Form extends Component<FormProps, FormState & FieldStateCollection>
return <div>Form data invalid. Forget to set the rendering contents resolver?</div>;
}

const action = `${this.props.sitecoreApiHost}/api/jss/formbuilder?fxb.FormItemId=${form.metadata.itemId}&fxb.HtmlPrefix=${form.htmlPrefix}&sc_apikey=${this.props.sitecoreApiKey}&sc_itemid=${form.contextItemId}`;
const action = `${this.props.sitecoreApiHost}/api/jss/formbuilder?fxb.FormItemId=${
form.metadata.itemId
}&fxb.HtmlPrefix=${form.htmlPrefix}&sc_apikey=${this.props.sitecoreApiKey}&sc_itemid=${
form.contextItemId
}&sc_lang=${this.props.language || ''}`;

this._tracker.setFormData(
form.formItemId.value,
Expand Down
2 changes: 1 addition & 1 deletion packages/sitecore-jss-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"build": "npm run clean && tsc",
"clean": "del-cli dist types",
"lint": "eslint ./src/**/*.tsx ./src/**/*.ts",
"test": "mocha --require ts-node/register --require ./src/tests/shim.ts ./src/tests/jsdom-setup.ts ./src/tests/enzyme-setup.ts \"./src/**/*.test.ts\" \"./src/**/*.test.tsx\"",
"test": "mocha --require ts-node/register/transpile-only --require ./src/tests/shim.ts ./src/tests/jsdom-setup.ts ./src/tests/enzyme-setup.ts \"./src/**/*.test.ts\" \"./src/**/*.test.tsx\" --exit",
"prepublishOnly": "npm run build",
"coverage": "nyc npm test"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-rendering-host/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"build": "npm run clean && tsc",
"clean": "del-cli dist types",
"lint": "eslint ./src/**/*.ts",
"test": "mocha --require ts-node/register \"./src/**/*.test.ts\"",
"test": "mocha --require ts-node/register/transpile-only \"./src/**/*.test.ts\" --exit",
"prepublishOnly": "npm run build",
"coverage": "nyc --require ts-node/register npm test"
"coverage": "nyc --require ts-node/register/transpile-only npm test"
},
"engines": {
"node": ">=8.10"
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-tracking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"build": "npm run clean && tsc",
"clean": "del-cli dist types",
"lint": "eslint ./src/**/*.ts",
"test": "mocha --require ts-node/register \"./src/**/*.test.ts\"",
"test": "mocha --require ts-node/register/transpile-only \"./src/**/*.test.ts\" --exit",
"prepublishOnly": "npm run build",
"coverage": "nyc --require ts-node/register npm test"
"coverage": "nyc --require ts-node/register/transpile-only npm test"
},
"engines": {
"node": ">=8.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-update-package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"build": "npm run clean && tsc",
"clean": "del-cli dist types",
"lint": "eslint ./src/**/*.ts",
"test": "mocha --require ts-node/register \"./src/**/*.test.ts\"",
"test": "mocha --require ts-node/register/transpile-only \"./src/**/*.test.ts\" --exit",
"prepublishOnly": "npm run build",
"coverage": "nyc --require ts-node/register npm test"
"coverage": "nyc --require ts-node/register/transpile-only npm test"
},
"engines": {
"node": ">=8.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-pipelines/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"build": "npm run clean && tsc",
"clean": "del-cli dist types",
"lint": "eslint ./src/**/*.ts",
"test": "mocha --require ts-node/register \"./src/**/*.test.ts\"",
"test": "mocha --require ts-node/register/transpile-only \"./src/**/*.test.ts\" --exit",
"prepublishOnly": "npm run build",
"runner": "npm run build && node ./dist/runner",
"coverage": "nyc --require ts-node/register npm test"
"coverage": "nyc --require ts-node/register/transpile-only npm test"
},
"engines": {
"node": ">=8.1"
Expand Down

0 comments on commit 4dc4ca1

Please sign in to comment.