diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-05-29 17:34:43 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-05-29 17:34:43 +0200 |
| commit | f36e6917bd73a56dc0c7468b4849920df4088154 (patch) | |
| tree | b63d02ae3e5ffc0815de009407363e0cf906f547 /addons/web/static/tests/helpers/test_utils.js | |
| parent | bc0173c2d58ac26d80cb2f483a95c0c13b047dab (diff) | |
| parent | 37eed7c509fb5846c89ef37046df4b3cab299719 (diff) | |
[MERGE] forward port branch saas-11.3 up to 37eed7c509f
Diffstat (limited to 'addons/web/static/tests/helpers/test_utils.js')
| -rw-r--r-- | addons/web/static/tests/helpers/test_utils.js | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/addons/web/static/tests/helpers/test_utils.js b/addons/web/static/tests/helpers/test_utils.js index 2da3eb5ddd9..6c05076ef98 100644 --- a/addons/web/static/tests/helpers/test_utils.js +++ b/addons/web/static/tests/helpers/test_utils.js @@ -733,53 +733,6 @@ function patch (target, props) { }); } } -/** - * In Phantomjs, there is a crash when calling window.getSelection - * in order for the tests to work, for the specific test that uses it, replace - * the default window.getSelection by a mock - * - * usage: - * QUnit.test('...',function(done){ - * var unpatchWindowGetSelection = testUtils.patchWindowGetSelection(); - * - * // do something that needs to use window.getSelection() - * assert.strictEqual(....); - * - * // restore the original function - * unpatchWindowGetSelection(); - * - * // finish the test - * done(); - * }) - * - * @returns {function} the unpatch function - */ -function patchWindowGetSelection() { - var originalWindowGetSelection = window.getSelection; - window.getSelection = function () { - return { - removeAllRanges: function () {}, - addRange: function (range) {}, - getRangeAt: function (index) { - return { - startOffset : 0 - }; - }, - anchorNode: { - parentNode: { - childNodes: [{ - outerHTML: "@", - nodeType: 3, - textContent: '@', - }], - }, - }, - }; - }; - return function () { - window.getSelection = originalWindowGetSelection; - }; -} /** * Unpatches a given Class or Object. @@ -831,7 +784,6 @@ return $.when( intercept: intercept, observe: observe, patch: patch, - patchWindowGetSelection: patchWindowGetSelection, removeSrcAttribute: removeSrcAttribute, triggerKeypressEvent: triggerKeypressEvent, triggerMouseEvent: triggerMouseEvent, |
