@luomus/laji-form 15.1.6 → 15.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -375,7 +375,7 @@ class LocationButton extends React.Component {
375
375
  this.setState({ modalMap: undefined });
376
376
  };
377
377
  this.onModalMapKeyDown = (e) => {
378
- if (e.key === "Escape" && !this.modalMapRef.map.keyHandler(e.nativeEvent)) {
378
+ if (e.key === "Escape" && !this.modalMapRef.map.keyHandlerForType("keydown", e.nativeEvent)) {
379
379
  this.onHide();
380
380
  }
381
381
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luomus/laji-form",
3
- "version": "15.1.6",
3
+ "version": "15.1.8",
4
4
  "description": "React module capable of building dynamic forms from Laji form json schemas",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -11,12 +11,16 @@
11
11
  "build:dist": "rimraf dist && NODE_ENV=production webpack --config webpack.config.dist.js && rimraf dist/styles.js",
12
12
  "build:tests": "rimraf test-export && NODE_ENV=production tsc -p tsconfig.test.json",
13
13
  "build": "npm run build:lib && npm run build:dist && npm run build:tests",
14
- "preversion": "npm run lint && npm test",
14
+ "preversion": "npm run lint && npm run test:lightweight",
15
15
  "version": "bin/update-changelog.sh",
16
16
  "postversion": "npm publish",
17
17
  "prepublishOnly": "npm run build && git push && git push --tags",
18
18
  "lint": "eslint -c .eslintrc.prod.json src playground",
19
- "test": "npx playwright test"
19
+ "test": "npx playwright test",
20
+ "test:docker": "npm run test:docker:build && npm run test:docker:run --",
21
+ "test:lightweight": "npx playwright test --project chromium",
22
+ "test:docker:build": "docker build -t laji-form-test -f test.Dockerfile .",
23
+ "test:docker:run": "docker run laji-form-test"
20
24
  },
21
25
  "keywords": [
22
26
  "react-jsonschema-form",
@@ -27,7 +31,7 @@
27
31
  "repository": "https://github.com/luomus/laji-form.git",
28
32
  "license": "MIT",
29
33
  "dependencies": {
30
- "@luomus/laji-map": "^4.0.3",
34
+ "@luomus/laji-map": "^5.0.1",
31
35
  "@luomus/laji-validate": "0.0.120",
32
36
  "@rjsf/core": "~5.1.0",
33
37
  "@rjsf/utils": "~5.1.0",
@@ -87,7 +91,7 @@
87
91
  "react-bootstrap-5": "npm:react-bootstrap@^2.5.0"
88
92
  },
89
93
  "volta": {
90
- "node": "16.20.2"
94
+ "node": "20.10.0"
91
95
  },
92
96
  "publishConfig": {
93
97
  "access": "public"
@@ -57,8 +57,8 @@ interface DemoPageProps {
57
57
  }
58
58
  export declare class Form {
59
59
  protected page: Page;
60
- protected locator: Locator;
61
- constructor(page: Page, locator?: Locator);
60
+ protected $locator: Locator;
61
+ constructor(page: Page, $locator?: Locator);
62
62
  $form: Locator;
63
63
  $locate(path: string): Locator;
64
64
  $locateButton(path: string, selector: string, locateFromBody?: boolean): Locator;
@@ -252,6 +252,7 @@ export declare const mockImageMetadata: {
252
252
  };
253
253
  export declare const filterUUIDs: (any: any) => any;
254
254
  export declare const maybeJSONPointerToLocator: (pointer: string) => string;
255
+ /** Fills value into given input and presses tab to unfocus it. Useful for inputs with debounce */
255
256
  export declare const updateValue: ($input: Locator, value: string) => Promise<void>;
256
257
  export declare const getRemoveUnit: (page: Page) => (gatheringIdx: number, unitIdx: number) => Promise<void>;
257
258
  export {};
@@ -45,25 +45,25 @@ function getEnumWidgetForContainer($container) {
45
45
  };
46
46
  }
47
47
  class Form {
48
- constructor(page, locator = page.locator(".laji-form")) {
48
+ constructor(page, $locator = page.locator(".laji-form")) {
49
49
  this.page = page;
50
- this.locator = locator;
51
- this.$form = this.page.locator(".laji-form .rjsf");
50
+ this.$locator = $locator;
51
+ this.$form = this.$locator.locator(".rjsf");
52
52
  this.getMockStr = (path, query) => `window.mockResponses[window.getMockQueryKey(${JSON.stringify(path)}, ${JSON.stringify(query)})]`;
53
53
  this.createValidatorPO = (type) => ({
54
- $$all: this.page.locator(`.laji-form-error-list:not(.laji-form-failed-jobs-list) .${type}-panel .list-group button`),
55
- $panel: this.page.locator(`.laji-form-error-list:not(.laji-form-failed-jobs-list) .${type}-panel`)
54
+ $$all: this.$locator.locator(`.laji-form-error-list:not(.laji-form-failed-jobs-list) .${type}-panel .list-group button`),
55
+ $panel: this.$locator.locator(`.laji-form-error-list:not(.laji-form-failed-jobs-list) .${type}-panel`)
56
56
  });
57
57
  this.errors = this.createValidatorPO("error");
58
58
  this.warnings = this.createValidatorPO("warning");
59
59
  this.failedJobs = {
60
- $container: this.page.locator(".laji-form-failed-jobs-list"),
61
- $$errors: this.page.locator(".laji-form-failed-jobs-list .list-group-item")
60
+ $container: this.$locator.locator(".laji-form-failed-jobs-list"),
61
+ $$errors: this.$locator.locator(".laji-form-failed-jobs-list .list-group-item")
62
62
  };
63
- this.$runningJobs = this.page.locator(".running-jobs");
64
- this.$acknowledgeWarnings = this.page.locator(".laji-form-warning-list .panel-footer button");
63
+ this.$runningJobs = this.$locator.locator(".running-jobs");
64
+ this.$acknowledgeWarnings = this.$locator.locator(".laji-form-warning-list .panel-footer button");
65
65
  this.$blocker = this.page.locator(".laji-form.blocking-loader");
66
- this.$mapFieldFullscreenMap = this.page.locator(".laji-form.fullscreen .laji-form-map");
66
+ this.$mapFieldFullscreenMap = this.$locator.locator(".laji-form.fullscreen .laji-form-map");
67
67
  this.getImageArrayField = (lajiFormLocator) => {
68
68
  const $container = this.$locate(lajiFormLocator).locator(".laji-form-medias");
69
69
  const $imgContainers = this.$locate(lajiFormLocator).locator(".media-container");
@@ -92,7 +92,7 @@ class Form {
92
92
  };
93
93
  this.getTaxonAutosuggestWidget = (lajiFormLocator) => {
94
94
  const autosuggest = this.getAutosuggestWidget(lajiFormLocator);
95
- return Object.assign(Object.assign({}, autosuggest), { $powerUserButton: this.page.locator(".power-user-addon"), $suggestedGlyph: this.$locate(lajiFormLocator).locator(".glyphicon-ok"), $nonsuggestedGlyph: this.$locate(lajiFormLocator).locator(".glyphicon-warning-sign") });
95
+ return Object.assign(Object.assign({}, autosuggest), { $powerUserButton: this.$locator.locator(".power-user-addon"), $suggestedGlyph: this.$locate(lajiFormLocator).locator(".glyphicon-ok"), $nonsuggestedGlyph: this.$locate(lajiFormLocator).locator(".glyphicon-warning-sign") });
96
96
  };
97
97
  this.getPersonAutosuggestWidget = (lajiFormLocator) => {
98
98
  const autosuggest = this.getAutosuggestWidget(lajiFormLocator);
@@ -151,10 +151,10 @@ class Form {
151
151
  };
152
152
  }
153
153
  $locate(path) {
154
- return this.page.locator(exports.lajiFormLocator(path));
154
+ return this.$locator.locator(exports.lajiFormLocator(path));
155
155
  }
156
156
  $locateButton(path, selector, locateFromBody = false) {
157
- return (locateFromBody ? this.page : this.locator).locator(`#root${typeof path === "string" && path.length > 0 ? `_${path.replace(/\./g, "_")}` : ""}-${selector}`);
157
+ return (locateFromBody ? this.page : this.$locator).locator(`#root${typeof path === "string" && path.length > 0 ? `_${path.replace(/\./g, "_")}` : ""}-${selector}`);
158
158
  }
159
159
  $locateAddition(path, selector, locateFromBody = false) {
160
160
  return this.$locateButton(path, selector, locateFromBody);
@@ -356,6 +356,7 @@ const filterUUIDs = (any) => {
356
356
  exports.filterUUIDs = filterUUIDs;
357
357
  const maybeJSONPointerToLocator = (pointer) => pointer[0] === "/" ? pointer.slice(1).replace(/\//g, "_") : pointer;
358
358
  exports.maybeJSONPointerToLocator = maybeJSONPointerToLocator;
359
+ /** Fills value into given input and presses tab to unfocus it. Useful for inputs with debounce */
359
360
  const updateValue = ($input, value) => __awaiter(void 0, void 0, void 0, function* () {
360
361
  yield $input.fill(value);
361
362
  yield $input.press("Tab");
@@ -0,0 +1,11 @@
1
+ FROM mcr.microsoft.com/playwright:v1.40.1
2
+
3
+ WORKDIR /app
4
+
5
+ # Copy application files (see .dockerignore for what's excluded)
6
+ COPY . .
7
+
8
+ # Install dependencies
9
+ RUN npm ci
10
+
11
+ ENTRYPOINT ["npx", "playwright", "test"]
package/migrate.sh DELETED
@@ -1,32 +0,0 @@
1
- files="$@"
2
- set -e
3
-
4
- echo "Add playwright import..."
5
- sed -i '1s/^/import { test, expect } from "@playwright\/test";\n/' $files
6
-
7
- echo "Removing protractor imports..."
8
- sed -i"" -e '/import.*protractor/d' $files
9
-
10
- #echo "Adding serial mode..."
11
- #sed -i"" -e '/import/,/^$/s/^$/\ntest.describe.configure\({ mode: "serial" }\);\n/g' $files
12
-
13
- echo "Replacing protractor cmds with playwright..."
14
- sed -i"" -E 's/\w?describe\(/test.describe\(/' $files
15
- sed -i"" -E 's/\w?it\(/test\(/' $files
16
- sed -i"" -E 's/\w?afterEach\(/test.afterEach\(/' $files
17
- sed -i"" -E 's/\w?beforeAll\(/test.beforeAll\(/' $files
18
- sed -i"" -E 's/\w?beforeEach\(/test.beforeEach\(/' $files
19
- sed -i"" -E 's/\w?afterAll\(/test.afterAll\(/' $files
20
- sed -i"" -E 's/\.\$\$\(/\.locator\(/g' $files
21
- sed -i"" -E 's/\.\$\(/\.locator\(/g' $files
22
- sed -i"" -E 's/\.get\(/\.nth\(/g' $files
23
- sed -i"" -E 's/ElementArrayFinder/ElementFinder/g' $files
24
- sed -i"" -E 's/ElementFinder/Locator/g' $files
25
- sed -i"" -E 's/sendKeys/fill/g' $files
26
- sed -i"" -E 's/protractor.Key.ENTER/"Enter"/g' $files
27
- sed -i"" -E 's/protractor.Key.TAB/"Tab"/g' $files
28
- sed -i"" -E 's/protractor.Key.DOWN/"ArrowDown"/g' $files
29
-
30
- #laji form specific
31
- sed -i"" -E 's/beforeAll\(async \(\)/beforeAll\(async \({browser}\)/' $files
32
- sed -i"" -E 's/createForm\(/createForm\(await browser.newPage(), /' $files