odoo.define('web.view_dialogs_tests', function (require) { "use strict"; var testUtils = require('web.test_utils'); var dialogs = require('web.view_dialogs'); var Widget = require('web.Widget'); QUnit.module('Views', { beforeEach: function () { this.data = { partner: { fields: { display_name: { string: "Displayed name", type: "char" }, foo: {string: "Foo", type: 'char'}, bar: {string: "Bar", type: "boolean"}, }, records: [ {id: 1, foo: 'blip', display_name: 'blipblip', bar: true}, {id: 2, foo: 'ta tata ta ta', display_name: 'macgyver', bar: false}, {id: 3, foo: 'piou piou', display_name: "Jack O'Neill", bar: true}, ], }, }; }, }, function () { QUnit.module('view_dialogs'); function createParent(params) { var widget = new Widget(); testUtils.addMockEnvironment(widget, params); return widget; } QUnit.test('formviewdialog buttons in footer are positioned properly', function (assert) { assert.expect(2); var parent = createParent({ data: this.data, archs: { 'partner,false,form': '
', }, }); testUtils.intercept(parent, 'env_updated', function () { throw new Error("The environment should not be propagated to the view manager"); }); var dialog = new dialogs.FormViewDialog(parent, { res_model: 'partner', res_id: 1, }).open(); assert.notOk($('div.modal .modal-body button').length, "should not have any button in body"); assert.strictEqual($('div.modal .modal-footer button').length, 1, "should have only one button in footer"); dialog.destroy(); }); QUnit.test('SelectCreateDialog use domain, group_by and search default', function (assert) { assert.expect(3); var search = 0; var parent = createParent({ data: this.data, archs: { 'partner,false,list': '