@luomus/laji-form 14.3.7 → 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.
Files changed (68) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/laji-form.js +1 -1
  3. package/lib/components/fields/ImageArrayField.js +1 -1
  4. package/lib/components/fields/NamedPlaceSaverField.js +1 -1
  5. package/lib/components/fields/SectionArrayField.js +5 -1
  6. package/lib/components/fields/SingleActiveArrayField.js +1 -1
  7. package/lib/components/fields/UnitShorthandField.js +2 -2
  8. package/lib/components/templates/ArrayFieldTemplate.js +3 -2
  9. package/lib/components/templates/FieldTemplate.js +2 -2
  10. package/lib/utils.d.ts +6 -2
  11. package/lib/utils.js +13 -13
  12. package/migrate.sh +33 -0
  13. package/package.json +14 -21
  14. package/playwright-report/index.html +62 -0
  15. package/playwright.config.ts +77 -0
  16. package/rename.sh +24 -0
  17. package/test-export/test-utils.d.ts +176 -150
  18. package/test-export/test-utils.js +210 -218
  19. package/trip-report.spec.ts +594 -0
  20. package/tsconfig.test.json +1 -1
  21. package/test-export/array-spec.d.ts +0 -1
  22. package/test-export/array-spec.js +0 -204
  23. package/test-export/bird-point-count-spec.d.ts +0 -1
  24. package/test-export/bird-point-count-spec.js +0 -62
  25. package/test-export/collection-contest-form-spec.d.ts +0 -1
  26. package/test-export/collection-contest-form-spec.js +0 -38
  27. package/test-export/dataset-form-spec.d.ts +0 -1
  28. package/test-export/dataset-form-spec.js +0 -50
  29. package/test-export/date-time-widget-spec.d.ts +0 -1
  30. package/test-export/date-time-widget-spec.js +0 -188
  31. package/test-export/geocoder-spec.d.ts +0 -1
  32. package/test-export/geocoder-spec.js +0 -135
  33. package/test-export/image-array-spec.d.ts +0 -1
  34. package/test-export/image-array-spec.js +0 -94
  35. package/test-export/inject-field-spec.d.ts +0 -1
  36. package/test-export/inject-field-spec.js +0 -148
  37. package/test-export/internal-uuids-spec.d.ts +0 -1
  38. package/test-export/internal-uuids-spec.js +0 -157
  39. package/test-export/invasive-species-eradication-np-spec.d.ts +0 -1
  40. package/test-export/invasive-species-eradication-np-spec.js +0 -18
  41. package/test-export/invasive-species-eradication-spec.d.ts +0 -1
  42. package/test-export/invasive-species-eradication-spec.js +0 -25
  43. package/test-export/line-transect-spec.d.ts +0 -1
  44. package/test-export/line-transect-spec.js +0 -121
  45. package/test-export/mobile-form-spec.d.ts +0 -1
  46. package/test-export/mobile-form-spec.js +0 -84
  47. package/test-export/nafi-spec.d.ts +0 -1
  48. package/test-export/nafi-spec.js +0 -85
  49. package/test-export/select-widget-spec.d.ts +0 -1
  50. package/test-export/select-widget-spec.js +0 -68
  51. package/test-export/single-item-array-field-spec.d.ts +0 -1
  52. package/test-export/single-item-array-field-spec.js +0 -92
  53. package/test-export/syke-butterfly-spec.d.ts +0 -1
  54. package/test-export/syke-butterfly-spec.js +0 -163
  55. package/test-export/transaction-form-spec.d.ts +0 -1
  56. package/test-export/transaction-form-spec.js +0 -63
  57. package/test-export/trip-report-autosuggest-spec.d.ts +0 -1
  58. package/test-export/trip-report-autosuggest-spec.js +0 -272
  59. package/test-export/trip-report-spec.d.ts +0 -1
  60. package/test-export/trip-report-spec.js +0 -456
  61. package/test-export/unit-list-shorthand-array-field-spec.d.ts +0 -1
  62. package/test-export/unit-list-shorthand-array-field-spec.js +0 -71
  63. package/test-export/validation-spec.d.ts +0 -1
  64. package/test-export/validation-spec.js +0 -336
  65. package/test-export/water-bird-spec.d.ts +0 -1
  66. package/test-export/water-bird-spec.js +0 -30
  67. package/test-export/wbc-spec.d.ts +0 -1
  68. package/test-export/wbc-spec.js +0 -82
