From 875ea7964c62552ba976f09ad6c94db6fffb5b66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Fri, 7 Apr 2017 11:12:58 +0200 Subject: [REF] account, web, web_diagram: rename static test folder For consistency, every static test folder should be named 'tests', with a s. --- addons/web/static/tests/core/domain_tests.js | 62 ++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 addons/web/static/tests/core/domain_tests.js (limited to 'addons/web/static/tests/core/domain_tests.js') diff --git a/addons/web/static/tests/core/domain_tests.js b/addons/web/static/tests/core/domain_tests.js new file mode 100644 index 00000000000..001eae2d6b9 --- /dev/null +++ b/addons/web/static/tests/core/domain_tests.js @@ -0,0 +1,62 @@ +odoo.define('web.domain_tests', function (require) { +"use strict"; + +var Domain = require('web.Domain'); + +QUnit.module('core', {}, function () { + + QUnit.module('domain'); + + QUnit.test("basic", function (assert) { + assert.expect(3); + + var fields = { + a: 3, + group_method: 'line', + select1: 'day', + rrule_type: 'monthly', + }; + assert.ok(new Domain([['a', '=', 3]]).compute(fields)); + assert.ok(new Domain([['group_method','!=','count']]).compute(fields)); + assert.ok(new Domain([['select1','=','day'], ['rrule_type','=','monthly']]).compute(fields)); + }); + + QUnit.test("or", function (assert) { + assert.expect(3); + + var web = { + section_id: null, + user_id: null, + member_ids: null, + }; + var currentDomain = [ + '|', + ['section_id', '=', 42], + '|', + ['user_id', '=', 3], + ['member_ids', 'in', [3]] + ]; + assert.ok(new Domain(currentDomain).compute(_.extend({}, web, {section_id: 42}))); + assert.ok(new Domain(currentDomain).compute(_.extend({}, web, {user_id: 3}))); + assert.ok(new Domain(currentDomain).compute(_.extend({}, web, {member_ids: 3}))); + }); + + QUnit.test("not", function (assert) { + assert.expect(2); + + var fields = { + a: 5, + group_method: 'line', + }; + assert.ok(new Domain(['!', ['a', '=', 3]]).compute(fields)); + assert.ok(new Domain(['!', ['group_method','=','count']]).compute(fields)); + }); + + QUnit.test("domains initialized with a number", function (assert) { + assert.expect(2); + + assert.ok(new Domain(1).compute({})); + assert.notOk(new Domain(0).compute({})); + }); +}); +}); -- cgit v1.2.3