diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-04-07 11:12:58 +0200 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-04-11 19:44:38 +0200 |
| commit | 875ea7964c62552ba976f09ad6c94db6fffb5b66 (patch) | |
| tree | 94dfdf90e30dcea5c457961de7df785dcb82e83e /addons/web/static/tests/core/domain_tests.js | |
| parent | f0ee1e2be579904495b2a78d56c314960392e94f (diff) | |
[REF] account, web, web_diagram: rename static test folder
For consistency, every static test folder should be named 'tests', with
a s.
Diffstat (limited to 'addons/web/static/tests/core/domain_tests.js')
| -rw-r--r-- | addons/web/static/tests/core/domain_tests.js | 62 |
1 files changed, 62 insertions, 0 deletions
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({})); + }); +}); +}); |
