diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-03-08 17:56:14 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-03-08 17:56:14 +0100 |
| commit | 2c5c9b8342df2748ad1044fa94c7c3ad821245ba (patch) | |
| tree | aa6228b4ee7c0038d8759f6d202c2e16e9ac0012 /addons/web/static/tests/views/list_tests.js | |
| parent | 7d4ca676809564d592257450f6a7628d0722ba0a (diff) | |
| parent | c023d0784f27622f185a1075cba8e408067b5352 (diff) | |
[MERGE] forward port branch 12.0 up to c023d0784f2
Diffstat (limited to 'addons/web/static/tests/views/list_tests.js')
| -rw-r--r-- | addons/web/static/tests/views/list_tests.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js index f5e0088173b..347d0c23a53 100644 --- a/addons/web/static/tests/views/list_tests.js +++ b/addons/web/static/tests/views/list_tests.js @@ -10,6 +10,7 @@ var ListView = require('web.ListView'); var mixins = require('web.mixins'); var NotificationService = require('web.NotificationService'); var testUtils = require('web.test_utils'); +var testUtilsDom = require('web.test_utils_dom'); var widgetRegistry = require('web.widget_registry'); var Widget = require('web.Widget'); @@ -277,6 +278,51 @@ QUnit.module('Views', { list.destroy(); }); + QUnit.test('editable list datetimepicker destroy widget', function (assert) { + assert.expect(7); + var done = assert.async(); + + var list = createView({ + View: ListView, + model: 'foo', + data: this.data, + arch: '<tree editable="top">' + + '<field name="date"/>' + + '</tree>', + }); + list.$el.on({ + 'show.datetimepicker': function () { + assert.equal($('.bootstrap-datetimepicker-widget').length, 1, + 'The datetimepicker is open'); + + assert.equal(list.$('.o_data_row').length, 5, + 'There should be 5 rows'); + + assert.equal(list.$('.o_selected_row').length, 1, + 'One row in edit mode'); + + list.$('input.o_datepicker_input').trigger($.Event('keydown', {which: $.ui.keyCode.ESCAPE})); + + assert.equal(list.$('.o_data_row').length, 4, + 'There should be 4 rows'); + + assert.equal(list.$('.o_selected_row').length, 0, + 'No row should be in edit mode'); + + done(); + } + }); + assert.equal(list.$('.o_data_row').length, 4, + 'There should be 4 rows'); + + assert.equal(list.$('.o_selected_row').length, 0, + 'No row should be in edit mode'); + + testUtilsDom.click(list.$buttons.find('.o_list_button_add')); + + list.destroy(); + }); + QUnit.test('at least 4 rows are rendered, even if less data', function (assert) { assert.expect(1); |
