summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/helpers/test_utils_modal.js
blob: ca3eeef11a745cc6833c395fcef201282f59135a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
odoo.define('web.test_utils_modal', function (require) {
    "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.
     */

    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).
     *
     * @param {string} text (in english: this method will perform the translation)
     */
    function clickButton(text) {
        return testUtilsDom.click($(`.modal-footer button:contains(${_t(text)})`));
    }

    return { clickButton };
});