-
-
-
-
-
diff --git a/addons/web/static/tests/views/calendar_tests.js b/addons/web/static/tests/views/calendar_tests.js
index 16e304c14a6..afc1799446c 100644
--- a/addons/web/static/tests/views/calendar_tests.js
+++ b/addons/web/static/tests/views/calendar_tests.js
@@ -161,7 +161,6 @@ QUnit.module('Views', {
'mode="week" '+
'attendee="partner_ids" '+
'color="partner_id">'+
- '
'+
'
'+
'
'+
'',
@@ -179,7 +178,7 @@ QUnit.module('Views', {
// test view scales
assert.containsN(calendar, '.fc-event', 9,
"should display 9 events on the week (4 event + 5 days event)");
- assert.containsN($sidebar, '.o_selected_range', 7,
+ assert.containsN($sidebar, 'tr:has(.ui-state-active) td', 7,
"week scale should highlight 7 days in mini calendar");
await testUtils.dom.click(calendar.$buttons.find('.o_calendar_button_day')); // display only one day
@@ -190,44 +189,44 @@ QUnit.module('Views', {
await testUtils.dom.click(calendar.$buttons.find('.o_calendar_button_month')); // display all the month
assert.containsN(calendar, '.fc-event', 7,
"should display 7 events on the month (5 events + 2 week event - 1 'event 6' is filtered + 1 'Undefined event')");
- assert.containsN($sidebar, '.o_selected_range', 31,
+ assert.containsN($sidebar, 'td a', 31,
"month scale should highlight all days in mini calendar");
// test filters
assert.containsN($sidebar, '.o_calendar_filter', 2, "should display 2 filters");
- var $typeFilter = $sidebar.find('.o_calendar_filter:has(h3:contains(user))');
+ var $typeFilter = $sidebar.find('.o_calendar_filter:has(h5:contains(user))');
assert.ok($typeFilter.length, "should display 'user' filter");
assert.containsN($typeFilter, '.o_calendar_filter_item', 3, "should display 3 filter items for 'user'");
// filters which has no value should show with string "Undefined", should not have any user image and should show at the last
assert.strictEqual($typeFilter.find('.o_calendar_filter_item:last').data('value'), false, "filters having false value should be displayed at last in filter items");
- assert.strictEqual($typeFilter.find('.o_calendar_filter_item:last span').text(), "Undefined", "filters having false value should display 'Undefined' string");
+ assert.strictEqual($typeFilter.find('.o_calendar_filter_item:last .o_cw_filter_title').text(), "Undefined", "filters having false value should display 'Undefined' string");
assert.strictEqual($typeFilter.find('.o_calendar_filter_item:last label img').length, 0, "filters having false value should not have any user image");
- var $attendeesFilter = $sidebar.find('.o_calendar_filter:has(h3:contains(attendees))');
+ var $attendeesFilter = $sidebar.find('.o_calendar_filter:has(h5:contains(attendees))');
assert.ok($attendeesFilter.length, "should display 'attendees' filter");
assert.containsN($attendeesFilter, '.o_calendar_filter_item', 3, "should display 3 filter items for 'attendees' who use write_model (2 saved + Everything)");
assert.ok($attendeesFilter.find('.o_field_many2one').length, "should display one2many search bar for 'attendees' filter");
assert.containsN(calendar, '.fc-event', 7,
"should display 7 events ('event 5' counts for 2 because it spans two weeks and thus generate two fc-event elements)");
- await testUtils.dom.click(calendar.$('.o_calendar_filter .custom-checkbox input').first());
+ await testUtils.dom.click(calendar.$('.o_calendar_filter input[type="checkbox"]').first());
assert.containsN(calendar, '.fc-event', 4, "should now only display 4 event");
- await testUtils.dom.click(calendar.$('.o_calendar_filter .custom-checkbox input').eq(1));
+ await testUtils.dom.click(calendar.$('.o_calendar_filter input[type="checkbox"]').eq(1));
assert.containsNone(calendar, '.fc-event', "should not display any event anymore");
// test search bar in filter
await testUtils.dom.click($sidebar.find('input[type="text"]'));
assert.strictEqual($('ul.ui-autocomplete li:not(.o_m2o_dropdown_option)').length, 2,"should display 2 choices in one2many autocomplete"); // TODO: remove :not(.o_m2o_dropdown_option) because can't have "create & edit" choice
await testUtils.dom.click($('ul.ui-autocomplete li:first'));
- assert.containsN($sidebar, '.o_calendar_filter:has(h3:contains(attendees)) .o_calendar_filter_item', 4, "should display 4 filter items for 'attendees'");
+ assert.containsN($sidebar, '.o_calendar_filter:has(h5:contains(attendees)) .o_calendar_filter_item', 4, "should display 4 filter items for 'attendees'");
await testUtils.dom.click($sidebar.find('input[type="text"]'));
assert.strictEqual($('ul.ui-autocomplete li:not(.o_m2o_dropdown_option)').text(), "partner 4", "should display the last choice in one2many autocomplete"); // TODO: remove :not(.o_m2o_dropdown_option) because can't have "create & edit" choice
await testUtils.dom.click($sidebar.find('.o_calendar_filter_item .o_remove').first(), {allowInvisible: true});
assert.ok($('.modal-footer button.btn:contains(Ok)').length, "should display the confirm message");
await testUtils.dom.click($('.modal-footer button.btn:contains(Ok)'));
- assert.containsN($sidebar, '.o_calendar_filter:has(h3:contains(attendees)) .o_calendar_filter_item', 3, "click on remove then should display 3 filter items for 'attendees'");
+ assert.containsN($sidebar, '.o_calendar_filter:has(h5:contains(attendees)) .o_calendar_filter_item', 3, "click on remove then should display 3 filter items for 'attendees'");
calendar.destroy();
});
@@ -235,9 +234,7 @@ QUnit.module('Views', {
assert.expect(3);
var archs = {
- 'event,1,calendar': '
' +
- '' +
- '',
+ 'event,1,calendar': '
',
'event,false,search': '
',
};
@@ -290,11 +287,14 @@ QUnit.module('Views', {
'date_start="start" '+
'date_stop="stop" '+
'all_day="allday" '+
- 'mode="month" '+
- 'readonly_form_view_id="1">'+
- '
'+
- '',
+ 'mode="month"/>',
archs: archs,
+ mockRPC: function (route, args) {
+ if (args.method === 'write') {
+ assert.deepEqual(args.args[1], {name: 'event 4 modified'}, "should update the record");
+ }
+ return this._super.apply(this, arguments);
+ },
viewOptions: {
initialDate: initialDate,
},
@@ -306,20 +306,19 @@ QUnit.module('Views', {
await testUtils.dom.click(calendar.$('.fc-event:contains(event 4) .fc-content'));
+ assert.ok(calendar.$('.o_cw_popover').length, "should open a popover clicking on event");
+ assert.ok(calendar.$('.o_cw_popover .o_cw_popover_edit').length, "popover should have an edit button");
+ assert.ok(calendar.$('.o_cw_popover .o_cw_popover_delete').length, "popover should have a delete button");
+ assert.ok(calendar.$('.o_cw_popover .o_cw_popover_close').length, "popover should have a close button");
+
+ await testUtils.dom.click(calendar.$('.o_cw_popover .o_cw_popover_edit'));
+
assert.ok($('.modal-body').length, "should open the form view in dialog when click on event");
- assert.ok($('.modal-footer button.btn:contains(Edit)').length, "formViewDialog should be in readonly mode");
- assert.ok($('.modal-footer button.btn:contains(Delete)').length, "formViewDialog should have a delete button");
-
- await testUtils.dom.click($('.modal-footer button.btn:contains(Edit)'));
-
- assert.ok($('.modal-body').length, "should switch the modal in edit mode");
- assert.notOk($('.modal-footer button.btn:contains(Delete)').length, "formViewDialog should not have a delete button in edit mode");
await testUtils.fields.editInput($('.modal-body input:first'), 'event 4 modified');
await testUtils.dom.click($('.modal-footer button.btn:contains(Save)'));
assert.notOk($('.modal-body').length, "save button should close the modal");
- assert.ok(calendar.$('.fc-event:contains(event 4 modified)').length, "should display the updated records");
// create a new event, quick create only
@@ -406,7 +405,7 @@ QUnit.module('Views', {
// delete the a record
await testUtils.dom.click(calendar.$('.fc-event:contains(event 4) .fc-content'));
- await testUtils.dom.click($('.modal-footer button.btn:contains(Delete)'));
+ await testUtils.dom.click(calendar.$('.o_cw_popover .o_cw_popover_delete'));
assert.ok($('.modal-footer button.btn:contains(Ok)').length, "should display the confirm message");
await testUtils.dom.click($('.modal-footer button.btn:contains(Ok)'));
assert.notOk(calendar.$('.fc-event:contains(event 4) .fc-content').length, "the record should be deleted");
@@ -435,10 +434,7 @@ QUnit.module('Views', {
'date_start="start" '+
'date_stop="stop" '+
'all_day="allday" '+
- 'mode="month" '+
- 'readonly_form_view_id="1">'+
- '
'+
- '',
+ 'mode="month"/>',
archs: archs,
viewOptions: {
initialDate: initialDate,
@@ -497,8 +493,7 @@ QUnit.module('Views', {
'date_start="start" '+
'date_stop="stop" '+
'all_day="allday" '+
- 'mode="week" '+
- 'readonly_form_view_id="1">'+
+ 'mode="week">'+
'
'+
'
'+
'
'+
@@ -541,7 +536,7 @@ QUnit.module('Views', {
testUtils.dom.triggerPositionalMouseEvent(left, top + 60, "mousemove");
- assert.strictEqual(calendar.$('.fc-content .fc-time').text(), "08:00 - 10:00",
+ assert.strictEqual(calendar.$('.fc-content .fc-time').text(), "8:00 - 10:00",
"should display the time in the calendar sticker");
await testUtils.dom.triggerPositionalMouseEvent(left, top + 60, "mouseup");
@@ -550,8 +545,8 @@ QUnit.module('Views', {
await testUtils.dom.click($('.modal button.btn:contains(Create)'));
var $newevent = calendar.$('.fc-event:contains(new event)');
- assert.strictEqual($newevent.text().replace(/[\s\n\r]+/g, ''), "08:00-10:00newevent12/13/201608:00:00False",
- "should display the new event with time, title and additional fields");
+ assert.strictEqual($newevent.find('.o_event_title').text(), "new event",
+ "should display the new event with title");
assert.deepEqual($newevent.data('fcSeg').event.record,
{
@@ -567,7 +562,7 @@ QUnit.module('Views', {
// delete record
await testUtils.dom.click($newevent);
- await testUtils.dom.click($('.modal button.btn-secondary:contains(Delete)'));
+ await testUtils.dom.click(calendar.$('.o_cw_popover .o_cw_popover_delete'));
await testUtils.dom.click($('.modal button.btn-primary:contains(Ok)'));
assert.containsNone(calendar, '.fc-content', "should delete the record");
@@ -595,7 +590,7 @@ QUnit.module('Views', {
initialDate: initialDate,
},
}).then(function (calendar) {
- assert.strictEqual(calendar.$('.fc-day-header').first().text(), "Sun 12/11",
+ assert.strictEqual(calendar.$('.fc-day-header').first().text(), "Sun 11",
"The first day of the week should be Sunday");
calendar.destroy();
done();
@@ -626,7 +621,7 @@ QUnit.module('Views', {
week_start: 1,
},
}).then(function (calendar) {
- assert.strictEqual(calendar.$('.fc-day-header').first().text(), "Mon 12/12",
+ assert.strictEqual(calendar.$('.fc-day-header').first().text(), "Mon 12",
"The first day of the week should be Monday");
calendar.destroy();
done();
@@ -659,15 +654,89 @@ QUnit.module('Views', {
week_start: 7,
},
}).then(function (calendar) {
- assert.strictEqual(calendar.$('.fc-week-number').text(), "W51",
+ assert.strictEqual(calendar.$('.fc-week-number').text(), "Week 51",
"We should be on the 51st week");
calendar.destroy();
done();
});
});
+ QUnit.test('render popover', async function (assert) {
+ assert.expect(14);
+
+ var calendar = await createCalendarView({
+ View: CalendarView,
+ model: 'event',
+ data: this.data,
+ arch:
+ '
'+
+ ''+
+ ''+
+ '',
+ archs: archs,
+ viewOptions: {
+ initialDate: initialDate,
+ },
+ });
+
+ await testUtils.dom.click($('.fc-event:contains(event 4)'));
+
+ assert.containsOnce(calendar, '.o_cw_popover', "should open a popover clicking on event");
+ assert.strictEqual(calendar.$('.o_cw_popover .popover-header').text(), 'event 4', "popover should have a title 'event 4'");
+ assert.containsOnce(calendar, '.o_cw_popover .o_cw_popover_edit', "popover should have an edit button");
+ assert.containsOnce(calendar, '.o_cw_popover .o_cw_popover_delete', "popover should have a delete button");
+ assert.containsOnce(calendar, '.o_cw_popover .o_cw_popover_close', "popover should have a close button");
+
+ assert.strictEqual(calendar.$('.o_cw_popover .list-group-item:first b.text-capitalize').text(), 'Wednesday, December 14, 2016', "should display date 'Wednesday, December 14, 2016'");
+ assert.containsN(calendar, '.o_cw_popover .o_cw_popover_fields_secondary .list-group-item', 2, "popover should have a two fields");
+
+ assert.containsOnce(calendar, '.o_cw_popover .o_cw_popover_fields_secondary .list-group-item:first .o_field_char', "should apply char widget");
+ assert.strictEqual(calendar.$('.o_cw_popover .o_cw_popover_fields_secondary .list-group-item:first strong').text(), 'Custom Name : ', "label should be a 'Custom Name'");
+ assert.strictEqual(calendar.$('.o_cw_popover .o_cw_popover_fields_secondary .list-group-item:first .o_field_char').text(), 'event 4', "value should be a 'event 4'");
+
+ assert.containsOnce(calendar, '.o_cw_popover .o_cw_popover_fields_secondary .list-group-item:last .o_form_uri', "should apply m20 widget");
+ assert.strictEqual(calendar.$('.o_cw_popover .o_cw_popover_fields_secondary .list-group-item:last strong').text(), 'user : ', "label should be a 'user'");
+ assert.strictEqual(calendar.$('.o_cw_popover .o_cw_popover_fields_secondary .list-group-item:last .o_form_uri').text(), 'partner 1', "value should be a 'partner 1'");
+
+ await testUtils.dom.click($('.o_cw_popover .o_cw_popover_close'));
+ assert.containsNone(calendar, '.o_cw_popover', "should close a popover");
+
+ calendar.destroy();
+ });
+
+ QUnit.test('attributes hide_date and hide_time', async function (assert) {
+ assert.expect(1);
+
+ var calendar = await createCalendarView({
+ View: CalendarView,
+ model: 'event',
+ data: this.data,
+ arch:
+ '
'+
+ '',
+ archs: archs,
+ viewOptions: {
+ initialDate: initialDate,
+ },
+ });
+
+ await testUtils.dom.click($('.fc-event:contains(event 4)'));
+ assert.containsNone(calendar, '.o_cw_popover .list-group-item', "popover should not contain date/time");
+
+ calendar.destroy();
+ });
+
QUnit.test('create event with timezone in week mode with formViewDialog European locale', async function (assert) {
- assert.expect(8);
+ assert.expect(7);
this.data.event.records = [];
this.data.event.onchanges = {
@@ -692,8 +761,7 @@ QUnit.module('Views', {
'date_start="start" '+
'date_stop="stop" '+
'all_day="allday" '+
- 'mode="week" '+
- 'readonly_form_view_id="1">'+
+ 'mode="week">'+
'
'+
'',
archs: archs,
@@ -771,8 +839,8 @@ QUnit.module('Views', {
await testUtils.dom.click($('.modal-lg button.btn:contains(Save)'));
var $newevent = calendar.$('.fc-event:contains(new event)');
- assert.strictEqual($newevent.text().replace(/[\s\n\r]+/g, ''), "08:00-10:00newevent",
- "should display the new event with time and title");
+ assert.strictEqual($newevent.find('.o_event_title').text(), "new event",
+ "should display the new event with title");
assert.deepEqual($newevent.data('fcSeg').event.record,
{
@@ -831,8 +899,7 @@ QUnit.module('Views', {
'date_start="start" '+
'date_stop="stop" '+
'all_day="allday" '+
- 'mode="week" '+
- 'readonly_form_view_id="1">'+
+ 'mode="week">'+
'
'+
'
'+
'
'+
@@ -875,7 +942,7 @@ QUnit.module('Views', {
testUtils.dom.triggerPositionalMouseEvent(left, top + 60, "mousemove");
- assert.strictEqual(calendar.$('.fc-content .fc-time').text(), "8:00am - 10:00am",
+ assert.strictEqual(calendar.$('.fc-content .fc-time').text(), "8:00 - 10:00",
"should display the time in the calendar sticker");
testUtils.dom.triggerPositionalMouseEvent(left, top + 60, "mouseup");
@@ -884,8 +951,8 @@ QUnit.module('Views', {
await testUtils.dom.click($('.modal button.btn:contains(Create)'));
var $newevent = calendar.$('.fc-event:contains(new event)');
- assert.strictEqual($newevent.text().replace(/[\s\n\r]+/g, ''), "8:00am-10:00amnewevent12/13/201608:00:00False",
- "should display the new event with time, title and additional fields");
+ assert.strictEqual($newevent.find('.o_event_title').text(), "new event",
+ "should display the new event with title");
assert.deepEqual($newevent.data('fcSeg').event.record,
{
@@ -901,7 +968,7 @@ QUnit.module('Views', {
// delete record
await testUtils.dom.click($newevent);
- await testUtils.dom.click($('.modal button.btn-secondary:contains(Delete)'));
+ await testUtils.dom.click(calendar.$('.o_cw_popover .o_cw_popover_delete'));
await testUtils.dom.click($('.modal button.btn-primary:contains(Ok)'));
assert.containsNone(calendar, '.fc-content', "should delete the record");
@@ -909,7 +976,7 @@ QUnit.module('Views', {
});
QUnit.test('create event with timezone in week mode with formViewDialog American locale', async function (assert) {
- assert.expect(8);
+ assert.expect(7);
this.data.event.records = [];
this.data.event.onchanges = {
@@ -934,8 +1001,7 @@ QUnit.module('Views', {
'date_start="start" '+
'date_stop="stop" '+
'all_day="allday" '+
- 'mode="week" '+
- 'readonly_form_view_id="1">'+
+ 'mode="week">'+
'
'+
'',
archs: archs,
@@ -1013,8 +1079,8 @@ QUnit.module('Views', {
await testUtils.dom.click($('.modal-lg button.btn:contains(Save)'));
var $newevent = calendar.$('.fc-event:contains(new event)');
- assert.strictEqual($newevent.text().replace(/[\s\n\r]+/g, ''), "8:00am-10:00amnewevent",
- "should display the new event with time and title");
+ assert.strictEqual($newevent.find('.o_event_title').text(), "new event",
+ "should display the new event with title");
assert.deepEqual($newevent.data('fcSeg').event.record,
{
@@ -1058,7 +1124,7 @@ QUnit.module('Views', {
calendar.destroy();
});
- QUnit.test('check calendar week column timeformat and event content timeformat', async function (assert) {
+ QUnit.test('check calendar week column timeformat', async function (assert) {
assert.expect(2);
var calendar = await createCalendarView({
@@ -1066,9 +1132,7 @@ QUnit.module('Views', {
model: 'event',
data: this.data,
arch:
- '
'+
- ''+
- '',
+ '
',
archs: archs,
viewOptions: {
initialDate: initialDate,
@@ -1079,7 +1143,7 @@ QUnit.module('Views', {
});
assert.strictEqual(calendar.$('.fc-axis:contains(8am)').length, 1, "calendar should show according to timeformat");
- assert.strictEqual(calendar.$('.fc-event:first:contains(12:00am)').length, 1,
+ assert.strictEqual(calendar.$('.fc-axis:contains(11pm)').length, 1,
"event time format should 12 hour");
calendar.destroy();
@@ -1100,8 +1164,7 @@ QUnit.module('Views', {
'date_start="start" '+
'date_stop="stop" '+
'all_day="allday" '+
- 'mode="week" '+
- 'readonly_form_view_id="1">'+
+ 'mode="week">'+
'
'+
'',
archs: archs,
@@ -1164,10 +1227,7 @@ QUnit.module('Views', {
'date_start="start" '+
'date_stop="stop" '+
'mode="week" '+
- 'quick_add="False" '+
- 'readonly_form_view_id="1">'+
- '
'+
- '',
+ 'quick_add="False"/>',
archs: archs,
viewOptions: {
initialDate: initialDate,
@@ -1217,8 +1277,7 @@ QUnit.module('Views', {
'event_open_popup="true" '+
'date_start="start" '+
'date_stop="stop" '+
- 'mode="month" '+
- 'readonly_form_view_id="1">'+
+ 'mode="month">'+
'
'+
'',
archs: archs,
@@ -1243,14 +1302,14 @@ QUnit.module('Views', {
},
}, {positionalClicks: true});
- var pos = calendar.$('.fc-bg td:eq(20)').offset();
+ var pos = calendar.$('.fc-bg td:eq(17)').offset();
try {
testUtils.dom.triggerPositionalMouseEvent(pos.left+15, pos.top+15, "mousedown");
} catch (e) {
calendar.destroy();
throw new Error('The test fails to simulate a click in the screen. Your screen is probably too small or your dev tools is open.');
}
- pos = calendar.$('.fc-bg td:eq(21)').offset();
+ pos = calendar.$('.fc-bg td:eq(18)').offset();
testUtils.dom.triggerPositionalMouseEvent(pos.left+15, pos.top+15, "mousemove");
testUtils.dom.triggerPositionalMouseEvent(pos.left+15, pos.top+15, "mouseup");
await testUtils.nextTick();
@@ -1288,10 +1347,7 @@ QUnit.module('Views', {
'date_start="start" '+
'date_stop="stop" '+
'all_day="allday" '+
- 'mode="week" '+
- 'readonly_form_view_id="1">'+
- '
'+
- '',
+ 'mode="week"/>',
archs: archs,
viewOptions: {
initialDate: initialDate,
@@ -1344,7 +1400,7 @@ QUnit.module('Views', {
'date_start="start" '+
'date_stop="stop" '+
'all_day="allday"> '+
- '
'+
+ '
'+
'',
archs: archs,
viewOptions: {
@@ -1352,18 +1408,19 @@ QUnit.module('Views', {
},
});
- assert.containsN(calendar, '.o_calendar_filter_items .o_cal_avatar', 3,
+ assert.containsN(calendar, '.o_calendar_filter_items .o_cw_filter_avatar', 3,
"should have 3 avatars in the side bar");
- var $event1Avatars = calendar.$('.fc-event .o_calendar_avatars').first();
- assert.containsOnce($event1Avatars, 'img', "should have 1 avatar");
- assert.containsNone($event1Avatars, 'span',
- "should not have a span for more attendees since there is only one");
+ // Event 1
+ await testUtils.dom.click(calendar.$('.fc-event:first'));
+ assert.ok(calendar.$('.o_cw_popover').length, "should open a popover clicking on event");
+ assert.strictEqual(calendar.$('.o_cw_popover').find('img').length, 1, "should have 1 avatar");
+
+ // Event 2
+ await testUtils.dom.click(calendar.$('.fc-event:eq(1)'));
+ assert.ok(calendar.$('.o_cw_popover').length, "should open a popover clicking on event");
+ assert.strictEqual(calendar.$('.o_cw_popover').find('img').length, 5, "should have 5 avatar");
- var $event2Avatars = calendar.$('.fc-event:contains(All day) .o_calendar_avatars');
- assert.containsN($event2Avatars, 'img', 3, "should have 3 avatars");
- assert.strictEqual($event2Avatars.find('span').text(), '+2',
- "should indicate there are 2 more attendees that we don't show");
calendar.destroy();
});
@@ -1380,10 +1437,7 @@ QUnit.module('Views', {
'date_start="start" '+
'date_stop="stop" '+
'all_day="allday" '+
- 'mode="month" '+
- 'readonly_form_view_id="1">'+
- '
'+
- '',
+ 'mode="month"/>',
archs: archs,
viewOptions: {
initialDate: initialDate,
@@ -1411,6 +1465,7 @@ QUnit.module('Views', {
"should open the form view");
});
await testUtils.dom.click(calendar.$('.fc-event:contains(event 4) .fc-content'));
+ await testUtils.dom.click(calendar.$('.o_cw_popover .o_cw_popover_edit'));
// create a new event and edit it
@@ -1456,10 +1511,7 @@ QUnit.module('Views', {
'string="Events" ' +
'date_start="start" '+
'date_stop="stop" '+
- 'mode="month" '+
- 'readonly_form_view_id="1">'+
- '
'+
- '',
+ 'mode="month"/>',
archs: archs,
viewOptions: {
initialDate: initialDate,
@@ -1515,10 +1567,7 @@ QUnit.module('Views', {
'date_start="start" '+
'date_stop="stop" '+
'all_day="allday" '+
- 'mode="month" '+
- 'readonly_form_view_id="1">'+
- '
'+
- '',
+ 'mode="month"/>',
archs: archs,
viewOptions: {
initialDate: initialDate,
@@ -1548,6 +1597,7 @@ QUnit.module('Views', {
"should open the form view");
});
await testUtils.dom.click(calendar.$('.fc-event:contains(event 4) .fc-content'));
+ await testUtils.dom.click(calendar.$('.o_cw_popover .o_cw_popover_edit'));
// create a new event and edit it
@@ -1610,7 +1660,6 @@ QUnit.module('Views', {
'mode="week" '+
'attendee="partner_ids" '+
'color="partner_id">'+
- '
'+
'
'+
'
'+
'',
@@ -1662,7 +1711,6 @@ QUnit.module('Views', {
'mode="week" '+
'attendee="partner_ids" '+
'color="partner_id">'+
- '
'+
'
'+
'
'+
'',
@@ -1745,7 +1793,6 @@ QUnit.module('Views', {
'mode="week" '+
'attendee="partner_ids" '+
'color="partner_id">'+
- '
'+
'
'+
'
'+
'',
@@ -1797,7 +1844,7 @@ QUnit.module('Views', {
});
QUnit.test('Update event with filters', async function (assert) {
- assert.expect(4);
+ assert.expect(5);
var records = this.data.user.records;
records.push({
@@ -1825,7 +1872,6 @@ QUnit.module('Views', {
'mode="week" '+
'attendee="partner_ids" '+
'color="partner_id">'+
- '
'+
'
'+
'
'+
'',
@@ -1852,7 +1898,8 @@ QUnit.module('Views', {
assert.containsN(calendar, '.fc-event', 3, "should display 3 events");
await testUtils.dom.click(calendar.$('.fc-event:contains(event 2) .fc-content'));
- await testUtils.dom.click($('.modal button.btn:contains(Edit)'));
+ assert.ok(calendar.$('.o_cw_popover').length, "should open a popover clicking on event");
+ await testUtils.dom.click(calendar.$('.o_cw_popover .o_cw_popover_edit'));
await testUtils.dom.click($('.modal .o_field_widget[name="user_id"] input'));
await testUtils.dom.click($('.ui-menu-item a:contains(user 5)').trigger('mouseenter'));
await testUtils.dom.click($('.modal button.btn:contains(Save)'));
@@ -1916,7 +1963,6 @@ QUnit.module('Views', {
'mode="week" '+
'attendee="partner_ids" '+
'color="partner_id">'+
- '
'+
'
'+
'
'+
'',
@@ -1930,7 +1976,7 @@ QUnit.module('Views', {
assert.containsN(calendar, '.o_calendar_filter_item', 6, "should display 6 filter items");
assert.containsN(calendar, '.fc-event', 2, "should display 2 events");
- assert.strictEqual(calendar.$('.fc-event .o_field_name').text().replace(/\s/g, ''), "event7event8",
+ assert.strictEqual(calendar.$('.fc-event .o_event_title').text().replace(/\s/g, ''), "event7event8",
"should display 2 events");
calendar.destroy();
@@ -2021,7 +2067,6 @@ QUnit.module('Views', {
'mode="week" '+
'attendee="partner_ids" '+
'color="partner_id">'+
- '
'+
'
'+
'
'+
'',
@@ -2056,10 +2101,7 @@ QUnit.module('Views', {
'date_start="start" '+
'date_stop="stop" '+
'all_day="allday" '+
- 'mode="month" '+
- 'readonly_form_view_id="1">'+
- '
'+
- '',
+ 'mode="month"/>',
archs: archs,
viewOptions: {
initialDate: initialDate,
@@ -2126,7 +2168,6 @@ QUnit.module('Views', {
'mode="week" '+
'attendee="partner_ids" '+
'color="partner_id">'+
- '
'+
'
'+
'
'+
'',
@@ -2178,10 +2219,7 @@ QUnit.module('Views', {
'date_start="start" '+
'date_stop="stop" '+
'all_day="allday" '+
- 'mode="month" '+
- 'readonly_form_view_id="1">'+
- '
'+
- '',
+ 'mode="month"/>',
archs: archs,
viewOptions: {
initialDate: initialDate,
@@ -2216,9 +2254,7 @@ QUnit.module('Views', {
'event,1,calendar': '
'+
- ''+
- '',
+ 'all_day="allday"/>',
'event,false,search': '
',
};
@@ -2250,9 +2286,7 @@ QUnit.module('Views', {
model: 'event',
data: this.data,
arch:
- '
'+
- ''+
- '',
+ '
',
archs: archs,
viewOptions: {
initialDate: initialDate,
@@ -2278,7 +2312,7 @@ QUnit.module('Views', {
});
QUnit.test('timezone does not affect drag and drop', async function (assert) {
- assert.expect(6);
+ assert.expect(10);
var calendar = await createCalendarView({
View: CalendarView,
@@ -2308,12 +2342,13 @@ QUnit.module('Views', {
},
});
- var events = calendar.$('.fc-event').map(function () {
- return $(this).text().trim().replace(/\s+/g, '|');
- });
+ assert.strictEqual(calendar.$('.fc-event:eq(0)').text().trim(), "event 1");
+ await testUtils.dom.click(calendar.$('.fc-event:eq(0)'));
+ assert.strictEqual(calendar.$('.o_field_widget[name="start"]').text(), "12/09/2016 08:00:00");
- assert.strictEqual(events[0], "event|1|12/09/2016|08:00:00");
- assert.strictEqual(events[5], "event|6|12/16/2016|16:00:00");
+ assert.strictEqual(calendar.$('.fc-event:eq(5)').text().trim(), "event 6");
+ await testUtils.dom.click(calendar.$('.fc-event:eq(5)'));
+ assert.strictEqual(calendar.$('.o_field_widget[name="start"]').text(), "12/16/2016 16:00:00");
// Move event 6 as on first day of month view (27th november 2016)
await testUtils.dragAndDrop(
@@ -2322,18 +2357,19 @@ QUnit.module('Views', {
);
await testUtils.nextTick();
- events = calendar.$('.fc-event').map(function () {
- return $(this).text().trim().replace(/\s+/g, '|');
- });
+ assert.strictEqual(calendar.$('.fc-event:eq(0)').text().trim(), "event 6");
+ await testUtils.dom.click(calendar.$('.fc-event:eq(0)'));
+ assert.strictEqual(calendar.$('.o_field_widget[name="start"]').text(), "11/27/2016 16:00:00");
- assert.strictEqual(events[0], "event|6|11/27/2016|16:00:00");
- assert.strictEqual(events[1], "event|1|12/09/2016|08:00:00");
+ assert.strictEqual(calendar.$('.fc-event:eq(1)').text().trim(), "event 1");
+ await testUtils.dom.click(calendar.$('.fc-event:eq(1)'));
+ assert.strictEqual(calendar.$('.o_field_widget[name="start"]').text(), "12/09/2016 08:00:00");
calendar.destroy();
});
QUnit.test('timzeone does not affect calendar with date field', async function (assert) {
- assert.expect(8);
+ assert.expect(11);
var calendar = await createCalendarView({
View: CalendarView,
@@ -2374,7 +2410,9 @@ QUnit.module('Views', {
await testUtils.dom.click($('.modal button.btn:contains(Create)'));
await testUtils.nextTick();
- assert.strictEqual(calendar.$('.o_field_start_date').text().trim(), "12/20/2016");
+ await testUtils.dom.click(calendar.$('.fc-event:contains(An event)'));
+ assert.ok(calendar.$('.o_cw_popover').length, "should open a popover clicking on event");
+ assert.strictEqual(calendar.$('.o_cw_popover .o_cw_popover_fields_secondary .list-group-item:last .o_field_date').text(), '12/20/2016', "should have correct start date");
// Move event to another day (on 27 november)
await testUtils.dragAndDrop(
@@ -2383,7 +2421,9 @@ QUnit.module('Views', {
);
await testUtils.nextTick();
assert.verifySteps(["2016-11-27 00:00:00"]);
- assert.strictEqual(calendar.$('.o_field_start_date').text().trim(), "11/27/2016");
+ await testUtils.dom.click(calendar.$('.fc-event:contains(An event)'));
+ assert.ok(calendar.$('.o_cw_popover').length, "should open a popover clicking on event");
+ assert.strictEqual(calendar.$('.o_cw_popover .o_cw_popover_fields_secondary .list-group-item:last .o_field_date').text(), '11/27/2016', "should have correct start date");
// Move event to last day (on 7 january)
await testUtils.dragAndDrop(
@@ -2392,7 +2432,9 @@ QUnit.module('Views', {
);
await testUtils.nextTick();
assert.verifySteps(["2017-01-07 00:00:00"]);
- assert.strictEqual(calendar.$('.o_field_start_date').text().trim(), "01/07/2017");
+ await testUtils.dom.click(calendar.$('.fc-event:contains(An event)'));
+ assert.ok(calendar.$('.o_cw_popover').length, "should open a popover clicking on event");
+ assert.strictEqual(calendar.$('.o_cw_popover .o_cw_popover_fields_secondary .list-group-item:last .o_field_date').text(), '01/07/2017', "should have correct start date");
calendar.destroy();
});
@@ -2452,9 +2494,7 @@ QUnit.module('Views', {
'date_start="start" '+
'date_stop="stop" '+
'mode="month" '+
- 'form_view_id="42">'+
- '
'+
- '',
+ 'form_view_id="42"/>',
archs: archs,
viewOptions: {
initialDate: initialDate,
@@ -2536,9 +2576,7 @@ QUnit.module('Views', {
arch: '
'+
- ''+
- '',
+ 'mode="month"/>',
archs: archs,
viewOptions: {
initialDate: initialDate,
@@ -2593,9 +2631,7 @@ QUnit.module('Views', {
arch: '
'+
- ''+
- '',
+ 'mode="week"/>',
archs: archs,
viewOptions: {
initialDate: initialDate,
@@ -2604,7 +2640,7 @@ QUnit.module('Views', {
});
- assert.strictEqual(calendar.$('.fc-day-header:first').text(), "zz1. 11/12",
+ assert.strictEqual(calendar.$('.fc-day-header:first').text(), "zz1. 11",
'The day should be in the given locale specific format');
moment.locale(initialLocale);
@@ -2612,45 +2648,6 @@ QUnit.module('Views', {
calendar.destroy();
});
- QUnit.test('calendar sidebar toggle', async function (assert) {
- assert.expect(5);
-
- var calendar = await createCalendarView({
- View: CalendarView,
- model: 'event',
- data: this.data,
- arch:
- '
'+
- ''+
- '',
- services: {
- local_storage: AbstractStorageService.extend({storage: new RamStorage()}),
- },
- });
-
- var fullWidth = calendar.call('local_storage', 'getItem', 'calendar_fullWidth');
- assert.strictEqual(fullWidth, undefined,
- "calendar_fullWidth should be undefined in local storage");
- assert.containsNone(calendar, '.o_calendar_sidebar_container.o_sidebar_hidden',
- "sidebar should be opened");
-
- // click on close
- await testUtils.dom.click(calendar.$('.o_calendar_sidebar_toggler'));
- fullWidth = calendar.call('local_storage', 'getItem', 'calendar_fullWidth');
- assert.strictEqual(fullWidth, true,
- "calendar_fullWidth should be true in local storage");
- assert.containsOnce(calendar, '.o_calendar_sidebar_container.o_sidebar_hidden',
- "sidebar should be hidden");
-
- // reload calendar view and check calendar view has still full width
- calendar.reload();
- await testUtils.nextTick();
- assert.containsOnce(calendar, '.o_calendar_sidebar_container.o_sidebar_hidden',
- "sidebar should be hidden");
-
- calendar.destroy();
- });
-
});
});
diff --git a/addons/web/views/webclient_templates.xml b/addons/web/views/webclient_templates.xml
index e9640dd512d..51aa1423584 100644
--- a/addons/web/views/webclient_templates.xml
+++ b/addons/web/views/webclient_templates.xml
@@ -355,6 +355,7 @@
+
diff --git a/doc/reference/views.rst b/doc/reference/views.rst
index 08bc5e6313e..f3bc35fa286 100644
--- a/doc/reference/views.rst
+++ b/doc/reference/views.rst
@@ -1168,8 +1168,6 @@ calendar view are:
same color segment are allocated the same highlight color in the calendar,
colors are allocated semi-randomly.
Displayed the display_name/avatar of the visible record in the sidebar
-``readonly_form_view_id``
- view to open in readonly mode
``form_view_id``
view to open when the user create or edit an event. Note that if this attribute
is not set, the calendar view will fall back to the id of the form view in the
diff --git a/odoo/addons/base/rng/calendar_view.rng b/odoo/addons/base/rng/calendar_view.rng
index 656445e449e..a6737fbcfa2 100644
--- a/odoo/addons/base/rng/calendar_view.rng
+++ b/odoo/addons/base/rng/calendar_view.rng
@@ -13,13 +13,14 @@
-
+
+
@@ -32,13 +33,6 @@
-
-
-
-
-
-
-