Skip to content

Commit 8a21532

Browse files
authored
Form Smart Paste: fix AIIntegration tests (DevExpress#30980)
1 parent 536c8df commit 8a21532

File tree

1 file changed

+52
-14
lines changed

1 file changed

+52
-14
lines changed

packages/devextreme/testing/tests/DevExpress.ui.widgets.form/form.aiIntegration.tests.js

Lines changed: 52 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -982,14 +982,19 @@ QUnit.module('SmartPaste', () => {
982982
{ dataField, editorType: 'dxCheckBox' },
983983
]
984984
});
985+
const done = assert.async();
985986

986987
try {
987988
await form.smartPaste('test');
988989
completionCallback();
989990

990-
assert.strictEqual(form.getEditor(dataField).option('value'), value, `${value} value was set`);
991+
setTimeout(() => {
992+
assert.strictEqual(form.getEditor(dataField).option('value'), value, `${value} value was set`);
993+
done();
994+
}, 10);
991995
} catch(error) {
992996
assert.ok(false, `failed with error: ${error}`);
997+
done();
993998
}
994999
});
9951000
});
@@ -1018,15 +1023,20 @@ QUnit.module('SmartPaste', () => {
10181023
{ dataField, editorType: 'dxCheckBox', allowIndeterminateState: undefined },
10191024
]
10201025
});
1026+
const done = assert.async();
10211027

10221028
try {
10231029
await form.smartPaste('test');
10241030
completionCallback();
10251031

1026-
assert.strictEqual(form.getEditor(dataField).option('value'), undefined, 'new value was not set');
1027-
assert.ok(true, 'gracefully continued');
1032+
setTimeout(() => {
1033+
assert.strictEqual(form.getEditor(dataField).option('value'), undefined, 'new value was not set');
1034+
assert.ok(true, 'gracefully continued');
1035+
done();
1036+
}, 10);
10281037
} catch(error) {
10291038
assert.ok(false, `failed with error: ${error}`);
1039+
done();
10301040
};
10311041
});
10321042
});
@@ -1050,14 +1060,19 @@ QUnit.module('SmartPaste', () => {
10501060
{ dataField, editorType: 'dxSwitch' },
10511061
]
10521062
});
1063+
const done = assert.async();
10531064

10541065
try {
10551066
await form.smartPaste('test');
10561067
completionCallback();
10571068

1058-
assert.strictEqual(form.getEditor(dataField).option('value'), value, `${value} value was set`);
1069+
setTimeout(() => {
1070+
assert.strictEqual(form.getEditor(dataField).option('value'), value, `${value} value was set`);
1071+
done();
1072+
}, 10);
10591073
} catch(error) {
10601074
assert.ok(false, `failed with error: ${error}`);
1075+
done();
10611076
}
10621077
});
10631078
});
@@ -1087,15 +1102,20 @@ QUnit.module('SmartPaste', () => {
10871102
]
10881103
});
10891104
const defaultValue = form.getEditor(dataField).option('value');
1105+
const done = assert.async();
10901106

10911107
try {
10921108
await form.smartPaste('test');
10931109
completionCallback();
10941110

1095-
assert.strictEqual(form.getEditor(dataField).option('value'), defaultValue, 'new value was not set');
1096-
assert.ok(true, 'gracefully continued');
1111+
setTimeout(() => {
1112+
assert.strictEqual(form.getEditor(dataField).option('value'), defaultValue, 'new value was not set');
1113+
assert.ok(true, 'gracefully continued');
1114+
done();
1115+
}, 10);
10971116
} catch(error) {
10981117
assert.ok(false, `failed with error: ${error}`);
1118+
done();
10991119
};
11001120
});
11011121
});
@@ -1119,16 +1139,19 @@ QUnit.module('SmartPaste', () => {
11191139
{ dataField, editorType: 'dxHtmlEditor' },
11201140
]
11211141
});
1142+
const done = assert.async();
11221143

11231144
try {
11241145
await form.smartPaste('test');
11251146
completionCallback();
11261147

1127-
assert.strictEqual(form.getEditor(dataField).option('value'), `<p>${value}</p>`, 'text value was set');
1148+
setTimeout(() => {
1149+
assert.strictEqual(form.getEditor(dataField).option('value'), `<p>${value}</p>`, 'text value was set');
1150+
done();
1151+
}, 10);
11281152
} catch(error) {
11291153
assert.ok(false, `failed with error: ${error}`);
1130-
} finally {
1131-
form.dispose();
1154+
done();
11321155
}
11331156
});
11341157

@@ -1157,15 +1180,20 @@ QUnit.module('SmartPaste', () => {
11571180
]
11581181
});
11591182
const defaultValue = form.getEditor(dataField).option('value');
1183+
const done = assert.async();
11601184

11611185
try {
11621186
await form.smartPaste('test');
11631187
completionCallback();
11641188

1165-
assert.strictEqual(form.getEditor(dataField).option('value'), defaultValue, 'new value was not set');
1166-
assert.ok(true, 'gracefully continued');
1189+
setTimeout(() => {
1190+
assert.strictEqual(form.getEditor(dataField).option('value'), defaultValue, 'new value was not set');
1191+
assert.ok(true, 'gracefully continued');
1192+
done();
1193+
}, 10);
11671194
} catch(error) {
11681195
assert.ok(false, `failed with error: ${error}`);
1196+
done();
11691197
}
11701198
});
11711199
});
@@ -1189,14 +1217,19 @@ QUnit.module('SmartPaste', () => {
11891217
{ dataField, editorType: 'dxDateRangeBox' },
11901218
]
11911219
});
1220+
const done = assert.async();
11921221

11931222
try {
11941223
await form.smartPaste('test');
11951224
completionCallback();
11961225

1197-
assert.strictEqual(form.getEditor(dataField).option('value'), value, 'text value was set');
1226+
setTimeout(() => {
1227+
assert.strictEqual(form.getEditor(dataField).option('value'), value, 'text value was set');
1228+
done();
1229+
}, 10);
11981230
} catch(error) {
11991231
assert.ok(false, `failed with error: ${error}`);
1232+
done();
12001233
}
12011234
});
12021235

@@ -1225,15 +1258,20 @@ QUnit.module('SmartPaste', () => {
12251258
]
12261259
});
12271260
const defaultValue = form.getEditor(dataField).option('value');
1261+
const done = assert.async();
12281262

12291263
try {
12301264
await form.smartPaste('test');
12311265
completionCallback();
12321266

1233-
assert.strictEqual(form.getEditor(dataField).option('value'), defaultValue, 'new value was not set');
1234-
assert.ok(true, 'gracefully continued');
1267+
setTimeout(() => {
1268+
assert.strictEqual(form.getEditor(dataField).option('value'), defaultValue, 'new value was not set');
1269+
assert.ok(true, 'gracefully continued');
1270+
done();
1271+
}, 10);
12351272
} catch(error) {
12361273
assert.ok(false, `failed with error: ${error}`);
1274+
done();
12371275
}
12381276
});
12391277
});

0 commit comments

Comments
 (0)