diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-08-31 12:55:41 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-08-31 12:55:41 +0200 |
| commit | 4879ce040797fd4a47b6b8326c3aacd365c8ab91 (patch) | |
| tree | 45479b47c5dcfba0d0ced4f05d770b0852f31263 /addons/web/static/tests/fields/basic_fields_tests.js | |
| parent | dae6178a0a5629ce678b20fcc9226caa44a5b0ce (diff) | |
| parent | fe77df3ba480d40b3d6b25736397bd52c684ce03 (diff) | |
[MERGE] forward port branch saas-17 up to fe77df3ba48
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
| -rw-r--r-- | addons/web/static/tests/fields/basic_fields_tests.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index b533f5056d2..6347ed63432 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -1259,6 +1259,8 @@ QUnit.module('basic_fields', { // Copying from a div tag with white-space:pre-wrap doesn't work in Firefox assert.strictEqual(form.$('[name="txt"]').prop("tagName").toLowerCase(), 'span', "the field contents should be surrounded by a span tag"); + + form.destroy(); }); QUnit.module('FieldBinary'); @@ -1594,6 +1596,24 @@ QUnit.module('basic_fields', { form.destroy(); }); + QUnit.test('handle widget with falsy values', function (assert) { + assert.expect(1); + + var list = createView({ + View: ListView, + model: 'partner', + data: this.data, + arch: '<tree>' + + '<field name="sequence" widget="handle"/>' + + '<field name="display_name"/>' + + '</tree>', + }); + + assert.strictEqual(list.$('.o_row_handle:visible').length, this.data.partner.records.length, + 'there should be a visible handle for each record'); + list.destroy(); + }); + QUnit.module('FieldDate'); @@ -3878,6 +3898,44 @@ QUnit.module('basic_fields', { "field selector popover should contain 'Color index' field"); form.destroy(); }); + + QUnit.test('domain field: handle false domain as []', function (assert) { + assert.expect(2); + + this.data.partner.records[0].foo = false; + this.data.partner.fields.bar.type = "char"; + this.data.partner.records[0].bar = "product"; + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: + '<form>' + + '<sheet>' + + '<group>' + + '<field name="bar"/>' + + '<field name="foo" widget="domain" options="{\'model\': \'bar\'}"/>' + + '</group>' + + '</sheet>' + + '</form>', + mockRPC: function (route, args) { + if (args.method === 'search_count') { + assert.deepEqual(args.args[0], [], "should send a valid domain"); + } + return this._super.apply(this, arguments); + }, + res_id: 1, + viewOptions: { + mode: 'edit', + }, + }); + + var $warning = form.$('.o_field_widget[name=foo] .text-warning'); + assert.strictEqual($warning.length, 0, "should not display that the domain is invalid"); + + form.destroy(); + }); }); }); }); |
