diff options
| author | Aaron Bohy <aab@odoo.com> | 2017-04-20 11:08:50 +0200 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-04-20 13:12:50 +0200 |
| commit | 6a5f18f9709674ffa1a8557afe16448f38c29487 (patch) | |
| tree | 288607f0b3c2276fb031d7d78ac092d01dd7ed18 /addons/web/static/src/js/fields/basic_fields.js | |
| parent | ef3200f9409aab0a247e234154f18e77087ece05 (diff) | |
[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.
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
| -rw-r--r-- | addons/web/static/src/js/fields/basic_fields.js | 7 |
1 files changed, 4 insertions, 3 deletions
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) |
