[FIX] web: esc cancels kanban column quick create

The feature was already declared in AbstractQuickCreate, but the
ColumnQuickCreate object did not define a _cancel function.
This commit is contained in:
David Monjoie
2018-08-22 15:54:21 +02:00
parent be4651cda3
commit a66650a7fa
2 changed files with 21 additions and 1 deletions
@@ -266,6 +266,19 @@ var ColumnQuickCreate = AbstractQuickCreate.extend({
// Private
//--------------------------------------------------------------------------
/**
* Triggers up an event to cancel the quick creation
*
* @override
* @private
*/
_cancel: function () {
if (!this.folded) {
this.folded = true;
this.$input.val('');
this._update();
}
},
/**
* Triggers up an event to quick create a column with the given value
*
@@ -1203,7 +1203,7 @@ QUnit.module('Views', {
});
QUnit.test('quick create record & column in grouped on m2o', function (assert) {
assert.expect(2);
assert.expect(4);
var kanban = createView({
View: KanbanView,
@@ -1230,6 +1230,13 @@ QUnit.module('Views', {
assert.strictEqual(kanban.$('.o_kanban_group:last span:contains(new column)').length, 1,
"the last column should be the newly created one");
assert.strictEqual(kanban.$('.o_kanban_quick_create:visible button.o_kanban_add').length, 1,
"the quick create column should still be opened for mass creation");
kanban.$('.o_column_quick_create input').trigger($.Event('keydown', { keyCode: $.ui.keyCode.ESCAPE }));
assert.strictEqual(kanban.$('.o_kanban_quick_create:visible button.o_kanban_add').length, 0,
"the quick create column should now be closed");
kanban.destroy();
});