From 6a5f18f9709674ffa1a8557afe16448f38c29487 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Thu, 20 Apr 2017 11:08:50 +0200 Subject: [FIX] web: AceEditor tests: don't try to remove libs ... to clean up once the test is finished, because it doesn't work. The previous solution to clean up only deleted ace and require from window, but doing this didn't force a reload of the libs for a potential second test using ace (because the scripts were still in the page). Trying to remove the scripts from the page doesn't work either because the loadJS function uses an internal cache to prevent from loading twice the same lib. So if we want to have more than one test on ace, we can't clean up the libs. --- addons/web/static/src/js/fields/basic_fields.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'addons/web/static/src/js/fields/basic_fields.js') diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index 85cd0382ac2..654d48db560 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -1987,15 +1987,16 @@ var AceEditor = DebouncedField.extend({ * @returns {Deferred} */ willStart: function () { - if (!window.ace && !this.loadJS_def) { - this.loadJS_def = ajax.loadJS('/web/static/lib/ace/ace.odoo-custom.js').then(function () { + var loadJSDef; + if (!window.ace) { + loadJSDef = ajax.loadJS('/web/static/lib/ace/ace.odoo-custom.js').then(function () { return $.when( ajax.loadJS('/web/static/lib/ace/mode-python.js'), ajax.loadJS('/web/static/lib/ace/mode-xml.js') ); }); } - return $.when(this._super.apply(this, arguments), this.loadJS_def); + return $.when(this._super.apply(this, arguments), loadJSDef); }, /** * @override start from AbstractField (Widget) -- cgit v1.2.3