systray_activity_menu_tests.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /** @odoo-module **/
  2. import { start, startServer } from '@mail/../tests/helpers/test_utils';
  3. import { patchDate, patchWithCleanup } from "@web/../tests/helpers/utils";
  4. QUnit.module('calendar', {}, function () {
  5. QUnit.module('ActivityMenu');
  6. QUnit.test('activity menu widget:today meetings', async function (assert) {
  7. assert.expect(6);
  8. patchDate(2018, 3, 20, 6, 0, 0);
  9. const pyEnv = await startServer();
  10. const calendarAttendeeId1 = pyEnv['calendar.attendee'].create({ partner_id: pyEnv.currentPartnerId });
  11. pyEnv['calendar.event'].create([
  12. {
  13. res_model: "calendar.event",
  14. name: "meeting1",
  15. start: "2018-04-20 06:30:00",
  16. attendee_ids: [calendarAttendeeId1],
  17. },
  18. {
  19. res_model: "calendar.event",
  20. name: "meeting2",
  21. start: "2018-04-20 09:30:00",
  22. attendee_ids: [calendarAttendeeId1],
  23. },
  24. ]);
  25. const { click, env } = await start();
  26. assert.containsOnce(document.body, '.o_ActivityMenuView', 'should contain an instance of widget');
  27. await click('.dropdown-toggle[title="Activities"]');
  28. patchWithCleanup(env.services.action, {
  29. doAction(action) {
  30. assert.strictEqual(action, "calendar.action_calendar_event", 'should open meeting calendar view in day mode');
  31. },
  32. });
  33. assert.ok(document.querySelector('.o_meeting_filter'), "should be a meeting");
  34. assert.containsN(document.body, '.o_meeting_filter', 2, 'there should be 2 meetings');
  35. assert.hasClass(document.querySelector('.o_meeting_filter'), 'o_meeting_bold', 'this meeting is yet to start');
  36. assert.doesNotHaveClass(document.querySelectorAll('.o_meeting_filter')[1], 'o_meeting_bold', 'this meeting has been started');
  37. await click('.o_ActivityMenuView_activityGroup');
  38. });
  39. });