summaryrefslogtreecommitdiff
path: root/addons/note/static/tests
diff options
context:
space:
mode:
authorDharmang Soni <dpr@openerp.com>2018-04-04 15:34:43 +0530
committerThibault Delavallée <tde@odoo.com>2018-04-09 14:35:06 +0200
commit807c4c3f5e729d8b2f463d93e73b0dbbc008492b (patch)
treedc6774487c50efbd6c09b5ae642744582b3fe260 /addons/note/static/tests
parentc56491b11bc399247a595a2e08bbc940d2be3746 (diff)
[REF] mail, note: move reminder feature from mail to note
This commit refactors f488dc58c37fdc7fd49df759165de641e213444b that added reminder feature in activities. After merging it was suggested specifications were not correct and it has been decided to move the whole reminder feature in note. Reminders are now notes instead of activities. Now when having note appµ systray proposes to create a note / reminder. A note.note record is created with info given by the user. If a date is given in the systray quick create then an activity is scheduled on this note. This means user can create records in activity systray that are not activities but notes used as reminders. Those will use the first availableµ note column for the user. As reminders are now notes the support of activities not linked to any document is removed, as well as archiving activities and tests linked to that behavior. This commit has been not carefully tested nor in-depth reviewied. It is considered as too important for the upcoming freeze. This closes task ID 1833628. Closes #24129 . Many thanks to @dpr-odoo for its quick development and good work on this task.
Diffstat (limited to 'addons/note/static/tests')
-rw-r--r--addons/note/static/tests/systray_tests.js66
1 files changed, 66 insertions, 0 deletions
diff --git a/addons/note/static/tests/systray_tests.js b/addons/note/static/tests/systray_tests.js
new file mode 100644
index 00000000000..2b07bf85757
--- /dev/null
+++ b/addons/note/static/tests/systray_tests.js
@@ -0,0 +1,66 @@
+odoo.define('note.systray_tests', function (require) {
+"use strict";
+
+var ChatManager = require('mail.ChatManager');
+var systray = require('mail.systray');
+var testUtils = require('web.test_utils');
+var createBusService = require('mail.testUtils').createBusService;
+
+QUnit.module('note', {}, function () {
+
+QUnit.module("ActivityMenu", {
+ beforeEach: function () {
+ this.services = [ChatManager, createBusService()];
+ this.data = {
+ 'mail.activity.menu': {
+ records: [],
+ },
+ };
+ }
+});
+
+QUnit.test('note activity menu widget: create note from activity menu', function (assert) {
+ assert.expect(8);
+ var self = this;
+ var activityMenu = new systray.ActivityMenu();
+ testUtils.addMockEnvironment(activityMenu, {
+ services: this.services,
+ mockRPC: function (route, args) {
+ if (args.method === 'activity_user_count') {
+ return $.when(self.data['mail.activity.menu']['records']);
+ }
+ if (route === '/note/new') {
+ return $.when();
+ }
+ return this._super(route, args);
+ },
+ });
+ activityMenu.appendTo($('#qunit-fixture'));
+ assert.ok(activityMenu.$el.hasClass('o_mail_navbar_item'), 'should be the instance of widget');
+
+ // toggle quick create for note
+ var step = 1;
+ activityMenu.$('.dropdown-toggle').click();
+ assert.strictEqual(activityMenu.$('.o_note_show').hasClass("hidden"), false, 'ActivityMenu should have Add new note CTA');
+ activityMenu.$('.o_note_show').click();
+ assert.strictEqual(activityMenu.$('.o_note_show').hasClass("hidden"), true, 'ActivityMenu should hide CTA when entering a new note');
+ assert.strictEqual(activityMenu.$('.o_note').hasClass("hidden"), false, 'ActivityMenu should display input for new note');
+
+ // creating quick note without date
+ activityMenu.$("input.o_note_input").val("New Note");
+ activityMenu.$(".o_note_save").click();
+ assert.strictEqual(activityMenu.$('.o_note_show').hasClass("hidden"), false, 'ActivityMenu add note button should be displayed');
+ assert.strictEqual(activityMenu.$('.o_note').hasClass("hidden"), true, 'ActivityMenu add note input should be hidden');
+
+ // creating quick note with date
+ step = 2;
+ activityMenu.$('.o_note_show').click();
+ activityMenu.$('input.o_note_input').val("New Note");
+ activityMenu.$('.o_note_set_datetime').click();
+ activityMenu.$(".o_note_save").click();
+ assert.strictEqual(activityMenu.$('.o_note_show').hasClass("hidden"), false, 'ActivityMenu add note button should be displayed');
+ assert.strictEqual(activityMenu.$('.o_note').hasClass("hidden"), true, 'ActivityMenu add note input should be hidden');
+ activityMenu.destroy();
+});
+});
+});