summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/widgets
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2017-09-21 12:22:43 +0200
committerqsm-odoo <qsm@odoo.com>2017-09-21 14:51:12 +0200
commitb51b0d66c2f71593d5eb3f153d55b1b97d979da7 (patch)
tree71e4eaa0f5ca055e14cb7557e0af6f5dc89af523 /addons/web/static/tests/widgets
parent5b216c03c1c65f8c0ff651d21bad4177926c7621 (diff)
[FIX] web: open domain selector's datepicker at the right position
Before this commit, and since the combination of new views + datepicker library update, the datepicker opened at the top left of the window when using it in a domain selector. It also could not be used at all. This was because the current scenario occured: 1) Click on the datepicker 2) The datepicker triggers that it has changed on opening 3) The whole domain selector is rerendered 4) The datepicker computes where it should open... on basis of the old destroyed domain selector As the main cause of the problem here was the (2), this commit changes the datepicker odoo widget to only notifies that it has changed when it has really changed.
Diffstat (limited to 'addons/web/static/tests/widgets')
-rw-r--r--addons/web/static/tests/widgets/domain_selector_tests.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/addons/web/static/tests/widgets/domain_selector_tests.js b/addons/web/static/tests/widgets/domain_selector_tests.js
index 19731156a2c..77d8eeb24da 100644
--- a/addons/web/static/tests/widgets/domain_selector_tests.js
+++ b/addons/web/static/tests/widgets/domain_selector_tests.js
@@ -151,7 +151,7 @@ QUnit.module('DomainSelector', {
});
QUnit.test("building a domain with a datetime", function (assert) {
- assert.expect(1);
+ assert.expect(2);
var $target = $("#qunit-fixture");
@@ -163,8 +163,16 @@ QUnit.module('DomainSelector', {
domainSelector.appendTo($target);
// Check that there is a datepicker to choose the date
- assert.strictEqual(domainSelector.$(".o_datepicker:visible").length, 1,
+ var $datepicker = domainSelector.$(".o_datepicker:visible");
+ assert.strictEqual($datepicker.length, 1,
"there should be a datepicker");
+
+ var val = $datepicker.find('input').focus().click().val();
+ $('.bootstrap-datetimepicker-widget :not(.today)[data-action="selectDay"]').click();
+ assert.notEqual(domainSelector.$(".o_datepicker:visible input").val(), val,
+ "datepicker value should have changed");
+
+ domainSelector.destroy();
});
});
});