diff options
Diffstat (limited to 'addons/web/static/tests/helpers/test_utils_modal.js')
| -rw-r--r-- | addons/web/static/tests/helpers/test_utils_modal.js | 48 |
1 files changed, 19 insertions, 29 deletions
diff --git a/addons/web/static/tests/helpers/test_utils_modal.js b/addons/web/static/tests/helpers/test_utils_modal.js index 5587eecfc01..ca3eeef11a7 100644 --- a/addons/web/static/tests/helpers/test_utils_modal.js +++ b/addons/web/static/tests/helpers/test_utils_modal.js @@ -1,36 +1,26 @@ odoo.define('web.test_utils_modal', function (require) { -"use strict"; + "use strict"; -/** - * Modal Test Utils - * - * This module defines various utility functions to help test pivot views. - * - * Note that all methods defined in this module are exported in the main - * testUtils file. - */ + /** + * Modal Test Utils + * + * This module defines various utility functions to help test pivot views. + * + * Note that all methods defined in this module are exported in the main + * testUtils file. + */ -var core = require('web.core'); -var concurrency = require('web.concurrency'); + const { _t } = require('web.core'); + const testUtilsDom = require('web.test_utils_dom'); -/** - * Click on a button in the footer of a modal (which contains a given string). - * Note that this method checks the unicity of the button. - * - * @param {string} text (in english: this method will perform the translation) - */ -function clickButton(text) { - var selector = `.modal-footer button:contains(${core._t(text)})`; - var $button = $(selector); - if ($button.length !== 1) { - throw new Error(`Found ${$button.length} button(s) containing '${text}'`); + /** + * Click on a button in the footer of a modal (which contains a given string). + * + * @param {string} text (in english: this method will perform the translation) + */ + function clickButton(text) { + return testUtilsDom.click($(`.modal-footer button:contains(${_t(text)})`)); } - $button.click(); - return concurrency.delay(0); -} - -return { - clickButton: clickButton, -}; + return { clickButton }; }); |
