summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/tests/web_editor_tests.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-03-09 09:34:09 +0100
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commit2d2e9c93c393c06c4d099023a857823cffb96935 (patch)
treef77dc7b839aeca2092d52c1e2a76e53a364f3832 /addons/web_editor/static/tests/web_editor_tests.js
parent7c04deef5e66134276a17e78b4bb74e23e200b97 (diff)
[FIX] web_editor: various fixes and new tests
- use 'nodeOptions' instead of 'options' in FieldTextHTML as 'options' doesn't exist, it has been renamed into nodeOptions in AbstractField. - mock iframe route in test to prevent the test framework from displaying an error (unimplemented route), and so the test from being red. - test that the url given in the node options is correctly used. - remove useless and broken code introduced by last rebase.
Diffstat (limited to 'addons/web_editor/static/tests/web_editor_tests.js')
-rw-r--r--addons/web_editor/static/tests/web_editor_tests.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/addons/web_editor/static/tests/web_editor_tests.js b/addons/web_editor/static/tests/web_editor_tests.js
index fae5fb41fa7..8d80ad2a73a 100644
--- a/addons/web_editor/static/tests/web_editor_tests.js
+++ b/addons/web_editor/static/tests/web_editor_tests.js
@@ -23,19 +23,29 @@ QUnit.module('web_editor', {
}
});
-QUnit.test('field html widget', function(assert) {
- assert.expect(2);
+QUnit.test('field html widget', function (assert) {
+ assert.expect(6);
var form = testUtils.createView({
View: FormView,
model: 'mass.mailing',
data: this.data,
arch: '<form string="Partners">' +
- '<field name="body" widget="html_frame"/>' +
+ '<field name="body" widget="html_frame" options="{\'editor_url\': \'/test\'}"/>' +
'</form>',
res_id: 1,
session: {user_context: {lang: "en_us"}},
- manualDestroy: true,
+ mockRPC: function (route) {
+ if (_.str.startsWith(route, '/test')) {
+ // those tests will be executed twice, once in readonly and once in edit
+ assert.ok(route.search('model=mass.mailing') > 0,
+ "the route should specify the correct model");
+ assert.ok(route.search('res_id=1') > 0,
+ "the route should specify the correct id");
+ return $.when();
+ }
+ return this._super.apply(this, arguments);
+ },
});
assert.strictEqual(form.$('iframe').length, 1, "should have rendered an iframe without crashing");