@@ -1,63 +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("transaction form (MHL.930)", () => {
15
- let form;
16
- let typeEnum$;
17
- const uiSchemaContext = {
18
- userName: "Test, User",
19
- userEmail: "user.test@email.com"
20
- };
21
- beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
22
- form = yield test_utils_1.createForm({ id: "MHL.930" });
23
- yield form.setState({ uiSchemaContext });
24
- typeEnum$ = form.$getEnumWidget("type");
25
- yield typeEnum$.openEnums();
26
- yield typeEnum$.$$enums.first().click();
27
- }));
28
- it("sets correct name and email when clicking a me button", () => __awaiter(void 0, void 0, void 0, function* () {
29
- yield form.$locate("localPerson").$("button").click();
30
- const $input = form.$locate("localPerson").$("input");
31
- expect(yield $input.getAttribute("value")).toBe("Test, User");
32
- const $input2 = form.$locate("localPersonEmail").$("input");
33
- expect(yield $input2.getAttribute("value")).toBe("user.test@email.com");
34
- const formData = yield form.getChangedData();
35
- expect(formData.localPerson).toBe("Test, User");
36
- expect(formData.localPersonEmail).toBe("user.test@email.com");
37
- }));
38
- describe("specimen fields", () => {
39
- it("adds the ids", () => __awaiter(void 0, void 0, void 0, function* () {
40
- const $input = form.$getInputWidget("awayIDs");
41
- yield $input.sendKeys("abc cde efg");
42
- yield $input.sendKeys(protractor_1.protractor.Key.TAB);
43
- let formData = yield form.getChangedData();
44
- expect(formData.awayIDs).toEqual(["abc", "cde", "efg"]);
45
- }));
46
- it("marks all as returned", () => __awaiter(void 0, void 0, void 0, function* () {
47
- const returnAllButton$ = protractor_1.$(".laji-form-multi-tag-array-field-buttons").all(protractor_1.by.tagName("button")).get(0);
48
- yield returnAllButton$.click();
49
- const formData = yield form.getChangedData();
50
- expect(formData.awayIDs).toEqual([]);
51
- expect(formData.returnedIDs).toEqual(["abc", "cde", "efg"]);
52
- }));
53
- it("marks selected ids as missing", () => __awaiter(void 0, void 0, void 0, function* () {
54
- const markAsMissingButton$ = protractor_1.$(".laji-form-multi-tag-array-field-buttons").all(protractor_1.by.tagName("button")).get(3);
55
- yield markAsMissingButton$.click();
56
- const tags$ = form.$locate("returnedIDs").$$(".rw-multiselect-tag");
57
- yield tags$.get(1).click();
58
- const formData = yield form.getChangedData();
59
- expect(formData.returnedIDs).toEqual(["abc", "efg"]);
60
- expect(formData.missingIDs).toEqual(["cde"]);
61
- }));
62
- });
63
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,272 +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("Trip report (JX.519) autosuggestions", () => {
15
- let form;
16
- beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
17
- form = yield test_utils_1.createForm({ id: "JX.519" });
18
- yield test_utils_1.putForeignMarkerToMap();
19
- }));
20
- describe("observers", () => {
21
- it("when two unknown and 1st is removed, the autosuggest input value updated to the value of the 1st", () => __awaiter(void 0, void 0, void 0, function* () {
22
- // TableField has problems, so ids here are erratic but correct
23
- const $deleteObserver = form.$locateButton("gatheringEvent.0", "delete");
24
- const $addObserver = form.$locateButton("gatheringEvent", "add");
25
- const observer1$ = form.$getInputWidget("gatheringEvent.0.leg");
26
- const observer2$ = form.$getInputWidget("gatheringEvent.1.leg");
27
- yield $deleteObserver.click();
28
- yield $addObserver.click();
29
- yield $addObserver.click();
30
- yield observer1$.sendKeys("matti");
31
- yield observer2$.sendKeys("teppo");
32
- yield $deleteObserver.click();
33
- expect(yield observer1$.getAttribute("value")).toBe("teppo");
34
- }));
35
- });
36
- describe("taxon census", () => {
37
- let censusAutosuggest;
38
- beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
39
- const scopeField = form.getScopeField("gatherings.0");
40
- yield protractor_1.browser.wait(protractor_1.protractor.ExpectedConditions.visibilityOf(scopeField.$button), 1000, "gatherings additionals button didn't show up");
41
- yield scopeField.$button.click();
42
- yield scopeField.$$listItems.last().click();
43
- censusAutosuggest = form.getTaxonAutosuggestWidget("gatherings.0.taxonCensus.0.censusTaxonID");
44
- }));
45
- it("selects on click", () => __awaiter(void 0, void 0, void 0, function* () {
46
- yield protractor_1.browser.wait(protractor_1.protractor.ExpectedConditions.visibilityOf(form.$locateButton("gatherings.0.taxonCensus", "add")), 1000, "taxon census didn't show up");
47
- yield form.$locateButton("gatherings.0.taxonCensus", "add").click();
48
- yield censusAutosuggest.$input.sendKeys("aves");
49
- yield censusAutosuggest.waitForSuggestionsToLoad();
50
- yield censusAutosuggest.$$suggestions.first().click();
51
- yield censusAutosuggest.waitForGlyph();
52
- expect(yield censusAutosuggest.isSuggested()).toBe(true, "wasn't displayed as suggested");
53
- expect(yield censusAutosuggest.$input.getAttribute("value")).toBe("Aves", "Input value wasn't the clicked value");
54
- }));
55
- });
56
- describe("unit taxon", () => {
57
- let taxonAutosuggest;
58
- let $addUnit;
59
- const moveMouseAway = (locator) => protractor_1.browser.actions()
60
- .mouseMove(form.$locate(locator).getWebElement(), { x: -100, y: -100 })
61
- .perform();
62
- beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
63
- taxonAutosuggest = form.getTaxonAutosuggestWidget("gatherings.0.units.0.identifications.0.taxon");
64
- $addUnit = form.$locateButton("gatherings.0.units", "add");
65
- }));
66
- beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
67
- if (yield form.$locate("gatherings.0.units.0.identifications.0.taxon").isPresent()) {
68
- yield moveMouseAway("gatherings.0.units.0.identifications.0.taxon");
69
- }
70
- }));
71
- it("clicking any match selects it", () => __awaiter(void 0, void 0, void 0, function* () {
72
- yield taxonAutosuggest.$input.sendKeys("kett");
73
- yield taxonAutosuggest.waitForSuggestionsToLoad();
74
- yield taxonAutosuggest.$$suggestions.first().click();
75
- yield taxonAutosuggest.waitForGlyph();
76
- expect(yield taxonAutosuggest.isSuggested()).toBe(true);
77
- expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kettu");
78
- yield test_utils_1.removeUnit(0, 0);
79
- yield $addUnit.click();
80
- }));
81
- it("typing exact match and pressing enter after waiting for suggestion list selects exact match", () => __awaiter(void 0, void 0, void 0, function* () {
82
- yield taxonAutosuggest.$input.sendKeys("kettu");
83
- yield taxonAutosuggest.waitForSuggestionsToLoad();
84
- yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.ENTER);
85
- yield taxonAutosuggest.waitForGlyph();
86
- expect(yield taxonAutosuggest.isSuggested()).toBe(true);
87
- expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kettu");
88
- yield test_utils_1.removeUnit(0, 0);
89
- yield $addUnit.click();
90
- }));
91
- it("typing exact match and pressing enter without waiting for suggestion list selects exact match", () => __awaiter(void 0, void 0, void 0, function* () {
92
- yield taxonAutosuggest.$input.sendKeys("kettu");
93
- yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.ENTER);
94
- yield taxonAutosuggest.waitForGlyph();
95
- expect(yield taxonAutosuggest.isSuggested()).toBe(true);
96
- expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kettu");
97
- yield test_utils_1.removeUnit(0, 0);
98
- yield $addUnit.click();
99
- }));
100
- it("typing exact match and pressing tab after waiting for suggestion list selects exact match", () => __awaiter(void 0, void 0, void 0, function* () {
101
- yield taxonAutosuggest.$input.sendKeys("kettu");
102
- yield taxonAutosuggest.waitForSuggestionsToLoad();
103
- yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.TAB);
104
- yield taxonAutosuggest.waitForGlyph();
105
- expect(yield taxonAutosuggest.isSuggested()).toBe(true);
106
- expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kettu");
107
- expect(yield test_utils_1.getFocusedElement().getAttribute("id")).not.toBe(yield taxonAutosuggest.$input.getAttribute("id"), "next elem wasn't focused");
108
- yield test_utils_1.getFocusedElement().sendKeys(protractor_1.protractor.Key.TAB); // Tab to get rid of toggler tooltip obscuring elements
109
- yield protractor_1.browser.sleep(100);
110
- yield test_utils_1.removeUnit(0, 0);
111
- yield $addUnit.click();
112
- }));
113
- it("typing exact match and pressing tab without waiting for suggestion list selects exact match", () => __awaiter(void 0, void 0, void 0, function* () {
114
- yield taxonAutosuggest.$input.sendKeys("kettu");
115
- yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.TAB);
116
- yield taxonAutosuggest.waitForGlyph();
117
- expect(yield taxonAutosuggest.isSuggested()).toBe(true);
118
- expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kettu");
119
- expect(yield test_utils_1.getFocusedElement().getAttribute("id")).not.toBe(yield taxonAutosuggest.$input.getAttribute("id"), "next elem wasn't focused");
120
- yield test_utils_1.getFocusedElement().sendKeys(protractor_1.protractor.Key.TAB); // Tab to get rid of toggler tooltip obscuring elements
121
- yield protractor_1.browser.sleep(100);
122
- yield test_utils_1.removeUnit(0, 0);
123
- yield $addUnit.click();
124
- }));
125
- it("typing non exact match and blurring after waiting for suggestion list shows warning sign", () => __awaiter(void 0, void 0, void 0, function* () {
126
- yield taxonAutosuggest.$input.sendKeys("kett");
127
- yield taxonAutosuggest.waitForSuggestionsToLoad();
128
- yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.TAB);
129
- yield taxonAutosuggest.waitForGlyph();
130
- expect(yield taxonAutosuggest.isNonsuggested()).toBe(true);
131
- expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kett");
132
- expect(yield test_utils_1.getFocusedElement().getAttribute("id")).not.toBe(yield taxonAutosuggest.$input.getAttribute("id"), "next elem wasn't focused");
133
- yield test_utils_1.getFocusedElement().sendKeys(protractor_1.protractor.Key.TAB); // Tab to get rid of toggler tooltip obscuring elements
134
- yield protractor_1.browser.sleep(100);
135
- yield test_utils_1.removeUnit(0, 0);
136
- yield $addUnit.click();
137
- }));
138
- it("typing non exact match and blurring without waiting for suggestion list shows warning sign", () => __awaiter(void 0, void 0, void 0, function* () {
139
- yield taxonAutosuggest.$input.sendKeys("kett");
140
- yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.TAB);
141
- yield taxonAutosuggest.waitForGlyph();
142
- expect(yield taxonAutosuggest.isNonsuggested()).toBe(true);
143
- expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kett");
144
- expect(yield test_utils_1.getFocusedElement().getAttribute("id")).not.toBe(yield taxonAutosuggest.$input.getAttribute("id"), "next elem wasn't focused");
145
- yield test_utils_1.getFocusedElement().sendKeys(protractor_1.protractor.Key.TAB); // Tab to get rid of toggler tooltip obscuring elements
146
- yield protractor_1.browser.sleep(100);
147
- yield test_utils_1.removeUnit(0, 0);
148
- yield $addUnit.click();
149
- }));
150
- it("typing exact match and blurring after waiting for suggestion list selects exact match", () => __awaiter(void 0, void 0, void 0, function* () {
151
- yield taxonAutosuggest.$input.sendKeys("kettu");
152
- yield taxonAutosuggest.waitForSuggestionsToLoad();
153
- yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.TAB);
154
- expect(yield taxonAutosuggest.isSuggested()).toBe(true);
155
- expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kettu");
156
- expect(yield test_utils_1.getFocusedElement().getAttribute("id")).not.toBe(yield taxonAutosuggest.$input.getAttribute("id"), "next elem wasn't focused");
157
- yield test_utils_1.getFocusedElement().sendKeys(protractor_1.protractor.Key.TAB); // Tab to get rid of toggler tooltip obscuring elements
158
- yield protractor_1.browser.sleep(100);
159
- yield test_utils_1.removeUnit(0, 0);
160
- yield $addUnit.click();
161
- }));
162
- it("typing exact match and blurring before waiting for suggestion list selects exact match", () => __awaiter(void 0, void 0, void 0, function* () {
163
- yield taxonAutosuggest.$input.sendKeys("kettu");
164
- yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.TAB);
165
- yield taxonAutosuggest.waitForGlyph();
166
- expect(yield taxonAutosuggest.isSuggested()).toBe(true);
167
- expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kettu");
168
- expect(yield test_utils_1.getFocusedElement().getAttribute("id")).not.toBe(yield taxonAutosuggest.$input.getAttribute("id"), "next elem wasn't focused");
169
- yield test_utils_1.getFocusedElement().sendKeys(protractor_1.protractor.Key.TAB); // Tab to get rid of toggler tooltip obscuring elements
170
- yield protractor_1.browser.sleep(100);
171
- yield test_utils_1.removeUnit(0, 0);
172
- yield $addUnit.click();
173
- }));
174
- it("typing exact match with sp suffix keeps sp suffix in value but select the exact match", () => __awaiter(void 0, void 0, void 0, function* () {
175
- for (const suffix of ["sp", "spp", "sp.", "spp."]) {
176
- yield taxonAutosuggest.$input.sendKeys(`parus ${suffix}`);
177
- yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.TAB);
178
- yield taxonAutosuggest.waitForGlyph();
179
- expect(yield taxonAutosuggest.isSuggested()).toBe(true);
180
- expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe(`parus ${suffix}`);
181
- expect(yield test_utils_1.getFocusedElement().getAttribute("id")).not.toBe(yield taxonAutosuggest.$input.getAttribute("id"), "next elem wasn't focused");
182
- yield test_utils_1.getFocusedElement().sendKeys(protractor_1.protractor.Key.TAB); // Tab to get rid of toggler tooltip obscuring elements
183
- yield protractor_1.browser.sleep(100);
184
- yield test_utils_1.removeUnit(0, 0);
185
- yield $addUnit.click();
186
- }
187
- }));
188
- describe("power user", () => {
189
- it("is shown power taxon field", () => __awaiter(void 0, void 0, void 0, function* () {
190
- expect(yield taxonAutosuggest.$powerUserButton.isDisplayed()).toBe(true);
191
- }));
192
- it("click toggles power user mode on/off", () => __awaiter(void 0, void 0, void 0, function* () {
193
- yield taxonAutosuggest.$powerUserButton.click();
194
- expect(yield taxonAutosuggest.powerUserButtonIsActive()).toBe(true);
195
- yield taxonAutosuggest.$powerUserButton.click();
196
- expect(yield taxonAutosuggest.powerUserButtonIsActive()).toBe(false);
197
- }));
198
- it("clicking any match after waiting for suggestion list works", () => __awaiter(void 0, void 0, void 0, function* () {
199
- yield taxonAutosuggest.$powerUserButton.click();
200
- yield taxonAutosuggest.$input.sendKeys("kettu");
201
- yield taxonAutosuggest.waitForSuggestionsToLoad();
202
- yield taxonAutosuggest.$$suggestions.last().click();
203
- yield protractor_1.browser.wait(protractor_1.protractor.ExpectedConditions.visibilityOf(form.$locate("gatherings.0.units.1")), 5000, "auto added unit didn't appear");
204
- expect(yield form.$locate("gatherings.0.units.0").getTagName()).toBe("tr", "entered unit wasn't deactivated");
205
- const enteredUnitTaxon = yield form.$locate("gatherings.0.units.0").$$("td").first().getText();
206
- expect(enteredUnitTaxon).toBe("ravunsyöjäkettu");
207
- }));
208
- it("entering second unit auto adds", () => __awaiter(void 0, void 0, void 0, function* () {
209
- const _taxonAutosuggest = form.getTaxonAutosuggestWidget("gatherings.0.units.1.identifications.0.taxon");
210
- yield _taxonAutosuggest.$input.sendKeys("kettu");
211
- yield _taxonAutosuggest.waitForSuggestionsToLoad();
212
- yield _taxonAutosuggest.$$suggestions.last().click();
213
- yield protractor_1.browser.wait(protractor_1.protractor.ExpectedConditions.visibilityOf(form.$locate("gatherings.0.units.2")), 5000, "auto added unit didn't appear");
214
- expect(yield form.$locate("gatherings.0.units.1").getTagName()).toBe("tr", "entered unit wasn't deactivated");
215
- const enteredUnitTaxon = yield form.$locate("gatherings.0.units.1").$$("td").first().getText();
216
- expect(enteredUnitTaxon).toBe("ravunsyöjäkettu");
217
- yield test_utils_1.removeUnit(0, 0);
218
- yield test_utils_1.removeUnit(0, 0);
219
- yield test_utils_1.removeUnit(0, 0);
220
- yield $addUnit.click();
221
- yield taxonAutosuggest.$powerUserButton.click();
222
- }));
223
- it("entering exact match adds new unit automatically", () => __awaiter(void 0, void 0, void 0, function* () {
224
- yield taxonAutosuggest.$powerUserButton.click();
225
- yield taxonAutosuggest.$input.sendKeys("susi");
226
- yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.ENTER);
227
- yield protractor_1.browser.wait(protractor_1.protractor.ExpectedConditions.visibilityOf(form.$locate("gatherings.0.units.1")), 5000, "New unit didn't show up");
228
- expect(yield form.$locate("gatherings.0.units.0").getTagName()).toBe("tr");
229
- expect(yield form.$locate("gatherings.0.units.1").getTagName()).toBe("div");
230
- yield test_utils_1.removeUnit(0, 1);
231
- yield taxonAutosuggest.$powerUserButton.click();
232
- expect(yield taxonAutosuggest.powerUserButtonIsActive()).toBe(false);
233
- yield test_utils_1.removeUnit(0, 0);
234
- yield $addUnit.click();
235
- }));
236
- });
237
- it("works when autocomplete response has autocompleteSelectedName", () => __awaiter(void 0, void 0, void 0, function* () {
238
- const mock = yield form.setMockResponse("/autocomplete/taxon");
239
- yield taxonAutosuggest.$input.sendKeys("kuusi");
240
- const autocompleteSelectedName = "foobar";
241
- yield mock.resolve([{
242
- "key": "MX.37812",
243
- "value": "kuusi",
244
- autocompleteSelectedName,
245
- "payload": {
246
- "matchingName": "kuusi",
247
- "informalTaxonGroups": [
248
- {
249
- "id": "MVL.343",
250
- "name": "Putkilokasvit"
251
- }
252
- ],
253
- "scientificName": "Picea abies",
254
- "scientificNameAuthorship": "(L.) H. Karst.",
255
- "taxonRankId": "MX.species",
256
- "matchType": "exactMatches",
257
- "cursiveName": true,
258
- "finnish": true,
259
- "species": true,
260
- "nameType": "MX.obsoleteVernacularName",
261
- "vernacularName": "metsäkuusi"
262
- }
263
- }]);
264
- // idk why needed...
265
- yield protractor_1.browser.sleep(100);
266
- yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.ENTER);
267
- yield mock.remove();
268
- expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe(autocompleteSelectedName);
269
- expect((yield form.getChangedData()).gatherings[0].units[0].identifications[0].taxon).toBe(autocompleteSelectedName);
270
- }));
271
- });
272
- });
@@ -1 +0,0 @@
1
- export {};