summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/helpers/test_utils_fields.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-02-28 13:47:09 +0100
committerChristophe Simonis <chs@odoo.com>2019-02-28 13:47:09 +0100
commit06898fac3c9b21d4fd5ef7efd35f829cdff15e46 (patch)
tree6b6d657677778365b06bbf4fb7babcab688edcc2 /addons/web/static/tests/helpers/test_utils_fields.js
parent012816f85f8f20243bd3dfb55abdfaac59722284 (diff)
parentf9d3b5b7dfe15fb53f14fa0a0ae91bbeded9939b (diff)
[MERGE] forward port branch saas-12.1 up to f9d3b5b7dfe
Diffstat (limited to 'addons/web/static/tests/helpers/test_utils_fields.js')
-rw-r--r--addons/web/static/tests/helpers/test_utils_fields.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/addons/web/static/tests/helpers/test_utils_fields.js b/addons/web/static/tests/helpers/test_utils_fields.js
index f7d8829ce82..f0f29839a9d 100644
--- a/addons/web/static/tests/helpers/test_utils_fields.js
+++ b/addons/web/static/tests/helpers/test_utils_fields.js
@@ -125,15 +125,16 @@ function clickM2OItem(fieldName, searchText) {
* - click to open the dropdown
* - enter a search string in the input
* - wait for the selection
- * - click on the active menuitem
+ * - click on the requested menuitem, or the active one by default
*
* Example:
- * testUtils.fields.many2one.searchAndClickM2OItem('partner_id', 'George');
+ * testUtils.fields.many2one.searchAndClickM2OItem('partner_id', {search: 'George'});
*
* @param {string} fieldName
* @param {[Object]} options
* @param {[string]} options.selector
* @param {[string]} options.search
+ * @param {[string]} options.item
* @returns {Promise}
*/
function searchAndClickM2OItem(fieldName, options) {
@@ -156,7 +157,11 @@ function searchAndClickM2OItem(fieldName, options) {
}
return $.when(def).then(function () {
- clickM2OHighlightedItem(fieldName, options.selector);
+ if (options.item) {
+ clickM2OItem(fieldName, options.item);
+ } else {
+ clickM2OHighlightedItem(fieldName, options.selector);
+ }
});
}
return {