@luomus/laji-form 14.3.8 → 15.0.0
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.
- package/CHANGELOG.md +4 -0
- package/cypress/fixtures/example.json +5 -0
- closes suggestion list (failed).png +0 -0
- is marked as suggested (failed).png +0 -0
- package/dist/laji-form.js +1 -1
- package/lib/components/LajiForm.js +0 -1
- package/lib/components/fields/ImageArrayField.js +2 -4
- package/lib/components/fields/NamedPlaceSaverField.js +1 -1
- package/lib/components/fields/SectionArrayField.js +5 -1
- package/lib/components/fields/SingleActiveArrayField.js +1 -1
- package/lib/components/fields/UnitShorthandField.js +2 -2
- package/lib/components/templates/ArrayFieldTemplate.js +3 -2
- package/lib/components/templates/FieldTemplate.js +2 -2
- package/lib/utils.d.ts +6 -2
- package/lib/utils.js +13 -13
- package/llol +10 -0
- package/llol.pdf +10 -0
- package/migrate.sh +33 -0
- package/package.json +14 -21
- package/playwright-report/index.html +62 -0
- package/playwright.config.ts +77 -0
- package/q +196 -0
- package/rename.sh +24 -0
- package/test-export/test-utils.d.ts +176 -150
- package/test-export/test-utils.js +210 -218
- package/trip-report.spec.ts +594 -0
- package/tsconfig.test.json +1 -1
- package/lib/components/fields/AsArrayField.d.ts +0 -292
- package/lib/components/fields/AsArrayField.js +0 -39
- package/test-export/array-spec.d.ts +0 -1
- package/test-export/array-spec.js +0 -204
- package/test-export/bird-point-count-spec.d.ts +0 -1
- package/test-export/bird-point-count-spec.js +0 -62
- package/test-export/collection-contest-form-spec.d.ts +0 -1
- package/test-export/collection-contest-form-spec.js +0 -38
- package/test-export/dataset-form-spec.d.ts +0 -1
- package/test-export/dataset-form-spec.js +0 -50
- package/test-export/date-time-widget-spec.d.ts +0 -1
- package/test-export/date-time-widget-spec.js +0 -188
- package/test-export/geocoder-spec.d.ts +0 -1
- package/test-export/geocoder-spec.js +0 -135
- package/test-export/image-array-spec.d.ts +0 -1
- package/test-export/image-array-spec.js +0 -94
- package/test-export/inject-field-spec.d.ts +0 -1
- package/test-export/inject-field-spec.js +0 -148
- package/test-export/internal-uuids-spec.d.ts +0 -1
- package/test-export/internal-uuids-spec.js +0 -157
- package/test-export/invasive-species-eradication-np-spec.d.ts +0 -1
- package/test-export/invasive-species-eradication-np-spec.js +0 -18
- package/test-export/invasive-species-eradication-spec.d.ts +0 -1
- package/test-export/invasive-species-eradication-spec.js +0 -25
- package/test-export/line-transect-spec.d.ts +0 -1
- package/test-export/line-transect-spec.js +0 -121
- package/test-export/mobile-form-spec.d.ts +0 -1
- package/test-export/mobile-form-spec.js +0 -84
- package/test-export/nafi-spec.d.ts +0 -1
- package/test-export/nafi-spec.js +0 -85
- package/test-export/select-widget-spec.d.ts +0 -1
- package/test-export/select-widget-spec.js +0 -68
- package/test-export/single-item-array-field-spec.d.ts +0 -1
- package/test-export/single-item-array-field-spec.js +0 -92
- package/test-export/syke-butterfly-spec.d.ts +0 -1
- package/test-export/syke-butterfly-spec.js +0 -163
- package/test-export/transaction-form-spec.d.ts +0 -1
- package/test-export/transaction-form-spec.js +0 -63
- package/test-export/trip-report-autosuggest-spec.d.ts +0 -1
- package/test-export/trip-report-autosuggest-spec.js +0 -272
- package/test-export/trip-report-spec.d.ts +0 -1
- package/test-export/trip-report-spec.js +0 -456
- package/test-export/unit-list-shorthand-array-field-spec.d.ts +0 -1
- package/test-export/unit-list-shorthand-array-field-spec.js +0 -71
- package/test-export/validation-spec.d.ts +0 -1
- package/test-export/validation-spec.js +0 -336
- package/test-export/water-bird-spec.d.ts +0 -1
- package/test-export/water-bird-spec.js +0 -30
- package/test-export/wbc-spec.d.ts +0 -1
- package/test-export/wbc-spec.js +0 -82
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const test_utils_1 = require("./test-utils");
|
|
13
|
-
describe("Internal UUIDs", () => {
|
|
14
|
-
let form;
|
|
15
|
-
const schema = {
|
|
16
|
-
type: "object",
|
|
17
|
-
properties: {
|
|
18
|
-
arrayOfObjects: {
|
|
19
|
-
type: "array",
|
|
20
|
-
items: {
|
|
21
|
-
type: "object",
|
|
22
|
-
properties: {
|
|
23
|
-
string: {
|
|
24
|
-
type: "string"
|
|
25
|
-
},
|
|
26
|
-
innerArrayOfObjects: {
|
|
27
|
-
type: "array",
|
|
28
|
-
items: {
|
|
29
|
-
type: "object",
|
|
30
|
-
properties: {
|
|
31
|
-
string: {
|
|
32
|
-
type: "string"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
object: {
|
|
41
|
-
type: "object",
|
|
42
|
-
properties: {
|
|
43
|
-
innerObject: {
|
|
44
|
-
type: "object",
|
|
45
|
-
properties: {
|
|
46
|
-
arrayOfObjects: {
|
|
47
|
-
type: "array",
|
|
48
|
-
items: {
|
|
49
|
-
type: "object",
|
|
50
|
-
properties: {
|
|
51
|
-
string: {
|
|
52
|
-
type: "string"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
number: {
|
|
62
|
-
type: "number"
|
|
63
|
-
},
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const formData = {
|
|
67
|
-
arrayOfObjects: [
|
|
68
|
-
{
|
|
69
|
-
string: "foo",
|
|
70
|
-
innerArrayOfObjects: [
|
|
71
|
-
{
|
|
72
|
-
string: "foo"
|
|
73
|
-
}
|
|
74
|
-
]
|
|
75
|
-
}
|
|
76
|
-
],
|
|
77
|
-
object: {
|
|
78
|
-
innerObject: {
|
|
79
|
-
arrayOfObjects: [
|
|
80
|
-
{
|
|
81
|
-
string: "foo"
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
number: 2
|
|
87
|
-
};
|
|
88
|
-
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
89
|
-
form = yield test_utils_1.createForm();
|
|
90
|
-
yield form.setState({ schema, formData });
|
|
91
|
-
}));
|
|
92
|
-
it("are generated on initialization", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
93
|
-
const { formData } = yield form.getState();
|
|
94
|
-
yield expect(formData.arrayOfObjects[0]._lajiFormId).not.toBe(undefined);
|
|
95
|
-
yield expect(formData.arrayOfObjects[0].innerArrayOfObjects[0]._lajiFormId).not.toBe(undefined);
|
|
96
|
-
yield expect(formData.object.innerObject.arrayOfObjects[0]._lajiFormId).not.toBe(undefined);
|
|
97
|
-
}));
|
|
98
|
-
it("keeps data intact on id generation", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
99
|
-
const { formData } = yield form.getState();
|
|
100
|
-
yield expect(formData.arrayOfObjects[0].string).toBe("foo");
|
|
101
|
-
yield expect(formData.arrayOfObjects[0].innerArrayOfObjects[0].string).toBe("foo");
|
|
102
|
-
yield expect(formData.object.innerObject.arrayOfObjects[0].string).toBe("foo");
|
|
103
|
-
yield expect(formData.number).toBe(2);
|
|
104
|
-
}));
|
|
105
|
-
it("are removed on submit", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
106
|
-
yield form.submit();
|
|
107
|
-
const submitted = yield form.getSubmittedData();
|
|
108
|
-
yield expect(submitted.arrayOfObjects[0]).not.toContain("_lajiFormId");
|
|
109
|
-
yield expect(submitted.arrayOfObjects[0].innerArrayOfObjects[0]).not.toContain("_lajiFormId");
|
|
110
|
-
yield expect(submitted.object.innerObject.arrayOfObjects[0]).not.toContain("_lajiFormId");
|
|
111
|
-
}));
|
|
112
|
-
it("keeps data intact when ids removed", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
113
|
-
yield form.submit();
|
|
114
|
-
const submitted = yield form.getSubmittedData();
|
|
115
|
-
yield expect(submitted.arrayOfObjects[0].string).toBe("foo");
|
|
116
|
-
yield expect(submitted.arrayOfObjects[0].innerArrayOfObjects[0].string).toBe("foo");
|
|
117
|
-
yield expect(submitted.object.innerObject.arrayOfObjects[0].string).toBe("foo");
|
|
118
|
-
yield expect(submitted.number).toBe(2);
|
|
119
|
-
}));
|
|
120
|
-
it("are removed on change by default", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
121
|
-
yield form.$locateButton("arrayOfObjects", "add").click();
|
|
122
|
-
const changed = yield form.getChangedData();
|
|
123
|
-
yield expect(changed.arrayOfObjects[0]).not.toContain("_lajiFormId");
|
|
124
|
-
yield expect(changed.arrayOfObjects[0].innerArrayOfObjects[0]).not.toContain("_lajiFormId");
|
|
125
|
-
yield expect(changed.object.innerObject.arrayOfObjects[0]).not.toContain("_lajiFormId");
|
|
126
|
-
}));
|
|
127
|
-
it("are not removed on change if optimizeOnChange", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
128
|
-
yield form.setState({ optimizeOnChange: true });
|
|
129
|
-
yield form.$locateButton("arrayOfObjects", "add").click();
|
|
130
|
-
const changed = yield form.getChangedData();
|
|
131
|
-
yield expect(changed.arrayOfObjects[0]._lajiFormId).not.toBe(undefined);
|
|
132
|
-
yield form.setState({ optimizeOnChange: false });
|
|
133
|
-
}));
|
|
134
|
-
it("are added to new array items", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
135
|
-
yield form.setState({ optimizeOnChange: true, formData: Object.assign({}, formData) });
|
|
136
|
-
yield form.$locateButton("arrayOfObjects", "add").click();
|
|
137
|
-
const changed = yield form.getChangedData();
|
|
138
|
-
yield expect(changed.arrayOfObjects[1]._lajiFormId).not.toBe(undefined);
|
|
139
|
-
}));
|
|
140
|
-
describe("use pre-existing ids", () => {
|
|
141
|
-
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
142
|
-
yield form.setState({
|
|
143
|
-
formData: Object.assign(Object.assign({}, formData), { arrayOfObjects: [Object.assign(Object.assign({}, formData.arrayOfObjects[0]), { id: "ID" })] })
|
|
144
|
-
});
|
|
145
|
-
}));
|
|
146
|
-
it("instead of _lajiFormId", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
147
|
-
const { formData } = yield form.getState();
|
|
148
|
-
yield expect(formData.arrayOfObjects[0].id).toBe("ID");
|
|
149
|
-
yield expect(formData.arrayOfObjects[0]).not.toContain("_lajiFormId");
|
|
150
|
-
}));
|
|
151
|
-
it("and they are kept intact when ids are removed", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
152
|
-
yield form.submit();
|
|
153
|
-
const submitted = yield form.getSubmittedData();
|
|
154
|
-
yield expect(submitted.arrayOfObjects[0].id).toBe("ID");
|
|
155
|
-
}));
|
|
156
|
-
});
|
|
157
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const test_utils_1 = require("./test-utils");
|
|
13
|
-
describe("invasive species eradication named place form (MHL.32)", () => {
|
|
14
|
-
it("renders", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
-
// Just check that no error occurs.
|
|
16
|
-
yield test_utils_1.createForm({ id: "MHL.32", localFormData: true });
|
|
17
|
-
}));
|
|
18
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const test_utils_1 = require("./test-utils");
|
|
13
|
-
const test_utils_2 = require("@luomus/laji-map/test-export/test-utils");
|
|
14
|
-
describe("invasive species eradication form (MHL.33)", () => {
|
|
15
|
-
let form;
|
|
16
|
-
it("renders", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
// Just check that no error occurs.
|
|
18
|
-
form = yield test_utils_1.createForm({ id: "MHL.33", localFormData: true });
|
|
19
|
-
}));
|
|
20
|
-
it("geometry can be drawn", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
-
const map = new test_utils_2.MapPageObject();
|
|
22
|
-
yield map.drawRectangle();
|
|
23
|
-
expect((yield form.getChangedData()).gatherings[0].geometry.geometries[0].type).toBe("Polygon");
|
|
24
|
-
}));
|
|
25
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const test_utils_1 = require("./test-utils");
|
|
13
|
-
const protractor_1 = require("protractor");
|
|
14
|
-
describe("Line transect (MHL.1)", () => {
|
|
15
|
-
let form;
|
|
16
|
-
let $taxon;
|
|
17
|
-
let unitAutocompleteMock;
|
|
18
|
-
let taxonAutocompleteMock;
|
|
19
|
-
const unitAutocompleteResponse = {
|
|
20
|
-
"key": "llx",
|
|
21
|
-
"value": "llx",
|
|
22
|
-
"payload": {
|
|
23
|
-
"unit": {
|
|
24
|
-
"shortHandText": "llx",
|
|
25
|
-
"identifications": [
|
|
26
|
-
{
|
|
27
|
-
"taxon": "Luscinia luscinia"
|
|
28
|
-
}
|
|
29
|
-
],
|
|
30
|
-
"informalTaxonGroups": [
|
|
31
|
-
"MVL.1"
|
|
32
|
-
],
|
|
33
|
-
"unitFact": {
|
|
34
|
-
"autocompleteSelectedTaxonID": "MX.32819",
|
|
35
|
-
"lineTransectObsType": "MY.lineTransectObsTypeSong",
|
|
36
|
-
"lineTransectRouteFieldType": "MY.lineTransectRouteFieldTypeOuter"
|
|
37
|
-
},
|
|
38
|
-
"pairCount": 1,
|
|
39
|
-
"individualCount": 1
|
|
40
|
-
},
|
|
41
|
-
"interpretedFrom": {
|
|
42
|
-
"taxon": "LL",
|
|
43
|
-
"type": "X"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const taxonAutocompleteResponse = [
|
|
48
|
-
{
|
|
49
|
-
"key": "MX.32819",
|
|
50
|
-
"value": "Luscinia luscinia",
|
|
51
|
-
"payload": {
|
|
52
|
-
"matchingName": "Luscinia luscinia",
|
|
53
|
-
"informalTaxonGroups": [
|
|
54
|
-
{
|
|
55
|
-
"id": "MVL.1",
|
|
56
|
-
"name": "Linnut"
|
|
57
|
-
}
|
|
58
|
-
],
|
|
59
|
-
"scientificName": "Luscinia luscinia",
|
|
60
|
-
"scientificNameAuthorship": "(Linnaeus, 1758)",
|
|
61
|
-
"taxonRankId": "MX.species",
|
|
62
|
-
"matchType": "exactMatches",
|
|
63
|
-
"cursiveName": true,
|
|
64
|
-
"finnish": true,
|
|
65
|
-
"species": true,
|
|
66
|
-
"nameType": "MX.scientificName",
|
|
67
|
-
"vernacularName": "satakieli"
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
];
|
|
71
|
-
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
72
|
-
form = yield test_utils_1.createForm({ id: "MHL.1", localFormData: true });
|
|
73
|
-
$taxon = form.$locate("gatherings.0.units.0.identifications.0.taxon");
|
|
74
|
-
unitAutocompleteMock = yield form.setMockResponse("/autocomplete/unit", false);
|
|
75
|
-
taxonAutocompleteMock = yield form.setMockResponse("/autocomplete/taxon", false);
|
|
76
|
-
}));
|
|
77
|
-
const $shortHandForIdx = (idx, _idx) => protractor_1.$(`#root_gatherings_${idx}_units_${_idx}_shortHandText`);
|
|
78
|
-
const $shorthand = $shortHandForIdx(0, 0);
|
|
79
|
-
it("shorthand unit is shown", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
80
|
-
expect(yield $shorthand.isDisplayed()).toBe(true);
|
|
81
|
-
}));
|
|
82
|
-
it("shorthand unit expands code after typing code", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
83
|
-
function waitUntilShorthandShowsSchema() {
|
|
84
|
-
return protractor_1.browser.wait(protractor_1.protractor.ExpectedConditions.presenceOf($taxon), 5000, "Code reading timeout");
|
|
85
|
-
}
|
|
86
|
-
yield $shorthand.sendKeys("llx");
|
|
87
|
-
yield $shorthand.sendKeys(protractor_1.protractor.Key.ENTER);
|
|
88
|
-
yield unitAutocompleteMock.resolve(unitAutocompleteResponse);
|
|
89
|
-
yield waitUntilShorthandShowsSchema();
|
|
90
|
-
expect(yield $taxon.isDisplayed()).toBe(true);
|
|
91
|
-
}));
|
|
92
|
-
it("next unit is automatically added", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
93
|
-
expect(yield $shortHandForIdx(0, 1).isDisplayed()).toBe(true);
|
|
94
|
-
}));
|
|
95
|
-
it("unit formData matches response", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
96
|
-
const formData = yield form.getChangedData();
|
|
97
|
-
expect(test_utils_1.filterUUIDs(formData.gatherings[0].units[0])).toEqual(unitAutocompleteResponse.payload.unit);
|
|
98
|
-
expect(formData.gatherings[0].units[0].identifications_0_taxon).toBe(undefined);
|
|
99
|
-
expect(formData.gatherings[0].units[0].unitFact_autocompleteSelectedTaxonID).toBe(undefined);
|
|
100
|
-
expect(formData.gatherings[0].units[0].unitFact_lineTransectObsType).toBe(undefined);
|
|
101
|
-
expect(formData.gatherings[0].units[0].unitFact_lineTransectRouteFieldType).toBe(undefined);
|
|
102
|
-
}));
|
|
103
|
-
it("next unit is focused", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
104
|
-
expect(yield test_utils_1.getFocusedId()).toBe(yield $shortHandForIdx(0, 1).getAttribute("id"));
|
|
105
|
-
}));
|
|
106
|
-
it("prev unit is focused after keyboard navigation", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
107
|
-
yield protractor_1.browser.driver.switchTo().activeElement().sendKeys(protractor_1.protractor.Key.chord(protractor_1.protractor.Key.ALT, protractor_1.protractor.Key.UP));
|
|
108
|
-
expect(yield test_utils_1.getFocusedId()).toBe(yield form.$getInputWidget("gatherings.0.units.0.identifications.0.taxon").getAttribute("id"));
|
|
109
|
-
}));
|
|
110
|
-
it("next gathering is focused after keyboard navigation", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
111
|
-
yield protractor_1.browser.driver.switchTo().activeElement().sendKeys(protractor_1.protractor.Key.chord(protractor_1.protractor.Key.ALT, protractor_1.protractor.Key.RIGHT));
|
|
112
|
-
yield protractor_1.browser.sleep(200);
|
|
113
|
-
expect(yield test_utils_1.getFocusedId()).toBe(yield $shortHandForIdx(1, 0).getAttribute("id"));
|
|
114
|
-
}));
|
|
115
|
-
it("when prev focused taxon autocomplete finishes, data isn't in FlatField format", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
116
|
-
yield taxonAutocompleteMock.resolve(taxonAutocompleteResponse);
|
|
117
|
-
const formData = yield form.getChangedData();
|
|
118
|
-
expect(test_utils_1.filterUUIDs(formData.gatherings[0].units[0])).toEqual(unitAutocompleteResponse.payload.unit);
|
|
119
|
-
expect(formData.gatherings[0].units[0].identifications_0_taxon).toBe(undefined);
|
|
120
|
-
}));
|
|
121
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const test_utils_1 = require("./test-utils");
|
|
13
|
-
const protractor_1 = require("protractor");
|
|
14
|
-
const $blocker = test_utils_1.lajiFormLocate("gatherings.0.geometry").$(".blocker");
|
|
15
|
-
const $imageAddModal = protractor_1.$(".media-add-modal");
|
|
16
|
-
const $mobileEditorMap = protractor_1.$(".laji-form.fullscreen .laji-form-map");
|
|
17
|
-
describe("Mobile form (MHL.51)", () => {
|
|
18
|
-
describe("without formData", () => {
|
|
19
|
-
let form;
|
|
20
|
-
it("navigate to form", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
-
form = yield test_utils_1.createForm({ id: "MHL.51" });
|
|
22
|
-
}));
|
|
23
|
-
it("is displayed", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
-
expect(yield form.$form.isPresent()).toBe(true);
|
|
25
|
-
}));
|
|
26
|
-
it("image add modal is displayed", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
-
expect(yield $imageAddModal.isPresent()).toBe(true);
|
|
28
|
-
}));
|
|
29
|
-
it("clicking cancel on image add modal hides it", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
-
yield $imageAddModal.$(".cancel").click();
|
|
31
|
-
expect(yield $imageAddModal.isPresent()).toBe(false);
|
|
32
|
-
}));
|
|
33
|
-
});
|
|
34
|
-
describe("with formData with geometry", () => {
|
|
35
|
-
let form;
|
|
36
|
-
it("navigate to form", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
-
form = yield test_utils_1.createForm({ id: "MHL.51", localFormData: "MHL.51-geometry" });
|
|
38
|
-
}));
|
|
39
|
-
it("is displayed", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
-
expect(yield form.$form.isPresent()).toBe(true);
|
|
41
|
-
}));
|
|
42
|
-
it("image add modal is displayed", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
-
expect(yield $imageAddModal.isPresent()).toBe(true);
|
|
44
|
-
}));
|
|
45
|
-
it("map doesn't geolocating blocker since it has geometry", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
-
expect(yield $blocker.isPresent()).toBe(false);
|
|
47
|
-
}));
|
|
48
|
-
it("map doesn't show mobile editor", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
-
yield protractor_1.browser.sleep(100);
|
|
50
|
-
expect(yield $mobileEditorMap.isPresent()).toBe(false);
|
|
51
|
-
}));
|
|
52
|
-
});
|
|
53
|
-
describe("with formData with image", () => {
|
|
54
|
-
let form;
|
|
55
|
-
it("navigate to form", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
-
form = yield test_utils_1.createForm({ id: "MHL.51", localFormData: "MHL.51-image-geometry" });
|
|
57
|
-
}));
|
|
58
|
-
it("is displayed", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
-
expect(yield form.$form.isPresent()).toBe(true);
|
|
60
|
-
}));
|
|
61
|
-
it("image add modal isn't displayed", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
|
-
expect(yield $imageAddModal.isPresent()).toBe(false);
|
|
63
|
-
}));
|
|
64
|
-
it("map doesn't geolocating blocker since it has geometry", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
-
expect(yield $blocker.isPresent()).toBe(false);
|
|
66
|
-
}));
|
|
67
|
-
it("map doesn't show mobile editor", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
-
yield protractor_1.browser.sleep(100);
|
|
69
|
-
expect(yield $mobileEditorMap.isPresent()).toBe(false);
|
|
70
|
-
}));
|
|
71
|
-
});
|
|
72
|
-
describe("with formData without image and edit mode", () => {
|
|
73
|
-
let form;
|
|
74
|
-
it("navigate to form", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
|
-
form = yield test_utils_1.createForm({ id: "MHL.51", localFormData: "MHL.51-geometry", isEdit: true });
|
|
76
|
-
}));
|
|
77
|
-
it("is displayed", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
78
|
-
expect(yield form.$form.isPresent()).toBe(true);
|
|
79
|
-
}));
|
|
80
|
-
it("image add modal isn't displayed", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
81
|
-
expect(yield $imageAddModal.isPresent()).toBe(false);
|
|
82
|
-
}));
|
|
83
|
-
});
|
|
84
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/test-export/nafi-spec.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const test_utils_1 = require("./test-utils");
|
|
13
|
-
const protractor_1 = require("protractor");
|
|
14
|
-
const taxonAutocompleteResponse = [{
|
|
15
|
-
"key": "MX.46587",
|
|
16
|
-
"value": "kettu",
|
|
17
|
-
"payload": {
|
|
18
|
-
"matchingName": "kettu",
|
|
19
|
-
"informalTaxonGroups": [
|
|
20
|
-
{
|
|
21
|
-
"id": "MVL.2",
|
|
22
|
-
"name": "Nisäkkäät"
|
|
23
|
-
}
|
|
24
|
-
],
|
|
25
|
-
"scientificName": "Vulpes vulpes",
|
|
26
|
-
"scientificNameAuthorship": "(Linnaeus, 1758)",
|
|
27
|
-
"taxonRankId": "MX.species",
|
|
28
|
-
"matchType": "exactMatches",
|
|
29
|
-
"cursiveName": true,
|
|
30
|
-
"finnish": true,
|
|
31
|
-
"species": true,
|
|
32
|
-
"nameType": "MX.vernacularName",
|
|
33
|
-
"vernacularName": "kettu"
|
|
34
|
-
}
|
|
35
|
-
}];
|
|
36
|
-
describe("NAFI (MHL.6)", () => {
|
|
37
|
-
let form;
|
|
38
|
-
let taxonAutosuggest;
|
|
39
|
-
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
-
form = yield test_utils_1.createForm({ id: "MHL.6" });
|
|
41
|
-
}));
|
|
42
|
-
it("can add unit", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
-
yield form.$locateButton("gatherings.0.units", "add").click();
|
|
44
|
-
expect(yield form.$locate("gatherings.0.units.121").isDisplayed()).toBe(true);
|
|
45
|
-
}));
|
|
46
|
-
describe("selecting species name with mouse", () => {
|
|
47
|
-
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
-
taxonAutosuggest = form.getTaxonAutosuggestWidget("gatherings.0.units.121.identifications.0.taxon");
|
|
49
|
-
}));
|
|
50
|
-
it("selects suggestion value", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
-
const autocompleteMock = yield form.setMockResponse("/autocomplete/taxon", false);
|
|
52
|
-
yield taxonAutosuggest.$input.sendKeys("kettu");
|
|
53
|
-
yield autocompleteMock.resolve(taxonAutocompleteResponse);
|
|
54
|
-
yield taxonAutosuggest.waitForSuggestionsToLoad();
|
|
55
|
-
yield taxonAutosuggest.$$suggestions.first().click();
|
|
56
|
-
expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kettu");
|
|
57
|
-
yield autocompleteMock.remove();
|
|
58
|
-
}));
|
|
59
|
-
it("and is marked as suggested", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
|
-
expect(yield taxonAutosuggest.isSuggested()).toBe(true);
|
|
61
|
-
}));
|
|
62
|
-
it("and closes suggestion list", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
-
expect(yield taxonAutosuggest.$suggestionsContainer.isPresent()).toBe(false);
|
|
64
|
-
}));
|
|
65
|
-
});
|
|
66
|
-
describe("selecting species name with keyboard navigation", () => {
|
|
67
|
-
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
-
taxonAutosuggest = form.getTaxonAutosuggestWidget("gatherings.0.units.122.identifications.0.taxon");
|
|
69
|
-
}));
|
|
70
|
-
it("works", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
71
|
-
yield form.$locateButton("gatherings.0.units", "add").click();
|
|
72
|
-
yield taxonAutosuggest.$input.sendKeys("kettu");
|
|
73
|
-
yield taxonAutosuggest.waitForSuggestionsToLoad();
|
|
74
|
-
yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.DOWN);
|
|
75
|
-
yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.ENTER);
|
|
76
|
-
expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kettu");
|
|
77
|
-
}));
|
|
78
|
-
it("and is marked as suggested", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
79
|
-
expect(yield taxonAutosuggest.isSuggested()).toBe(true);
|
|
80
|
-
}));
|
|
81
|
-
it("and closes suggestion list", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
82
|
-
expect(yield taxonAutosuggest.$suggestionsContainer.isPresent()).toBe(false);
|
|
83
|
-
}));
|
|
84
|
-
});
|
|
85
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const test_utils_1 = require("./test-utils");
|
|
13
|
-
const protractor_1 = require("protractor");
|
|
14
|
-
describe("SelectWidget", () => {
|
|
15
|
-
let form;
|
|
16
|
-
const enums = {
|
|
17
|
-
"": "",
|
|
18
|
-
a: "aLabel",
|
|
19
|
-
b: "bLabel",
|
|
20
|
-
c: "cLabel",
|
|
21
|
-
};
|
|
22
|
-
const schema = {
|
|
23
|
-
type: "string",
|
|
24
|
-
enum: Object.keys(enums),
|
|
25
|
-
enumNames: Object.keys(enums).map(e => enums[e])
|
|
26
|
-
};
|
|
27
|
-
const initialFormData = "b";
|
|
28
|
-
let enumWidget;
|
|
29
|
-
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
-
form = yield test_utils_1.createForm({ schema, formData: initialFormData });
|
|
31
|
-
enumWidget = form.$getEnumWidget("");
|
|
32
|
-
}));
|
|
33
|
-
it("renders initial value", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
|
-
expect(yield enumWidget.$input.getAttribute("value")).toBe(enums[initialFormData]);
|
|
35
|
-
}));
|
|
36
|
-
it("empty value is selectable", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
-
yield enumWidget.openEnums();
|
|
38
|
-
yield enumWidget.$$enums.first().click();
|
|
39
|
-
expect(yield form.getChangedData()).toBe(null);
|
|
40
|
-
}));
|
|
41
|
-
it("nonempty value is selectable after empty was selected", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
-
yield enumWidget.openEnums();
|
|
43
|
-
yield enumWidget.$$enums.last().click();
|
|
44
|
-
expect(yield enumWidget.$input.getAttribute("value")).toBe(enums.c);
|
|
45
|
-
expect(yield form.getChangedData()).toBe("c");
|
|
46
|
-
}));
|
|
47
|
-
it("selecting value and then empty value without blurring in between keeps empty value", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
-
yield enumWidget.openEnums();
|
|
49
|
-
yield enumWidget.$$enums.last().click();
|
|
50
|
-
yield enumWidget.openEnums();
|
|
51
|
-
yield enumWidget.$$enums.first().click();
|
|
52
|
-
expect(yield form.getChangedData()).toBe(null);
|
|
53
|
-
}));
|
|
54
|
-
it("value can be selected with enter", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
-
yield enumWidget.openEnums();
|
|
56
|
-
yield enumWidget.$input.sendKeys(protractor_1.protractor.Key.DOWN);
|
|
57
|
-
yield enumWidget.$input.sendKeys(protractor_1.protractor.Key.ENTER);
|
|
58
|
-
expect(yield enumWidget.$input.getAttribute("value")).toBe(enums.a);
|
|
59
|
-
expect(yield form.getChangedData()).toBe("a");
|
|
60
|
-
}));
|
|
61
|
-
it("value can be selected with tab", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
|
-
yield enumWidget.openEnums();
|
|
63
|
-
yield enumWidget.$input.sendKeys(protractor_1.protractor.Key.DOWN);
|
|
64
|
-
yield enumWidget.$input.sendKeys(protractor_1.protractor.Key.TAB);
|
|
65
|
-
expect(yield enumWidget.$input.getAttribute("value")).toBe(enums.b);
|
|
66
|
-
expect(yield form.getChangedData()).toBe("b");
|
|
67
|
-
}));
|
|
68
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|