summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/basic_fields_tests.js
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2017-04-12 11:53:42 +0200
committerChristophe Matthieu <chm@odoo.com>2017-04-13 16:55:00 +0200
commitc32724eae06c987e74a0600f1669696e499edc33 (patch)
treee80d8ccc3c08ec4a95889a06f6624e2c63b5bb29 /addons/web/static/tests/fields/basic_fields_tests.js
parent9c43ad85d463ef8f1fb4b8d16924bc71c0885a55 (diff)
[FIX] web: calendar timezone with user configuration
The client must receive the tzOffset to apply this on all hours. To use the date picker we must change the date to apply the change in the user's tzOffset, without this change the result is wrong. For datetime widget we must change like it to avoid max stack error. The server send the tzOffset, if it's undefined, by default the client use the browser time offset. Every test are change to use tzOffset. A test is added in calendar to use the click by position for the fullcalendar lib. This test create and drag and drop an event to check timezone error and error when we use default value in the context. Use formating date like 2026-04-04T08:00:00Z instead of 2026-04-04 08:00:00 is important for phantomjs, because it's crash without information if the formating is not the standard format. For the parsing, when the client receive a server date the date is utc formating but when it's parsed from the client is in the user's timezone
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
-rw-r--r--addons/web/static/tests/fields/basic_fields_tests.js21
1 files changed, 15 insertions, 6 deletions
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js
index c56f694e1fe..cb61e21e376 100644
--- a/addons/web/static/tests/fields/basic_fields_tests.js
+++ b/addons/web/static/tests/fields/basic_fields_tests.js
@@ -1000,7 +1000,10 @@ QUnit.module('basic_fields', {
},
translateParameters: { // Avoid issues due to localization formats
date_format: '%m/%d/%Y',
- }
+ },
+ session: {
+ tzOffset: 120
+ },
});
assert.strictEqual(form.$('.o_form_field_date').text(), '02/03/2017',
@@ -1094,10 +1097,13 @@ QUnit.module('basic_fields', {
translateParameters: { // Avoid issues due to localization formats
date_format: '%m/%d/%Y',
time_format: '%H:%M:%S',
- }
+ },
+ session: {
+ tzOffset: 120
+ },
});
- var expectedDateString = "02/08/2017 10:00:00";
+ var expectedDateString = "02/08/2017 12:00:00"; // 10:00:00 without timezone
assert.strictEqual(form.$('.o_form_field_date').text(), expectedDateString,
'the datetime should be correctly displayed in readonly');
@@ -1148,10 +1154,13 @@ QUnit.module('basic_fields', {
translateParameters: { // Avoid issues due to localization formats
date_format: '%m/%d/%Y',
time_format: '%H:%M:%S',
- }
+ },
+ session: {
+ tzOffset: 120
+ },
});
- var expectedDateString = "02/08/2017 10:00:00";
+ var expectedDateString = "02/08/2017 12:00:00"; // 10:00:00 without timezone
var $cell = list.$('tr.o_data_row td:not(.o_list_record_selector)').first();
assert.strictEqual($cell.text(), expectedDateString,
'the datetime should be correctly displayed in readonly');
@@ -1597,7 +1606,7 @@ QUnit.module('basic_fields', {
assert.ok($cell.hasClass('o_edit_mode'), 'should be set as edit mode');
assert.strictEqual($cell.find('input').val(), 'yop',
'should have the corect value in internal input');
- $cell.find('input').val('new').trigger('input');;
+ $cell.find('input').val('new').trigger('input');
// save
list.$buttons.find('.o_list_button_save').click();