@onehat/ui 0.3.307 → 0.3.309
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/package.json
CHANGED
|
@@ -111,6 +111,15 @@ export default function withSecondaryEditor(WrappedComponent, isTree = false) {
|
|
|
111
111
|
secondaryDoAdd = async (e, values) => {
|
|
112
112
|
let addValues = values;
|
|
113
113
|
|
|
114
|
+
if (SecondaryRepository?.isLoading) {
|
|
115
|
+
// NOTE: This is a hack to prevent adding a new record while the repository is still loading.
|
|
116
|
+
// This can happen when the repository is still loading, and the user clicks the 'Add' button.
|
|
117
|
+
setTimeout(() => {
|
|
118
|
+
doAdd(e, values);
|
|
119
|
+
}, 500);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
114
123
|
if (!values) {
|
|
115
124
|
// you can either:
|
|
116
125
|
// 1. directlty submit 'values' to use in secondaryDoAdd(), or
|
|
@@ -110,6 +110,15 @@ export default function withEditor(WrappedComponent, isTree = false) {
|
|
|
110
110
|
doAdd = async (e, values) => {
|
|
111
111
|
let addValues = values;
|
|
112
112
|
|
|
113
|
+
if (Repository?.isLoading) {
|
|
114
|
+
// NOTE: This is a hack to prevent adding a new record while the repository is still loading.
|
|
115
|
+
// This can happen when the repository is still loading, and the user clicks the 'Add' button.
|
|
116
|
+
setTimeout(() => {
|
|
117
|
+
doAdd(e, values);
|
|
118
|
+
}, 500);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
113
122
|
if (!values) {
|
|
114
123
|
// you can either:
|
|
115
124
|
// 1. directlty submit 'values' to use in doAdd(), or
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* e.g. ['parent', 'child'] will be converted to '[data-testid="parent"] [data-testid="child"]'
|
|
8
8
|
* @return Cypress chainer
|
|
9
9
|
*/
|
|
10
|
-
export function getDomNode(selectors) {
|
|
11
|
-
return cy.get(getTestIdSelectors(selectors, true));
|
|
10
|
+
export function getDomNode(selectors, options = {}) {
|
|
11
|
+
return cy.get(getTestIdSelectors(selectors, true), options);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -18,8 +18,8 @@ export function getDomNode(selectors) {
|
|
|
18
18
|
* e.g. ['parent', 'child'] will be converted to '[data-testid="parent"] [data-testid="child"]'
|
|
19
19
|
* @return Cypress chainer
|
|
20
20
|
*/
|
|
21
|
-
export function getDomNodes(selectors) {
|
|
22
|
-
return cy.get(getTestIdSelectors(selectors));
|
|
21
|
+
export function getDomNodes(selectors, options = {}) {
|
|
22
|
+
return cy.get(getTestIdSelectors(selectors), options);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -128,10 +128,13 @@ export function setComboValue(selectors, value) {
|
|
|
128
128
|
getDomNode([...selectors, 'input']).then((field) => {
|
|
129
129
|
cy.get(field).clear({ force: true });
|
|
130
130
|
if (value) {
|
|
131
|
+
cy.intercept('GET', '**/get**').as('getWaiter'); // set up waiter
|
|
131
132
|
cy.get(field)
|
|
132
133
|
.type(value, { delay: 40, force: true }) // slow it down a bit, so React has time to re-render
|
|
133
|
-
.wait(
|
|
134
|
-
|
|
134
|
+
.wait('@getWaiter'); // allow dropdown to load
|
|
135
|
+
|
|
136
|
+
cy.get(field)
|
|
137
|
+
.wait(1000) // render
|
|
135
138
|
.type('{downarrow}')
|
|
136
139
|
.wait(250) // allow time for selection
|
|
137
140
|
|
|
@@ -166,12 +169,15 @@ export function setTagValue(selectors, value) {
|
|
|
166
169
|
if (!_.isEmpty(values)) {
|
|
167
170
|
_.each(values, (value) => {
|
|
168
171
|
const id = value.id;
|
|
172
|
+
cy.intercept('GET', '**/get**').as('getWaiter'); // set up waiter
|
|
169
173
|
cy.get(field)
|
|
170
174
|
.type('id:' + id, { delay: 40, force: true }) // slow it down a bit, so React has time to re-render
|
|
171
|
-
.wait(
|
|
172
|
-
|
|
175
|
+
.wait('@getWaiter'); // allow dropdown to load
|
|
176
|
+
|
|
177
|
+
cy.get(field)
|
|
178
|
+
.wait(1000) // render
|
|
173
179
|
.type('{downarrow}')
|
|
174
|
-
.wait(
|
|
180
|
+
.wait(500); // allow time for selection
|
|
175
181
|
});
|
|
176
182
|
|
|
177
183
|
// press trigger to hide dropdown
|