From 3751379f1e9a4c215fb6eb898b4ccc67659b9ace Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 May 2022 21:51:50 +0700 Subject: initial commit 2 --- .../static/tests/fields/upgrade_fields_tests.js | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 addons/web/static/tests/fields/upgrade_fields_tests.js (limited to 'addons/web/static/tests/fields/upgrade_fields_tests.js') diff --git a/addons/web/static/tests/fields/upgrade_fields_tests.js b/addons/web/static/tests/fields/upgrade_fields_tests.js new file mode 100644 index 00000000..d908fd48 --- /dev/null +++ b/addons/web/static/tests/fields/upgrade_fields_tests.js @@ -0,0 +1,66 @@ +odoo.define('web.upgrade_fields_tests', function (require) { +"use strict"; + +var FormView = require('web.FormView'); +var testUtils = require('web.test_utils'); + +var createView = testUtils.createView; + +QUnit.module('fields', {}, function () { + +QUnit.module('upgrade_fields', { + beforeEach: function () { + this.data = { + partner: { + fields: { + bar: {string: "Bar", type: "boolean"}, + }, + } + }; + }, +}, function () { + + QUnit.module('UpgradeBoolean'); + + QUnit.test('widget upgrade_boolean in a form view', async function (assert) { + assert.expect(1); + + var form = await createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: '
', + }); + + await testUtils.dom.click(form.$('input:checkbox')); + assert.strictEqual($('.modal').length, 1, + "the 'Upgrade to Enterprise' dialog should be opened"); + + form.destroy(); + }); + + QUnit.test('widget upgrade_boolean in a form view', async function (assert) { + assert.expect(3); + + var form = await createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: '
' + + '
' + + '
' + + '
', + }); + + assert.containsNone(form, '.o_field .badge', + "the upgrade badge shouldn't be inside the field section"); + assert.containsOnce(form, '.o_label .badge', + "the upgrade badge should be inside the label section"); + assert.strictEqual(form.$('.o_label').text(), "Bar EnterpriseCoucou", + "the upgrade label should be inside the label section"); + form.destroy(); + }); + +}); +}); +}); -- cgit v1.2.3