summaryrefslogtreecommitdiff
path: root/addons/web/static/tests
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2018-07-25 11:51:20 +0200
committerChristophe Matthieu <chm@odoo.com>2018-08-13 17:09:28 +0200
commit32b269d3d55e423604d093db4d98e6c56cab672d (patch)
treee200b484fe5ae638a2600dcad991f4850801916d /addons/web/static/tests
parent061175e598939ff30c992bf606f5c9e200854072 (diff)
[IMP] web: add `default` option to DomainSelector
This option is used to set a default domain value when creating a new node (instead of [['id', '=', 1]]).
Diffstat (limited to 'addons/web/static/tests')
-rw-r--r--addons/web/static/tests/widgets/domain_selector_tests.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/addons/web/static/tests/widgets/domain_selector_tests.js b/addons/web/static/tests/widgets/domain_selector_tests.js
index aca017e831c..20ea5d86297 100644
--- a/addons/web/static/tests/widgets/domain_selector_tests.js
+++ b/addons/web/static/tests/widgets/domain_selector_tests.js
@@ -213,6 +213,32 @@ QUnit.module('DomainSelector', {
domainSelector.destroy();
});
+
+ QUnit.test("creating a domain with a default option", function (assert) {
+ assert.expect(1);
+
+ var $target = $("#qunit-fixture");
+
+ // Create the domain selector and its mock environment
+ var domainSelector = new DomainSelector(null, "partner", [], {
+ readonly: false,
+ debugMode: true,
+ default: [["foo","=","kikou"]],
+ });
+ testUtils.addMockEnvironment(domainSelector, {data: this.data});
+ domainSelector.appendTo($target);
+
+ // Clicking on the button should add a visible field selector in the
+ // widget so that the user can change the field chain
+ domainSelector.$(".o_domain_add_first_node_button:visible").click();
+
+ assert.strictEqual(
+ domainSelector.$(".o_domain_debug_input").val(),
+ '[["foo","=","kikou"]]',
+ "the domain input should contain the default domain");
+
+ domainSelector.destroy();
+ });
});
});
});