[REF] note: adapt code after jQuery update
Part of task 1896658 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com> Co-authored-by: svs-odoo <svs@odoo.com> Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
This commit is contained in:
committed by
Aaron Bohy
co-authored by
Aaron Bohy
Christophe Matthieu
Mathieu Duckerts-Antoine
David Monjoie
Martin Geubelle
svs-odoo
parent
edae92c880
commit
237b9e8ef5
@@ -89,14 +89,16 @@ ActivityMenu.include({
|
||||
* @param {MouseEvent} ev
|
||||
*/
|
||||
_onAddNoteClick: function (ev) {
|
||||
var self = this;
|
||||
ev.stopPropagation();
|
||||
if (!this.noteDateTimeWidget){
|
||||
this.noteDateTimeWidget = new datepicker.DateWidget(this, {useCurrent: true});
|
||||
}
|
||||
this.noteDateTimeWidget.appendTo(this.$('.o_note_datetime'));
|
||||
this.noteDateTimeWidget.$input.attr('placeholder', _t("Today"));
|
||||
this.$('.o_note_show, .o_note').toggleClass('d-none');
|
||||
this.$('.o_note_input').val('').focus();
|
||||
this.noteDateTimeWidget.appendTo(this.$('.o_note_datetime')).then(function() {
|
||||
self.noteDateTimeWidget.$input.attr('placeholder', _t("Today"));
|
||||
self.$('.o_note_show, .o_note').toggleClass('d-none');
|
||||
self.$('.o_note_input').val('').focus();
|
||||
});
|
||||
},
|
||||
/**
|
||||
* When focusing on input for new quick note systerm tray must be open.
|
||||
|
||||
@@ -34,7 +34,7 @@ QUnit.module("ActivityMenu", {
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.test('note activity menu widget: create note from activity menu', function (assert) {
|
||||
QUnit.test('note activity menu widget: create note from activity menu', async function (assert) {
|
||||
assert.expect(15);
|
||||
var self = this;
|
||||
var activityMenu = new ActivityMenu();
|
||||
@@ -42,7 +42,7 @@ QUnit.test('note activity menu widget: create note from activity menu', function
|
||||
services: this.services,
|
||||
mockRPC: function (route, args) {
|
||||
if (args.method === 'systray_get_activities') {
|
||||
return $.when(self.data['mail.activity.menu'].records);
|
||||
return Promise.resolve(self.data['mail.activity.menu'].records);
|
||||
}
|
||||
if (route === '/note/new') {
|
||||
if (args.date_deadline) {
|
||||
@@ -66,32 +66,32 @@ QUnit.test('note activity menu widget: create note from activity menu', function
|
||||
self.data['mail.activity.menu'].records[0].today_count++;
|
||||
self.data['mail.activity.menu'].records[0].total_count++;
|
||||
}
|
||||
return $.when();
|
||||
return Promise.resolve();
|
||||
}
|
||||
return this._super(route, args);
|
||||
},
|
||||
});
|
||||
activityMenu.appendTo($('#qunit-fixture'));
|
||||
await activityMenu.appendTo($('#qunit-fixture'));
|
||||
assert.hasClass(activityMenu.$el,'o_mail_systray_item',
|
||||
'should be the instance of widget');
|
||||
assert.strictEqual(activityMenu.$('.o_notification_counter').text(), '0',
|
||||
"should not have any activity notification initially");
|
||||
|
||||
// toggle quick create for note
|
||||
testUtils.dom.click(activityMenu.$('.dropdown-toggle'));
|
||||
await testUtils.dom.click(activityMenu.$('.dropdown-toggle'));
|
||||
assert.containsOnce(activityMenu, '.o_no_activity',
|
||||
"should not have any activity preview");
|
||||
assert.doesNotHaveClass(activityMenu.$('.o_note_show'), 'd-none',
|
||||
'ActivityMenu should have Add new note CTA');
|
||||
testUtils.dom.click(activityMenu.$('.o_note_show'));
|
||||
await testUtils.dom.click(activityMenu.$('.o_note_show'));
|
||||
assert.hasClass(activityMenu.$('.o_note_show'), 'd-none',
|
||||
'ActivityMenu should hide CTA when entering a new note');
|
||||
assert.doesNotHaveClass(activityMenu.$('.o_note'), 'd-none',
|
||||
'ActivityMenu should display input for new note');
|
||||
|
||||
// creating quick note without date
|
||||
activityMenu.$("input.o_note_input").val("New Note");
|
||||
testUtils.dom.click(activityMenu.$(".o_note_save"));
|
||||
await testUtils.fields.editInput(activityMenu.$("input.o_note_input"), "New Note");
|
||||
await testUtils.dom.click(activityMenu.$(".o_note_save"));
|
||||
assert.strictEqual(activityMenu.$('.o_notification_counter').text(), '1',
|
||||
"should increment activity notification counter after creating a note");
|
||||
assert.containsOnce(activityMenu, '.o_mail_preview[data-res_model="note.note"]',
|
||||
@@ -106,9 +106,9 @@ QUnit.test('note activity menu widget: create note from activity menu', function
|
||||
'ActivityMenu add note input should be hidden');
|
||||
|
||||
// creating quick note with date
|
||||
testUtils.dom.click(activityMenu.$('.o_note_show'));
|
||||
await testUtils.dom.click(activityMenu.$('.o_note_show'));
|
||||
activityMenu.$('input.o_note_input').val("New Note");
|
||||
testUtils.dom.click(activityMenu.$(".o_note_save"));
|
||||
await testUtils.dom.click(activityMenu.$(".o_note_save"));
|
||||
assert.strictEqual(activityMenu.$('.o_notification_counter').text(), '2',
|
||||
"should increment activity notification counter after creating a second note");
|
||||
assert.strictEqual(activityMenu.$('.o_activity_filter_button[data-filter="today"]').text().trim(),
|
||||
|
||||
Reference in New Issue
Block a user