[REF] *: remove manualDestroy options for tests
With the new JS test framework, we had experimented with an autodestroy feature, meaning that all views/widgets are automatically destroyed after a while. By default, it was 50ms, because we could not hook some code to run after the end of the current test. For various reasons, this was not a good idea: some side effects, such as modifications of the session or of the DOM (with modals) could interfere with other tests. This commit disable the feature. From now on, we will have to destroy each widgets created in a test.
This commit is contained in:
committed by
Aaron Bohy
parent
086a04fdec
commit
dde1223a14
@@ -39,6 +39,7 @@ QUnit.test('add import button in list', function(assert) {
|
||||
});
|
||||
|
||||
list.$buttons.find('.o_button_import:contains(Import)').click();
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('list without import button', function(assert) {
|
||||
@@ -55,6 +56,7 @@ QUnit.test('list without import button', function(assert) {
|
||||
});
|
||||
|
||||
assert.ok(!list.$buttons.find('.o_button_import').length, "should not have an Import button");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
});
|
||||
@@ -130,6 +130,7 @@ QUnit.test('dashboard: click on a button to execute an action', function (assert
|
||||
});
|
||||
|
||||
kanban.$('.my_button:first()').click(); // click on the button of the first card
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -151,6 +151,7 @@ QUnit.test('basic rendering', function (assert) {
|
||||
// assert.strictEqual(msgRpc, 1, "should still have fetched messages only once");
|
||||
assert.strictEqual(count, 0, "should have done no read_followers rpc as there are no followers");
|
||||
assert.strictEqual(unwanted_read_count, 0, "followers should only be fetched with read_followers route");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('chatter is not rendered in mode === create', function (assert) {
|
||||
@@ -193,6 +194,7 @@ QUnit.test('chatter is not rendered in mode === create', function (assert) {
|
||||
assert.ok(form.$('.o_chatter').length, "there should be a chatter widget");
|
||||
form.$buttons.find('.o_form_button_create').click();
|
||||
assert.ok(!form.$('.o_chatter').length, "there should not be a chatter widget");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('kanban activity widget with no activity', function (assert) {
|
||||
@@ -214,7 +216,6 @@ QUnit.test('kanban activity widget with no activity', function (assert) {
|
||||
return this._super(route, args);
|
||||
},
|
||||
session: {uid: 2},
|
||||
manualDestroy: true,
|
||||
});
|
||||
|
||||
var $record = kanban.$('.o_kanban_record').first();
|
||||
@@ -268,7 +269,6 @@ QUnit.test('kanban activity widget with an activity', function (assert) {
|
||||
return this._super(route, args);
|
||||
},
|
||||
session: {uid:2},
|
||||
manualDestroy: true,
|
||||
});
|
||||
|
||||
var $record = kanban.$('.o_kanban_record').first();
|
||||
@@ -383,7 +383,6 @@ QUnit.test('chatter: post, receive and star messages', function (assert) {
|
||||
bus.trigger('update_message', msg);
|
||||
},
|
||||
},
|
||||
manualDestroy: true,
|
||||
});
|
||||
|
||||
assert.ok(form.$('.o_chatter_topbar .o_chatter_button_log_note').length,
|
||||
@@ -539,6 +538,7 @@ QUnit.test('form activity widget: mark as done and remove', function (assert) {
|
||||
"there should be no more activity");
|
||||
assert.strictEqual(form.$('.o_mail_thread .o_thread_message').length, 1,
|
||||
"a chatter message should have been generated");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
|
||||
@@ -624,7 +624,6 @@ QUnit.test('followers widget: follow/unfollow, edit subtypes', function (assert)
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
session: {partner_id: partnerID},
|
||||
manualDestroy: true,
|
||||
});
|
||||
|
||||
assert.strictEqual(form.$('.o_followers_count').text(), "0", 'should have no followers');
|
||||
|
||||
@@ -102,6 +102,8 @@ QUnit.module('basic_fields', {
|
||||
"should have 4 checked input");
|
||||
assert.strictEqual(list.$('tbody td:not(.o_list_record_selector) .o_checkbox input').length, 5,
|
||||
"should have 5 checkboxes");
|
||||
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.module('FieldBooleanButton');
|
||||
@@ -134,6 +136,7 @@ QUnit.module('basic_fields', {
|
||||
"button should contain correct string");
|
||||
assert.strictEqual(form.$('.o_stat_text.o_hover:contains(Switch to test environment)').length, 1,
|
||||
"button should display correct string when hovering");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
|
||||
@@ -150,6 +153,7 @@ QUnit.module('basic_fields', {
|
||||
});
|
||||
|
||||
assert.strictEqual(list.$('.o_list_number').length, 5, "should have 5 cells with .o_list_number");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('float fields use correct digit precision', function (assert) {
|
||||
@@ -170,6 +174,7 @@ QUnit.module('basic_fields', {
|
||||
});
|
||||
assert.strictEqual(form.$('span.o_form_field_number:contains(0.4)').length, 1,
|
||||
"should contain a number rounded to 1 decimal");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.module('EmailWidget');
|
||||
@@ -194,6 +199,7 @@ QUnit.module('basic_fields', {
|
||||
|
||||
assert.strictEqual(form.$('a.o_form_uri.o_form_field.o_text_overflow').length, 1,
|
||||
"should have a anchor with correct classes");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.module('FieldChar');
|
||||
@@ -215,6 +221,7 @@ QUnit.module('basic_fields', {
|
||||
|
||||
var charField = form.renderer.widgets[0];
|
||||
assert.strictEqual(charField.isValid(), true);
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('char fields in edit mode', function (assert) {
|
||||
@@ -237,6 +244,7 @@ QUnit.module('basic_fields', {
|
||||
form.$buttons.find('.o_form_button_edit').click();
|
||||
assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').length, 1,
|
||||
"should have an input for the char field foo");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.module('UrlWidget');
|
||||
@@ -260,6 +268,7 @@ QUnit.module('basic_fields', {
|
||||
|
||||
assert.strictEqual(form.$('a.o_form_uri.o_form_field.o_text_overflow').length, 1,
|
||||
"should have a anchor with correct classes");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.module('FieldText');
|
||||
@@ -298,6 +307,7 @@ QUnit.module('basic_fields', {
|
||||
|
||||
assert.strictEqual(form.$('div.o_form_textarea').text(), 'hello world',
|
||||
'should be "hello world" after save');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('text fields in edit mode have correct height', function (assert) {
|
||||
@@ -327,6 +337,7 @@ QUnit.module('basic_fields', {
|
||||
// the difference is to take small calculation errors into account
|
||||
assert.strictEqual($textarea.innerHeight(), $textarea[0].scrollHeight,
|
||||
"textarea should not have a scroll bar");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
|
||||
@@ -348,6 +359,7 @@ QUnit.module('basic_fields', {
|
||||
|
||||
assert.strictEqual(list.$('tbody td.o_list_text:contains(some text)').length, 1,
|
||||
"should have a td with the .o_list_text class");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('field text in editable list view', function (assert) {
|
||||
@@ -368,6 +380,7 @@ QUnit.module('basic_fields', {
|
||||
|
||||
assert.strictEqual(list.$('textarea').first().get(0), document.activeElement,
|
||||
"text area should have the focus");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
|
||||
@@ -418,7 +431,6 @@ QUnit.module('basic_fields', {
|
||||
'</t>' +
|
||||
'</templates></kanban>',
|
||||
domain: [['id', 'in', [1, 2]]],
|
||||
manualDestroy: true,
|
||||
});
|
||||
|
||||
// nvd3 seems to do a setTimeout(0) each time the addGraph function is
|
||||
@@ -461,6 +473,7 @@ QUnit.module('basic_fields', {
|
||||
assert.ok(form.$('div.ace_content').length, "should have rendered something with ace editor");
|
||||
delete window.require;
|
||||
delete window.ace;
|
||||
form.destroy();
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -508,6 +521,7 @@ QUnit.module('basic_fields', {
|
||||
form.$('td').eq(1).click();
|
||||
assert.strictEqual(form.$('td:first span.o_row_handle').length, 1,
|
||||
"content of the cell should have been replaced");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.module('FieldDate');
|
||||
@@ -525,7 +539,7 @@ QUnit.module('basic_fields', {
|
||||
var $span = form.$('span.o_form_field');
|
||||
assert.strictEqual($span.length, 1, "should have one span in the form view");
|
||||
assert.strictEqual($span.text(), "", "and it should be empty");
|
||||
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('date field in edit mode', function (assert) {
|
||||
@@ -565,6 +579,7 @@ QUnit.module('basic_fields', {
|
||||
form.$buttons.find('.o_form_button_save').click();
|
||||
assert.strictEqual(form.$('.o_form_field_date').text(), '02/22/2017',
|
||||
'the selected date should be displayed after saving');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('field date in editable list view', function (assert) {
|
||||
@@ -589,6 +604,7 @@ QUnit.module('basic_fields', {
|
||||
|
||||
assert.strictEqual(list.$('input.o_datepicker_input').get(0), document.activeElement,
|
||||
"date input should have the focus");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.module('FieldDomain');
|
||||
@@ -661,6 +677,7 @@ QUnit.module('basic_fields', {
|
||||
$domain = form.$(".o_form_field_domain");
|
||||
assert.ok($domain.html().indexOf("color") >= 0,
|
||||
"field selector readonly value should now contain 'color'");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('domain field is correctly reset on every view change', function (assert) {
|
||||
@@ -738,6 +755,7 @@ QUnit.module('basic_fields', {
|
||||
"field selector popover should contain two fields");
|
||||
assert.strictEqual($sampleLi.length, 1,
|
||||
"field selector popover should contain 'Color index' field");
|
||||
form.destroy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -140,6 +140,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
// TODO: test that we can edit the record in the dialog, and that the value is correctly
|
||||
// updated on close
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('many2one readonly fields with option "no_open"', function (assert) {
|
||||
@@ -160,6 +161,7 @@ QUnit.module('relational_fields', {
|
||||
});
|
||||
|
||||
assert.strictEqual(form.$('a.o_form_uri').length, 0, "should not have an anchor");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('many2one in edit mode', function (assert) {
|
||||
@@ -251,6 +253,8 @@ QUnit.module('relational_fields', {
|
||||
form.$buttons.find('.o_form_button_save').click();
|
||||
assert.strictEqual(form.$('a.o_form_uri').text(), 'Partner 20',
|
||||
"should display correct value after save");
|
||||
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('many2one field with option always_reload', function (assert) {
|
||||
@@ -286,6 +290,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
assert.ok(form.$('a:contains(and some address)').length,
|
||||
"should still display additional result");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
// QUnit.test('onchange on a many2one to a different model', function (assert) {
|
||||
@@ -343,6 +348,7 @@ QUnit.module('relational_fields', {
|
||||
form.$buttons.find('.o_form_button_edit').click();
|
||||
|
||||
form.$('input').click();
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('autocompletion in a many2one, in form view with a date field', function (assert) {
|
||||
@@ -368,6 +374,7 @@ QUnit.module('relational_fields', {
|
||||
form.$buttons.find('.o_form_button_edit').click();
|
||||
|
||||
form.$('input:eq(2)').click();
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('creating record with many2one with option always_reload', function (assert) {
|
||||
@@ -401,6 +408,7 @@ QUnit.module('relational_fields', {
|
||||
assert.strictEqual(count, 3, "should have done 3 rpcs (default_get, onchange, name_get)");
|
||||
assert.strictEqual(form.$('input').val(), 'hello world',
|
||||
"should have taken the correct display name");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('selecting a many2one, then discarding', function (assert) {
|
||||
@@ -426,6 +434,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
form.$buttons.find('.o_form_button_cancel').click();
|
||||
assert.strictEqual(form.$('a').text(), '', 'the tag a should be empty');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('check that the field context is used when doing a name_search in a m2o', function (assert) {
|
||||
@@ -442,7 +451,6 @@ QUnit.module('relational_fields', {
|
||||
'</form>',
|
||||
res_id: 1,
|
||||
session: {user_context: {hey: "ho"}},
|
||||
manualDestroy: true,
|
||||
mockRPC: function (route, args) {
|
||||
if (route === '/web/dataset/call_kw/product/name_search') {
|
||||
var context = args.kwargs.context;
|
||||
@@ -507,6 +515,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
assert.ok(form.$('td.o_list_record_delete').length,
|
||||
"embedded one2many records should have a trash icon");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('one2many with date and datetime', function (assert) {
|
||||
@@ -538,6 +547,7 @@ QUnit.module('relational_fields', {
|
||||
"should have formatted the date");
|
||||
assert.strictEqual(form.$('td:contains(12/12/2016 10:55:05)').length, 1,
|
||||
"should have formatted the datetime");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('rendering with embedded one2many', function (assert) {
|
||||
@@ -569,6 +579,7 @@ QUnit.module('relational_fields', {
|
||||
"embedded one2many should have a column titled according to foo");
|
||||
assert.strictEqual(form.$('td:contains(blip)').length, 1,
|
||||
"embedded one2many should have a cell with relational value");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('embedded one2many with widget', function (assert) {
|
||||
@@ -597,6 +608,7 @@ QUnit.module('relational_fields', {
|
||||
});
|
||||
|
||||
assert.strictEqual(form.$('span.o_row_handle').length, 1, "should have 1 handles");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('one2many field when using the pager', function (assert) {
|
||||
@@ -687,6 +699,7 @@ QUnit.module('relational_fields', {
|
||||
assert.strictEqual(count, 8, 'no more RPC should have been done');
|
||||
assert.strictEqual(form.$('.o_kanban_record:not(".o_kanban_ghost")').length, 2,
|
||||
'one2many kanban should contain 2 cards for record 1 at page 2');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('sorting one2many fields', function (assert) {
|
||||
@@ -734,6 +747,7 @@ QUnit.module('relational_fields', {
|
||||
assert.ok(form.$('table tbody tr:eq(2) td:contains(abc)').length,
|
||||
"the 3rd record is the one with 'abc' value");
|
||||
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('one2many list field edition', function (assert) {
|
||||
@@ -794,6 +808,7 @@ QUnit.module('relational_fields', {
|
||||
// data isn't reloaded when clicking on save (it doesn't work for now actually)
|
||||
assert.strictEqual(form.$('.o_field_one2many tbody td').first().text(), 'new value',
|
||||
"display name of first record in o2m list should be 'new value'");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('one2many list: create action disabled', function (assert) {
|
||||
@@ -819,6 +834,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
|
||||
'"Add an item" link should not be available in readonly');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('one2many list: deleting one record', function (assert) {
|
||||
@@ -865,6 +881,7 @@ QUnit.module('relational_fields', {
|
||||
// FIXME: it would be nice to test that the view is re-rendered correctly,
|
||||
// but as the relational data isn't re-fetched, the rendering is ok even
|
||||
// if the changes haven't been saved
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('one2many kanban: edition', function (assert) {
|
||||
@@ -948,6 +965,7 @@ QUnit.module('relational_fields', {
|
||||
'should contain 1 records');
|
||||
assert.strictEqual(form.$('.o_kanban_record span').text(), 'new subrecord 3',
|
||||
'the remaining subrecord should be "new subrecord 3"');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('one2many kanban: create action disabled', function (assert) {
|
||||
@@ -985,6 +1003,7 @@ QUnit.module('relational_fields', {
|
||||
'"Add" button should not be available in edit');
|
||||
assert.ok(form.$('.o_kanban_view .delete_icon').length,
|
||||
'delete icon should be visible in edit');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('one2many list (non editable): edition', function (assert) {
|
||||
@@ -1041,6 +1060,7 @@ QUnit.module('relational_fields', {
|
||||
'should contain 1 subrecord');
|
||||
assert.strictEqual(form.$('.o_list_view tbody td:first()').text(), 'aaa',
|
||||
'the remaining subrecord should be "aaa"');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('one2many list (editable): edition', function (assert) {
|
||||
@@ -1093,6 +1113,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
// create new subrecords
|
||||
// TODO when 'Add an item' will be implemented
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('onchange in a one2many', function (assert) {
|
||||
@@ -1135,6 +1156,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
assert.strictEqual(form.$('.o_field_one2many tbody td').first().text(), 'from onchange',
|
||||
"display name of first record in o2m list should be 'new value'");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('one2many, default_get and onchange (basic)', function (assert) {
|
||||
@@ -1169,6 +1191,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
assert.ok(form.$('td:contains(from onchange)').length,
|
||||
"should have 'from onchange' value in one2many");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('one2many list (editable): readonly domain is evaluated', function (assert) {
|
||||
@@ -1200,6 +1223,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
assert.notOk(form.$('.o_list_view tbody tr:eq(1) td:first').hasClass('o_readonly'),
|
||||
"second record should not have display_name in readonly mode");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('pager of one2many field in new record', function (assert) {
|
||||
@@ -1234,6 +1258,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
assert.ok(!form.$('.o_x2m_control_panel .o_cp_pager div').is(':visible'),
|
||||
'o2m pager should be hidden');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('one2many list with a many2one', function (assert) {
|
||||
@@ -1297,6 +1322,7 @@ QUnit.module('relational_fields', {
|
||||
"should display 'xpad' on a td");
|
||||
assert.strictEqual(form.$('tbody td:contains(xphone)').length, 1,
|
||||
"should still display xphone");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('one2many list with inline form view', function (assert) {
|
||||
@@ -1357,6 +1383,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
// save the record
|
||||
form.$buttons.find('.o_form_button_save').click();
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('one2many list with inline form view with context with parent key', function (assert) {
|
||||
@@ -1400,6 +1427,8 @@ QUnit.module('relational_fields', {
|
||||
|
||||
// write in the many2one field
|
||||
$('.modal .o_form_field_many2one input').click();
|
||||
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('one2many list edition, some basic functionality', function (assert) {
|
||||
@@ -1437,6 +1466,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
assert.strictEqual(form.$('td:contains(abc)').length, 1,
|
||||
"should have a row with the correct value");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('one2many list, the context is properly evaluated and sent', function (assert) {
|
||||
@@ -1467,6 +1497,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
form.$buttons.find('.o_form_button_edit').click();
|
||||
form.$('tbody td.o_form_field_x2many_list_row_add a').click();
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('new record, the context is properly evaluated and sent', function (assert) {
|
||||
@@ -1502,6 +1533,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
form.$buttons.find('.o_form_button_edit').click();
|
||||
form.$('tbody td.o_form_field_x2many_list_row_add a').click();
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('parent data is properly sent on an onchange rpc', function (assert) {
|
||||
@@ -1533,6 +1565,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
form.$buttons.find('.o_form_button_edit').click();
|
||||
form.$('tbody td.o_form_field_x2many_list_row_add a').click();
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('parent data is properly sent on an onchange rpc, new record', function (assert) {
|
||||
@@ -1563,6 +1596,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
form.$buttons.find('.o_form_button_edit').click();
|
||||
form.$('tbody td.o_form_field_x2many_list_row_add a').click();
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('sub form view with a required field', function (assert) {
|
||||
@@ -1594,6 +1628,7 @@ QUnit.module('relational_fields', {
|
||||
assert.strictEqual($('.modal').length, 1, "should still have an open modal");
|
||||
assert.strictEqual($('.modal tbody label.o_form_invalid').length, 1,
|
||||
"should have displayed invalid fields");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
|
||||
@@ -1736,6 +1771,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
// save the record
|
||||
form.$buttons.find('.o_form_button_save').click();
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('many2many kanban: create action disabled', function (assert) {
|
||||
@@ -1769,7 +1805,6 @@ QUnit.module('relational_fields', {
|
||||
},
|
||||
res_id: 1,
|
||||
session: {user_context: {}},
|
||||
manualDestroy: true,
|
||||
});
|
||||
|
||||
assert.ok(!form.$('.o-kanban-button-new').length,
|
||||
@@ -1844,6 +1879,7 @@ QUnit.module('relational_fields', {
|
||||
'should contain 1 subrecord');
|
||||
assert.strictEqual(form.$('.o_list_view tbody td:first()').text(), 'silver',
|
||||
'the remaining subrecord should be "aaa"');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('many2many list (editable): edition', function (assert) {
|
||||
@@ -1907,6 +1943,7 @@ QUnit.module('relational_fields', {
|
||||
'should contain 1 subrecord');
|
||||
assert.strictEqual(form.$('.o_list_view tbody td:first()').text(), 'silver',
|
||||
'the remaining subrecord should be "aaa"');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('many2many list: create action disabled', function (assert) {
|
||||
@@ -1935,6 +1972,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
// TODO: click on add an item and test that the select create dialog has no 'Create' button
|
||||
// form.$('.o_form_field_x2many_list_row_add').click();
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.module('FieldStatus');
|
||||
@@ -1976,6 +2014,7 @@ QUnit.module('relational_fields', {
|
||||
assert.ok(form.$('.o_statusbar_status button[data-value="4"]').hasClass('btn-primary'),
|
||||
"selected status should be btn-primary");
|
||||
// TODO: add a test to check that we can change the status
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('clickable statusbar widget on many2one field', function (assert) {
|
||||
@@ -1995,6 +2034,7 @@ QUnit.module('relational_fields', {
|
||||
"selected status should be btn-primary and disabled");
|
||||
assert.strictEqual(form.$('.o_statusbar_status button.btn-default:not(.disabled)').length, 2,
|
||||
"other status should be btn-default and not disabled");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('statusbar with no status', function (assert) {
|
||||
@@ -2015,6 +2055,7 @@ QUnit.module('relational_fields', {
|
||||
'statusbar widget should have class o_form_field_empty');
|
||||
assert.strictEqual(form.$('.o_statusbar_status').children().length, 0,
|
||||
'statusbar widget should be empty');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.module('FieldSelection');
|
||||
@@ -2043,6 +2084,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
assert.strictEqual($td.find('select').length, 1, "td should have a child 'select'");
|
||||
assert.strictEqual($td.contents().length, 1, "select tag should be only child of td");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('widget selection on a many2one field', function (assert) {
|
||||
@@ -2077,6 +2119,7 @@ QUnit.module('relational_fields', {
|
||||
count = 0;
|
||||
form.reload();
|
||||
assert.strictEqual(count, 1, "should not reload product_id relation");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.module('FieldMany2ManyTags');
|
||||
@@ -2151,6 +2194,7 @@ QUnit.module('relational_fields', {
|
||||
// TODO: it would be nice to test the behaviors of the autocomplete dropdown
|
||||
// (like refining the research, creating new tags...), but ui-autocomplete
|
||||
// makes it difficult to test
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('fieldmany2many tags in a new record', function (assert) {
|
||||
@@ -2187,6 +2231,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
// save the record (should do the write RPC with the correct commands)
|
||||
form.$buttons.find('.o_form_button_save').click();
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('fieldmany2many tags: update color', function (assert) {
|
||||
@@ -2215,6 +2260,7 @@ QUnit.module('relational_fields', {
|
||||
$('.o_colorpicker span[data-color="6"]').trigger('mousedown'); // choose color 6
|
||||
assert.strictEqual(form.$('span:first()').data('color'), 6,
|
||||
'should have correctly updated the color (in edit)');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.module('FieldRadio');
|
||||
@@ -2244,6 +2290,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
var newRecord = _.last(this.data.partner.records);
|
||||
assert.strictEqual(newRecord.product_id, 37, "should have saved record with correct value");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('fieldradio widget on a selection in a new record', function (assert) {
|
||||
@@ -2270,6 +2317,7 @@ QUnit.module('relational_fields', {
|
||||
|
||||
var newRecord = _.last(this.data.partner.records);
|
||||
assert.strictEqual(newRecord.color, 'black', "should have saved record with correct value");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.module('FieldMany2ManyCheckBoxes');
|
||||
@@ -2309,6 +2357,7 @@ QUnit.module('relational_fields', {
|
||||
assert.deepEqual(this.data.partner.records[0].timmy, [12, 14],
|
||||
"should have added the second element to the many2many");
|
||||
|
||||
form.destroy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -91,13 +91,11 @@ function createView(params) {
|
||||
* @param {any[]} [params.domain] the initial domain for the view
|
||||
* @param {Object} [params.context] the initial context for the view
|
||||
* @param {Object} [params.debug=false] if true, the widget will be appended in
|
||||
* the DOM, will not be destroyed, and following tests will not be run. Also,
|
||||
* the logLevel will be forced to 2 and the uncaught OdooEvent will be logged
|
||||
* the DOM. Also, the logLevel will be forced to 2 and the uncaught OdooEvent
|
||||
* will be logged
|
||||
* @param {string[]} [params.groupBy] the initial groupBy for the view
|
||||
* @param {AbstractView} params.View the class that will be instantiated
|
||||
* @param {string} params.model a model name, will be given to the view
|
||||
* @param {boolean} params.manualDestroy if true, the widget will not be
|
||||
* automatically destroyed
|
||||
* @param {Object} params.intercepts an object with event names as key, and
|
||||
* callback as value. Each key,value will be used to intercept the event.
|
||||
* Note that this is particularly useful if you want to intercept events going
|
||||
@@ -106,15 +104,12 @@ function createView(params) {
|
||||
* @returns {Deferred<AbstractView>} resolves with the instance of the view
|
||||
*/
|
||||
function createAsyncView(params) {
|
||||
_checkParamSafety(params);
|
||||
|
||||
var $target = $('#qunit-fixture');
|
||||
var widget = new Widget();
|
||||
|
||||
if (params.debug) {
|
||||
$target = $('body');
|
||||
params.logLevel = 2;
|
||||
params.manualDestroy = true;
|
||||
observe(widget);
|
||||
var separator = window.location.href.indexOf('?') !== -1 ? "&" : "?";
|
||||
var url = window.location.href + separator + 'testId=' + QUnit.config.current.testId;
|
||||
@@ -168,11 +163,6 @@ function createAsyncView(params) {
|
||||
view.$el.on('click', 'a', function (ev) {
|
||||
ev.preventDefault();
|
||||
});
|
||||
if (!params.manualDestroy) {
|
||||
setTimeout(function () {
|
||||
view.destroy();
|
||||
}, 50);
|
||||
}
|
||||
}).then(function () {
|
||||
var $buttons = $('<div>');
|
||||
view.renderButtons($buttons);
|
||||
@@ -307,17 +297,10 @@ function addMockEnvironment(widget, params) {
|
||||
}
|
||||
|
||||
/**
|
||||
* create a model from given parameters. Unless manualDestroy is specified, the
|
||||
* created model will be automatically destroyed after 50ms.
|
||||
*
|
||||
* Note that it is unsafe to mock the session and to let the automatic destroy
|
||||
* feature on, because that would mean that the next tests will be run in an
|
||||
* environment with the mocked session.
|
||||
* create a model from given parameters.
|
||||
*
|
||||
* @param {Object} params This object will be given to addMockEnvironment, so
|
||||
* any parameters from that method applies
|
||||
* @param {boolean} params.manualDestroy if true, the widget will not be
|
||||
* automatically destroyed
|
||||
* @param {Class} params.Model the model class to use
|
||||
* @param {string[]} [params.fieldNames] the fields given to the model
|
||||
* @param {Object[]} [params.fields] map of field names to field description
|
||||
@@ -325,7 +308,6 @@ function addMockEnvironment(widget, params) {
|
||||
* @returns {Model}
|
||||
*/
|
||||
function createModel(params) {
|
||||
_checkParamSafety(params);
|
||||
var widget = new Widget();
|
||||
|
||||
var model = new params.Model(widget, {
|
||||
@@ -336,30 +318,9 @@ function createModel(params) {
|
||||
|
||||
addMockEnvironment(widget, params);
|
||||
|
||||
if (!params.manualDestroy) {
|
||||
setTimeout(function () {
|
||||
widget.destroy();
|
||||
}, 50);
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
* We need to disallow modifying the session/translate parameters and destroying
|
||||
* automatically a widget. So, we throw an error to make sure everything fails.
|
||||
*
|
||||
* @param {Object} params
|
||||
*/
|
||||
function _checkParamSafety(params) {
|
||||
if ('session' in params && !params.manualDestroy) {
|
||||
throw new Error("Modifying the session is unsafe if the view is not manually destroyed");
|
||||
}
|
||||
if ('translateParameters' in params && !params.manualDestroy) {
|
||||
throw new Error("Modifying the translate parameters is unsafe if the view is not manually destroyed");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* simulate a drag and drop operation between 2 jquery nodes: $el and $to.
|
||||
* This is a crude simulation, with only the mousedown, mousemove and mouseup
|
||||
|
||||
@@ -82,6 +82,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(record.data.foo, "gnap", "should correctly read value");
|
||||
assert.strictEqual(record.data.bar, undefined, "should not fetch the field 'bar'");
|
||||
});
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('notify change with many2one', function (assert) {
|
||||
@@ -102,6 +103,7 @@ QUnit.module('Views', {
|
||||
record = model.get(resultID);
|
||||
assert.strictEqual(record.data.qux.data.id, 1, "qux field should be 1");
|
||||
});
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('write on a many2one', function (assert) {
|
||||
@@ -138,6 +140,7 @@ QUnit.module('Views', {
|
||||
"should have really saved the data");
|
||||
assert.strictEqual(rpcCount, 3, "should have done 3 rpc: 1 read, 1 write, 1 read");
|
||||
});
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('basic onchange', function (assert) {
|
||||
@@ -174,6 +177,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(record.data.foo, 'mary poppins', "onchange has been applied");
|
||||
assert.strictEqual(record.data.bar, 12, "onchange has been applied");
|
||||
});
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('onchange with a many2one', function (assert) {
|
||||
@@ -213,7 +217,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(record.data.foo, 'space lollipop', "onchange has been applied");
|
||||
assert.strictEqual(rpcCount, 2, "should have done 2 rpc: 1 read and 1 onchange");
|
||||
});
|
||||
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('notifyChange on a many2one, without display_name', function (assert) {
|
||||
@@ -243,7 +247,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(record.data.product_id.data.display_name, 'xphone',
|
||||
"display_name should have been fetched");
|
||||
});
|
||||
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('onchange on a char with an unchanged many2one', function (assert) {
|
||||
@@ -271,6 +275,7 @@ QUnit.module('Views', {
|
||||
var record = model.get(resultID);
|
||||
assert.strictEqual(record.data.foo, 'cookie alligator', "onchange has been applied");
|
||||
});
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('onchange on a char with another many2one not set to a value', function (assert) {
|
||||
@@ -296,6 +301,7 @@ QUnit.module('Views', {
|
||||
record = model.get(resultID);
|
||||
assert.strictEqual(record.data.foo, 'cookie alligator', "onchange has been applied");
|
||||
});
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('can get a many2many', function (assert) {
|
||||
@@ -319,6 +325,7 @@ QUnit.module('Views', {
|
||||
assert.deepEqual(record.data.category, [12],
|
||||
"with option raw, category should only return ids");
|
||||
});
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('can fetch a list', function (assert) {
|
||||
@@ -347,6 +354,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(record.data[0].data.foo, 'blip', "first record should have 'blip' in foo field");
|
||||
assert.strictEqual(rpcCount, 1, "should have done 1 rpc (searchread)");
|
||||
});
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('fetch x2manys in list, with not too many rpcs', function (assert) {
|
||||
@@ -377,8 +385,7 @@ QUnit.module('Views', {
|
||||
"first record should have 2 categories loaded");
|
||||
assert.strictEqual(rpcCount, 2, "should have done 2 rpc (searchread and read category)");
|
||||
});
|
||||
|
||||
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('can make a default_record, no onchange', function (assert) {
|
||||
@@ -399,6 +406,7 @@ QUnit.module('Views', {
|
||||
assert.deepEqual(record.data.product_ids.data, [], "o2m default should be []");
|
||||
assert.deepEqual(record.data.category.data, [], "m2m default should be []");
|
||||
});
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('default_record, with onchange on many2one', function (assert) {
|
||||
@@ -427,6 +435,7 @@ QUnit.module('Views', {
|
||||
var record = model.get(resultID);
|
||||
assert.strictEqual(record.data.product_id, false, "m2o default value should be false");
|
||||
});
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('default record: batch namegets on same model and res_id', function (assert) {
|
||||
@@ -461,7 +470,7 @@ QUnit.module('Views', {
|
||||
"should have fetched correct name");
|
||||
assert.strictEqual(rpcCount, 2, "should have done 2 rpcs: default_get and 1 name_get");
|
||||
});
|
||||
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('undoing a change makes the record not dirty', function (assert) {
|
||||
@@ -483,6 +492,7 @@ QUnit.module('Views', {
|
||||
model.notifyChanges(resultID, {foo: "gnap"});
|
||||
assert.ok(!model.isDirty(resultID), "record should not be dirty");
|
||||
});
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('isDirty works correctly on list made empty', function (assert) {
|
||||
@@ -507,6 +517,7 @@ QUnit.module('Views', {
|
||||
}});
|
||||
assert.ok(model.isDirty(resultID), "record should be considered dirty");
|
||||
});
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('can duplicate a record', function (assert) {
|
||||
@@ -530,8 +541,8 @@ QUnit.module('Views', {
|
||||
"record should have been duplicated");
|
||||
assert.strictEqual(duplicate.data.foo, "gnap", "foo should be set to correct value");
|
||||
});
|
||||
|
||||
});
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('record with many2one set to some value, then set it to none', function (assert) {
|
||||
@@ -558,6 +569,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(self.data.partner.records[1].product_id, false,
|
||||
"should have saved the new product_id value");
|
||||
});
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('groups stay open when reloading', function (assert) {
|
||||
@@ -588,6 +600,7 @@ QUnit.module('Views', {
|
||||
assert.ok(record.data[0].isOpen, "first group should still be open");
|
||||
assert.strictEqual(record.data[0].data.length, 1, "first group should still have one record");
|
||||
});
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('create record, then save', function (assert) {
|
||||
@@ -622,7 +635,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(record.res_id, id, "should have correct id from server");
|
||||
assert.strictEqual(record.data.id, id, "should have correct id from server");
|
||||
});
|
||||
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
|
||||
@@ -667,7 +680,7 @@ QUnit.module('Views', {
|
||||
|
||||
model.save(record.id);
|
||||
});
|
||||
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('onchange with a one2many on a new record', function (assert) {
|
||||
@@ -715,7 +728,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(record.data.product_ids.data[0].data.name, "xpod",
|
||||
"one2many should have correct data");
|
||||
});
|
||||
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('dates are properly loaded and parsed (record)', function (assert) {
|
||||
@@ -746,6 +759,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(record.data.date, false,
|
||||
"unset date field should be false");
|
||||
});
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('dates are properly loaded and parsed (list)', function (assert) {
|
||||
@@ -772,6 +786,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(secondRecord.data.date, false,
|
||||
"if date is not set, it should be false");
|
||||
});
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('dates are properly loaded and parsed (default_get)', function (assert) {
|
||||
@@ -792,6 +807,7 @@ QUnit.module('Views', {
|
||||
var record = model.get(resultID);
|
||||
assert.strictEqual(record.data.date, false, "date default value should be false");
|
||||
});
|
||||
model.destroy();
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -214,6 +214,7 @@ QUnit.module('Views', {
|
||||
assert.ok($('.modal button.btn:contains(Ok)').length, "should display the confirm message");
|
||||
$('.modal button.btn:contains(Ok)').trigger('click');
|
||||
assert.strictEqual($sidebar.find('.o_calendar_filter:has(h3:contains(attendees)) .o_calendar_filter_item').length, 3, "click on remove then should display 3 filter items for 'attendees'");
|
||||
calendar.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('create and change events', function (assert) {
|
||||
@@ -309,7 +310,7 @@ QUnit.module('Views', {
|
||||
calendar.$buttons.find('.o_calendar_button_next').click();
|
||||
|
||||
assert.strictEqual(calendar.$('.fc-event-container .fc-event').length, 0, "should display 0 events");
|
||||
|
||||
calendar.destroy();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -151,12 +151,13 @@ QUnit.module('Views', {
|
||||
"title should be display_name of record");
|
||||
assert.strictEqual(form.$('label.o_form_label_empty:contains(timmy)').length, 0,
|
||||
"the many2many label shouldn't be marked as empty");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('only necessary fields are fetched', function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
createView({
|
||||
var form = createView({
|
||||
View: FormView,
|
||||
model: 'partner',
|
||||
data: this.data,
|
||||
@@ -172,6 +173,7 @@ QUnit.module('Views', {
|
||||
return this._super(route, args);
|
||||
}
|
||||
});
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('group rendering', function (assert) {
|
||||
@@ -193,6 +195,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(form.$('table.o_inner_group').length, 1,
|
||||
"should contain an inner group");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('invisible fields are not rendered', function (assert) {
|
||||
@@ -220,6 +223,7 @@ QUnit.module('Views', {
|
||||
"should not contain span with field value");
|
||||
assert.strictEqual(form.$('.o_form_field.o_form_invisible:contains(0.4)').length, 1,
|
||||
"field qux should be invisible");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('invisible elements are properly hidden', function (assert) {
|
||||
@@ -251,6 +255,7 @@ QUnit.module('Views', {
|
||||
"should not display tab invisible");
|
||||
assert.strictEqual(form.$('table.o_inner_group.o_form_invisible td:contains(invgroup)').length, 1,
|
||||
"should not display invisible groups");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('invisible attrs are re-evaluated on field changed', function (assert) {
|
||||
@@ -284,6 +289,7 @@ QUnit.module('Views', {
|
||||
form.$('.o_form_field_many2one input').click();
|
||||
$dropdown.find('li:first()').click();
|
||||
assert.ok(!form.$('.foo_field').hasClass('o_form_invisible'), 'should not display foo field');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('invisible attrs on first notebook page', function (assert) {
|
||||
@@ -327,6 +333,7 @@ QUnit.module('Views', {
|
||||
'second tab should be active');
|
||||
assert.ok(form.$('.o_notebook .tab-content .tab-pane:nth(1)').hasClass('active'),
|
||||
'second page should be active');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('rendering stat buttons', function (assert) {
|
||||
@@ -365,6 +372,7 @@ QUnit.module('Views', {
|
||||
});
|
||||
form.$('.oe_stat_button').first().click();
|
||||
assert.strictEqual(count, 1, "should have triggered a execute action");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
|
||||
@@ -388,6 +396,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(form.$('label.o_form_label:contains(customstring)').length, 1,
|
||||
"should have 1 label with correct string");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
|
||||
@@ -426,6 +435,7 @@ QUnit.module('Views', {
|
||||
"in edit mode, only readonly fields should have .o_form_field_empty class");
|
||||
assert.strictEqual(form.$('.o_form_label_empty').length, 1,
|
||||
"in edit mode, only readonly fields should have .o_form_label_empty class");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('empty inner readonly fields don\'t have o_form_empty class in "create" mode', function (assert) {
|
||||
@@ -450,6 +460,7 @@ QUnit.module('Views', {
|
||||
"no empty class on label");
|
||||
assert.strictEqual(form.$('.o_form_field_empty').length, 0,
|
||||
"no empty class on field");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('form view can switch to edit mode', function (assert) {
|
||||
@@ -486,6 +497,7 @@ QUnit.module('Views', {
|
||||
'readonly buttons should not be visible');
|
||||
assert.ok(form.$buttons.find('.o_form_buttons_edit').is(':visible'),
|
||||
'edit buttons should be visible');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('required fields should have o_form_required in readonly mode', function (assert) {
|
||||
@@ -512,6 +524,7 @@ QUnit.module('Views', {
|
||||
form.$buttons.find('.o_form_button_edit').click();
|
||||
assert.strictEqual(form.$('input.o_form_required').length, 1,
|
||||
"in edit mode, should have 1 input with o_form_required");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('separators', function (assert) {
|
||||
@@ -534,6 +547,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(form.$('div.o_horizontal_separator').length, 1,
|
||||
"should contain a separator div");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('buttons in form view', function (assert) {
|
||||
@@ -589,6 +603,7 @@ QUnit.module('Views', {
|
||||
form.$('.o_form_statusbar button.s').click();
|
||||
|
||||
assert.strictEqual(rpcCount, 2, "should have done 1 rpcs to reload");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
|
||||
@@ -627,6 +642,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(rpcCount, 3,
|
||||
"should have done 3 rpcs: 1 create, 1 read (before _callButtonAction, and 1 read (after)");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('change and save char', function (assert) {
|
||||
@@ -660,6 +676,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(form.mode, 'readonly', 'form view should be in readonly mode');
|
||||
assert.strictEqual(form.$('span:contains(tralala)').length, 1,
|
||||
"should contain span with field value");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('properly reload data from server', function (assert) {
|
||||
@@ -686,6 +703,7 @@ QUnit.module('Views', {
|
||||
form.$buttons.find('.o_form_button_save').click();
|
||||
assert.strictEqual(form.$('span:contains(apple)').length, 1,
|
||||
"should contain span with field value");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('properly apply onchange in simple case', function (assert) {
|
||||
@@ -715,6 +733,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(form.$('input').eq(1).val(), "1007",
|
||||
"should contain input with onchange applied");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('evaluate in python field options', function (assert) {
|
||||
@@ -728,7 +747,7 @@ QUnit.module('Views', {
|
||||
}
|
||||
return tmp.apply(tmp, arguments);
|
||||
};
|
||||
createView({
|
||||
var form = createView({
|
||||
View: FormView,
|
||||
model: 'partner',
|
||||
data: this.data,
|
||||
@@ -741,6 +760,7 @@ QUnit.module('Views', {
|
||||
py.eval = tmp;
|
||||
|
||||
assert.ok(isOk, "should have evaluated the field options");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('can create a record with default values', function (assert) {
|
||||
@@ -770,6 +790,7 @@ QUnit.module('Views', {
|
||||
form.$buttons.find('.o_form_button_save').click();
|
||||
assert.strictEqual(form.mode, 'readonly', 'form view should be in readonly mode');
|
||||
assert.strictEqual(this.data.partner.records.length, n + 1, "should have created a record");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('sidebar is hidden when switching to edit mode', function (assert) {
|
||||
@@ -793,6 +814,7 @@ QUnit.module('Views', {
|
||||
assert.ok(form.sidebar.$el.hasClass('o_hidden'), 'sidebar should be invisible');
|
||||
form.$buttons.find('.o_form_button_cancel').click();
|
||||
assert.ok(!form.sidebar.$el.hasClass('o_hidden'), 'sidebar should be visible');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('basic default record', function (assert) {
|
||||
@@ -816,6 +838,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(form.$('input').val(), "default foo value", "should have correct default");
|
||||
assert.strictEqual(count, 1, "should do only one rpc");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
|
||||
@@ -856,6 +879,7 @@ QUnit.module('Views', {
|
||||
assert.ok(form.$('td:contains(xphone)').length,
|
||||
"should have a cell with the name field 'product_id', set to xphone");
|
||||
assert.strictEqual(nameGetCount, 1, "should have done only 1 nameget");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('make default record with non empty many2one', function (assert) {
|
||||
@@ -885,6 +909,7 @@ QUnit.module('Views', {
|
||||
assert.ok(form.$('.o_form_input').val(), 'aaa',
|
||||
'default value should be correctly displayed');
|
||||
assert.strictEqual(nameGetCount, 1, 'should have done one name_get');
|
||||
form.destroy();
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -907,6 +932,7 @@ QUnit.module('Views', {
|
||||
form.$buttons.find('.o_form_button_create').click();
|
||||
assert.strictEqual(form.get('title'), _t("New"),
|
||||
"should have the display name of the record as title");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('can duplicate a record', function (assert) {
|
||||
@@ -931,6 +957,7 @@ QUnit.module('Views', {
|
||||
"should have duplicated the record");
|
||||
|
||||
assert.strictEqual(form.mode, "edit", 'should be in edit mode');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('buttons in footer are moved to $buttons if required', function (assert) {
|
||||
@@ -953,6 +980,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.ok(form.$buttons.find('button.infooter').length, "footer button should be in footer");
|
||||
assert.ok(!form.$('button.infooter').length, "footer button should not be in form");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('clicking on stat buttons in edit mode', function (assert) {
|
||||
@@ -1001,6 +1029,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(form.mode, "readonly", "form view should be in readonly mode");
|
||||
assert.strictEqual(count, 2, "should have triggered a execute action");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('buttons with attr "special" do not trigger a save', function (assert) {
|
||||
@@ -1046,6 +1075,7 @@ QUnit.module('Views', {
|
||||
form.$('button').eq(1).click();
|
||||
assert.strictEqual(writeCount, 1, "should not have triggered a write");
|
||||
assert.strictEqual(executeActionCount, 2, "should have triggered a execute action");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('missing widgets do not crash', function (assert) {
|
||||
@@ -1062,6 +1092,7 @@ QUnit.module('Views', {
|
||||
res_id: 1,
|
||||
});
|
||||
assert.strictEqual(form.$('.o_field_widget').length, 1, "should have rendered an abstract field");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('nolabel', function (assert) {
|
||||
@@ -1099,6 +1130,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(form.$('.secondgroup tr:first td').length, 2,
|
||||
"product_id field should be on its own tr");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('many2one in a one2many', function (assert) {
|
||||
@@ -1122,6 +1154,7 @@ QUnit.module('Views', {
|
||||
});
|
||||
assert.strictEqual(form.$('td:contains(xphone)').length, 1,
|
||||
"should display the name of the many2one");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('discard changes on a non dirty form view', function (assert) {
|
||||
@@ -1152,6 +1185,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(form.$('.o_form_field').text(), 'yop', 'field in readonly should display yop');
|
||||
|
||||
assert.strictEqual(nbWrite, 0, 'no write RPC should have been done');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('discard changes on a dirty form view', function (assert) {
|
||||
@@ -1191,6 +1225,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(form.$('.o_form_field').text(), 'yop', 'field in readonly should display yop');
|
||||
|
||||
assert.strictEqual(nbWrite, 0, 'no write RPC should have been done');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('switching to another record from a dirty one', function (assert) {
|
||||
@@ -1241,6 +1276,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(form.pager.$el.find('.o_pager_value').text(), "2", 'pager value should be 2');
|
||||
|
||||
assert.strictEqual(nbWrite, 0, 'no write RPC should have been done');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('restore local state when switching to another record', function (assert) {
|
||||
@@ -1282,6 +1318,7 @@ QUnit.module('Views', {
|
||||
"first tab should not be active");
|
||||
assert.ok(form.$('.o_notebook li:eq(1)').hasClass('active'),
|
||||
"second tab should be active");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('pager is hidden in create mode', function (assert) {
|
||||
@@ -1316,6 +1353,7 @@ QUnit.module('Views', {
|
||||
"current pager value should be 3");
|
||||
assert.strictEqual(form.pager.$('.o_pager_limit').text(), "3",
|
||||
"current pager limit should be 3");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('switching to another record, in readonly mode', function (assert) {
|
||||
@@ -1348,6 +1386,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(form.mode, 'readonly', 'form view should be in readonly mode');
|
||||
|
||||
assert.strictEqual(pushStateCount, 2, "should have triggered 2 push_state");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('modifiers are reevaluated when creating new record', function (assert) {
|
||||
@@ -1378,6 +1417,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.ok(form.$('input.foo_field').is(':visible'),
|
||||
"foo field should be visible");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('empty readonly fields are visible on new records', function (assert) {
|
||||
@@ -1406,6 +1446,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(form.$('.o_form_field_empty').length, 0,
|
||||
'readonly field should be visible on a new record');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
|
||||
@@ -1433,6 +1474,7 @@ QUnit.module('Views', {
|
||||
"inner groups should have classname 'o_group_col_6'");
|
||||
assert.ok(form.$('.inner_div').hasClass('o_group_col_6'),
|
||||
"divs inside groups should have classname 'o_group_col_6'");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('deleting a record', function (assert) {
|
||||
@@ -1470,6 +1512,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(form.pager.$('.o_pager_limit').text(), "2", 'pager limit should be 2');
|
||||
assert.strictEqual(form.$('span:contains(blip)').length, 1,
|
||||
'should have a field with foo value for record 2');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('empty required fields cannot be saved', function (assert) {
|
||||
@@ -1505,6 +1548,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(form.$('.o_form_invalid').length, 0,
|
||||
"nothing should be marked as invalid");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('changes in a readonly form view are saved directly', function (assert) {
|
||||
@@ -1557,6 +1601,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(nbWrite, 2, 'should not have saved directly');
|
||||
assert.strictEqual(form.$('.o_priority .fa-star').length, 2,
|
||||
'priority widget should have correct value');
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('display a dialog if onchange result is a warning', function (assert) {
|
||||
@@ -1594,6 +1639,7 @@ QUnit.module('Views', {
|
||||
"should have rendered a modal dialog with correct title");
|
||||
assert.strictEqual($('.modal .modal-body:contains(You must first select a partner)').length, 1,
|
||||
"should have rendered a modal dialog with correct content");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('attrs are properly transmitted to new records', function (assert) {
|
||||
@@ -1630,6 +1676,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(form.$('.o_stat_text.o_not_hover:contains(Test Environment)').length, 1,
|
||||
"button should contain correct string");
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
});});
|
||||
|
||||
@@ -75,6 +75,7 @@ QUnit.module('Views', {
|
||||
"should contain a div with a svg element");
|
||||
|
||||
assert.strictEqual(graph.renderer.state.mode, "bar", "should be in bar chart mode by default");
|
||||
graph.destroy();
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -92,6 +93,7 @@ QUnit.module('Views', {
|
||||
'</graph>',
|
||||
});
|
||||
assert.strictEqual(graph.renderer.state.mode, "pie", "should be in pie chart mode by default");
|
||||
graph.destroy();
|
||||
});
|
||||
|
||||
|
||||
@@ -117,6 +119,7 @@ QUnit.module('Views', {
|
||||
'line type button should not be active');
|
||||
assert.ok(graph.$buttons.find('button[data-mode="bar"]').hasClass('active'),
|
||||
'bar type button should be active');
|
||||
graph.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('displaying line chart with only 1 data point', function (assert) {
|
||||
@@ -138,6 +141,7 @@ QUnit.module('Views', {
|
||||
return concurrency.delay(0).then(function () {
|
||||
assert.ok(!graph.$('svg').length, "should not have a svg");
|
||||
assert.ok(graph.$('.oe_view_nocontent').length, "should have an error message");
|
||||
graph.destroy();
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -159,7 +163,6 @@ QUnit.module('Views', {
|
||||
rpcCount++;
|
||||
return this._super(route, args);
|
||||
},
|
||||
manualDestroy: true,
|
||||
});
|
||||
return concurrency.delay(0).then(function () {
|
||||
assert.ok(graph.$('text.nv-legend-text:contains(Count)').length,
|
||||
@@ -190,7 +193,6 @@ QUnit.module('Views', {
|
||||
arch: '<graph string="Gloups">' +
|
||||
'<field name="product_id"/>' +
|
||||
'</graph>',
|
||||
manualDestroy: true,
|
||||
});
|
||||
return concurrency.delay(0).then(function () {
|
||||
assert.ok(graph.$('div.o_graph_svg_container svg.nvd3-svg').length,
|
||||
@@ -219,7 +221,6 @@ QUnit.module('Views', {
|
||||
arch: '<graph string="Gloups">' +
|
||||
'<field name="product_id"/>' +
|
||||
'</graph>',
|
||||
manualDestroy: true,
|
||||
});
|
||||
return concurrency.delay(0).then(function () {
|
||||
assert.ok(graph.$('text:contains(xphone)').length,
|
||||
|
||||
@@ -119,6 +119,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(nbReadGroups, 1, 'should have done 1 read_group');
|
||||
assert.strictEqual(nbSearchRead, 2, 'should have done 2 search_read');
|
||||
assert.strictEqual(nbNameCreate, 1, 'should have done 1 name_create');
|
||||
model.destroy();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -150,6 +151,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(xphoneGroup.count, 0, 'xphone group has no record anymore');
|
||||
xpadGroup = _.findWhere(state.data, {res_id: 41});
|
||||
assert.strictEqual(xpadGroup.count, 1, 'xpad group still has one record');
|
||||
model.destroy();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(kanban.$('.o_kanban_ghost').length, 6, "should have 6 ghosts");
|
||||
assert.strictEqual(kanban.$('.o_kanban_record:contains(gnap)').length, 1,
|
||||
"should contain gnap");
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('basic grouped rendering', function (assert) {
|
||||
@@ -131,6 +132,7 @@ QUnit.module('Views', {
|
||||
kanban.reload();
|
||||
assert.strictEqual(kanban.$('.o_kanban_group:nth-child(2) .o_kanban_record').length, 3,
|
||||
"column should contain " + 3 + " record(s)");
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('basic grouped rendering with active field', function (assert) {
|
||||
@@ -164,6 +166,7 @@ QUnit.module('Views', {
|
||||
kanban.$('.o_kanban_group:last .o_column_archive').click(); // click on 'Archive'
|
||||
assert.strictEqual(kanban.$('.o_kanban_group:last .o_kanban_record').length, 0,
|
||||
"last column should contain no record");
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('pager should be hidden in grouped mode', function (assert) {
|
||||
@@ -184,6 +187,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.ok(kanban.pager.$el.hasClass('o_hidden'),
|
||||
"pager should be hidden in grouped kanban");
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('pager, ungrouped, with default limit', function (assert) {
|
||||
@@ -206,6 +210,7 @@ QUnit.module('Views', {
|
||||
assert.ok(!kanban.pager.$el.hasClass('o_hidden'),
|
||||
"pager should be visible in ungrouped kanban");
|
||||
assert.strictEqual(kanban.pager.state.size, 4, "pager's size should be 4");
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('pager, ungrouped, with limit given in options', function (assert) {
|
||||
@@ -230,6 +235,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(kanban.pager.state.limit, 2, "pager's limit should be 2");
|
||||
assert.strictEqual(kanban.pager.state.size, 4, "pager's size should be 4");
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('pager, ungrouped, with limit set on arch and given in options', function (assert) {
|
||||
@@ -255,6 +261,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(kanban.pager.state.limit, 3, "pager's limit should be 3");
|
||||
assert.strictEqual(kanban.pager.state.size, 4, "pager's size should be 4");
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('create in grouped on m2o', function (assert) {
|
||||
@@ -285,6 +292,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.ok(kanban.$('span.o_column_title:contains(hello)').length,
|
||||
"should have a column title with a value from the many2one");
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('create in grouped on char', function (assert) {
|
||||
@@ -307,6 +315,7 @@ QUnit.module('Views', {
|
||||
"'yop' column should be the first column");
|
||||
assert.ok(!kanban.$('.o_kanban_view > div:last').hasClass('o_column_quick_create'),
|
||||
"column quick create should be disabled when not grouped by a many2one field)");
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('quick create in grouped mode', function (assert) {
|
||||
@@ -337,6 +346,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(_.last(this.data.partner.records).name, "new partner",
|
||||
"should have correct name");
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('many2manytags are correctly fetched and displayed', function (assert) {
|
||||
@@ -371,6 +381,7 @@ QUnit.module('Views', {
|
||||
'first tag should have color 2');
|
||||
assert.strictEqual(count, 2,
|
||||
'two RPC should have been done(one search read and one read for the m2m');
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('can drag and drop a record from one column to the next', function (assert) {
|
||||
@@ -413,6 +424,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(kanban.$('.o_kanban_group:nth-child(2) .o_kanban_record').length, 3,
|
||||
"column should contain 3 record(s)");
|
||||
assert.strictEqual(kanban.$('.thisiseditable').length, 4, "all records should be editable");
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('kanban view with default_group_by', function (assert) {
|
||||
@@ -458,6 +470,7 @@ QUnit.module('Views', {
|
||||
// simulate an update coming from the searchview, removing the previously set groupby
|
||||
kanban.update({groupBy: []});
|
||||
assert.strictEqual(kanban.$('.o_kanban_group').length, 2, "should have " + 2 + " columns again");
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('kanban view with create=False', function (assert) {
|
||||
@@ -475,6 +488,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.ok(!kanban.$buttons || !kanban.$buttons.find('.o-kanban-button-new').length,
|
||||
"Create button shouldn't be there");
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('clicking on a link triggers correct event', function (assert) {
|
||||
@@ -497,6 +511,7 @@ QUnit.module('Views', {
|
||||
});
|
||||
});
|
||||
kanban.$('a').first().click();
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('create a column in grouped on m2o', function (assert) {
|
||||
@@ -550,6 +565,7 @@ QUnit.module('Views', {
|
||||
assert.ok(!kanban.$('.o_kanban_group:last').hasClass('o_column_folded'),
|
||||
'the created column should not be folded');
|
||||
assert.strictEqual(nbRPCs, 0, 'no rpc should have been done when folding/unfolding');
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('delete a column in grouped on m2o', function (assert) {
|
||||
@@ -621,6 +637,7 @@ QUnit.module('Views', {
|
||||
"should not be able to archive the records");
|
||||
assert.ok(!kanban.$('.o_kanban_header:first .o_kanban_config .o_column_unarchive').length,
|
||||
"should not be able to restore the records");
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('edit a column in grouped on m2o', function (assert) {
|
||||
@@ -681,6 +698,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(kanban.$('.o_kanban_group[data-id=5] .o_column_title').text(), 'ged',
|
||||
'title of the column should be "ged"');
|
||||
assert.strictEqual(nbRPCs, 4, 'should have done 1 write, 1 read_group and 2 search_read');
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('if view was grouped at start, it stays grouped', function (assert) {
|
||||
@@ -701,6 +719,7 @@ QUnit.module('Views', {
|
||||
kanban.update({groupBy: []});
|
||||
|
||||
assert.ok(kanban.$('.o_kanban_view').hasClass('o_kanban_grouped'));
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('if view was not grouped at start, it can be grouped and ungrouped', function (assert) {
|
||||
@@ -722,6 +741,7 @@ QUnit.module('Views', {
|
||||
assert.ok(kanban.$('.o_kanban_view').hasClass('o_kanban_grouped'), "should be grouped");
|
||||
kanban.update({groupBy: []});
|
||||
assert.notOk(kanban.$('.o_kanban_view').hasClass('o_kanban_grouped'), "should not be grouped");
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('no content helper when no data', function (assert) {
|
||||
@@ -765,6 +785,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(kanban.$('.oe_view_nocontent').length, 0,
|
||||
"should not display the no content helper");
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('buttons with modifiers', function (assert) {
|
||||
@@ -795,6 +816,7 @@ QUnit.module('Views', {
|
||||
"kanban should have one buttons of type 1");
|
||||
assert.strictEqual(kanban.$(".o_btn_test_2").length, 3,
|
||||
"kanban should have three buttons of type 2");
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('rendering date and datetime', function (assert) {
|
||||
@@ -824,6 +846,7 @@ QUnit.module('Views', {
|
||||
"should have formatted the date");
|
||||
assert.strictEqual(kanban.$('div.o_kanban_record:contains(Mon Dec 12)').length, 1,
|
||||
"should have formatted the datetime");
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -97,6 +97,7 @@ QUnit.module('Views', {
|
||||
"should not have a visible save button");
|
||||
assert.ok(!list.$buttons.find('.o_list_button_discard').is(':visible'),
|
||||
"should not have a visible save button");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
|
||||
@@ -129,6 +130,7 @@ QUnit.module('Views', {
|
||||
"should have a visible save button");
|
||||
assert.ok(list.$buttons.find('.o_list_button_discard').is(':visible'),
|
||||
"should have a visible discard button");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
|
||||
@@ -147,6 +149,7 @@ QUnit.module('Views', {
|
||||
|
||||
// 1 th for checkbox, 1 for 1 visible column
|
||||
assert.strictEqual(list.$('th').length, 2, "should have 2 th");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('at least 4 rows are rendered, even if less data', function (assert) {
|
||||
@@ -161,6 +164,7 @@ QUnit.module('Views', {
|
||||
});
|
||||
|
||||
assert.strictEqual(list.$('tbody tr').length, 4, "should have 4 rows");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('basic grouped list rendering', function (assert) {
|
||||
@@ -178,6 +182,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(list.$('th:contains(Bar)').length, 1, "should contain Bar");
|
||||
assert.strictEqual(list.$('tr.o_group_header').length, 2, "should have 2 .o_group_header");
|
||||
assert.strictEqual(list.$('th.o_group_name').length, 2, "should have 2 .o_group_name");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('many2one field rendering', function (assert) {
|
||||
@@ -192,6 +197,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.ok(list.$('td:contains(Value 1)').length,
|
||||
"should have the display_name of the many2one");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('grouped list view, with 1 open group', function (assert) {
|
||||
@@ -212,6 +218,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(list.$('td:contains(-4)').length, 1, "should contain -4");
|
||||
assert.strictEqual(list.$('td:contains(10)').length, 1, "should contain 10");
|
||||
assert.strictEqual(list.$('tr.o_group_header td:contains(10)').length, 1, "but 10 should be in a header");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('opening records when clicking on record', function (assert) {
|
||||
@@ -234,6 +241,7 @@ QUnit.module('Views', {
|
||||
list.$('th.o_group_name').first().click();
|
||||
|
||||
list.$('tr:not(.o_group_header) td:not(.o_list_record_selector)').first().click();
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('editable list view: readonly fields cannot be edited', function (assert) {
|
||||
@@ -252,6 +260,7 @@ QUnit.module('Views', {
|
||||
$td.click();
|
||||
assert.ok(!$td.hasClass('o_edit_mode'), "foo cells should not be editable");
|
||||
assert.ok($second_td.hasClass('o_edit_mode'), "bar cells should be editable");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('basic operations for editable list renderer', function (assert) {
|
||||
@@ -271,6 +280,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual($td.hasClass('o_field_dirty'), false, "td should not be dirty");
|
||||
$td.find('input').val('abc').trigger('input');
|
||||
assert.strictEqual($td.hasClass('o_field_dirty'), true, "td should be dirty");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('field changes are triggered correctly', function (assert) {
|
||||
@@ -293,6 +303,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(n, 1, "field_changed should not have been triggered");
|
||||
list.$('td:not(.o_list_record_selector)').eq(2).click();
|
||||
assert.strictEqual(n, 1, "field_changed should have been triggered");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('editable list view: basic char field edition', function (assert) {
|
||||
@@ -317,6 +328,7 @@ QUnit.module('Views', {
|
||||
'saved row should be in readonly mode');
|
||||
assert.strictEqual(this.data.foo.records[0].foo, 'abc',
|
||||
"the edition should have been properly saved");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('selection changes are triggered correctly', function (assert) {
|
||||
@@ -355,6 +367,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(list.$('tbody .o_list_record_selector input:checked').length, 0,
|
||||
"no selection checkbox should be checked");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('aggregates are computed correctly', function (assert) {
|
||||
@@ -379,6 +392,7 @@ QUnit.module('Views', {
|
||||
$thead_selector.click();
|
||||
assert.strictEqual(list.$('tfoot td:nth(2)').text(), "32",
|
||||
"total should be 32 as all records are selected");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('aggregates are computed correctly in grouped lists', function (assert) {
|
||||
@@ -406,6 +420,7 @@ QUnit.module('Views', {
|
||||
list.$('tbody .o_list_record_selector input').first().click();
|
||||
assert.strictEqual(list.$('tfoot td:nth(2)').text(), "10",
|
||||
"total should be 10 as first record of first group is selected");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('properly apply onchange in simple case', function (assert) {
|
||||
@@ -433,6 +448,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual($int_field_td.find('input').val(), "1007",
|
||||
"should contain input with onchange applied");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('column width should not change when switching mode', function (assert) {
|
||||
@@ -467,6 +483,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(editionWidths[i], readonlyWidths[i],
|
||||
'width of columns should remain unchanged which switching from edit to readonly mode');
|
||||
}
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('deleting one record', function (assert) {
|
||||
@@ -493,6 +510,7 @@ QUnit.module('Views', {
|
||||
$('body .modal-dialog button span:contains(Ok)').click();
|
||||
|
||||
assert.strictEqual(list.$('tbody td.o_list_record_selector').length, 3, "should have 3 records");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('pager (ungrouped and grouped mode), default limit', function (assert) {
|
||||
@@ -515,6 +533,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(list.pager.state.size, 4, "pager's size should be 4");
|
||||
list.update({ groupBy: ['bar']});
|
||||
assert.ok(list.pager.$el.hasClass('o_hidden'), "pager should be invisible");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('can sort records when clicking on header', function (assert) {
|
||||
@@ -545,6 +564,7 @@ QUnit.module('Views', {
|
||||
"record 3 should be first");
|
||||
assert.ok(list.$('tbody tr:eq(3) td:contains(blip)').length,
|
||||
"record 1 should be first");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('can display button in edit mode', function (assert) {
|
||||
@@ -560,6 +580,7 @@ QUnit.module('Views', {
|
||||
'</tree>',
|
||||
});
|
||||
assert.ok(list.$('tbody button').length, "should have a button");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('can display a list with a many2many field', function (assert) {
|
||||
@@ -582,6 +603,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(rpcCount, 2, "should have done 2 rpcs: 1 searchread and 1 read for m2m");
|
||||
assert.ok(list.$('td:contains(Value 1, Value 2, Value 3)').length,
|
||||
"should have a td with correct formatted value");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
|
||||
@@ -599,6 +621,7 @@ QUnit.module('Views', {
|
||||
});
|
||||
|
||||
assert.ok(!list.$buttons, "should not have any buttons");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('display a tooltip on a field', function (assert) {
|
||||
@@ -630,6 +653,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual($('.tooltip .oe_tooltip_string').length, 1, "should have rendered a tooltip");
|
||||
|
||||
config.debug = initialDebugMode;
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('support row decoration', function (assert) {
|
||||
@@ -648,6 +672,7 @@ QUnit.module('Views', {
|
||||
"should have 3 columns with text-info class");
|
||||
|
||||
assert.strictEqual(list.$('tbody tr').length, 4, "should have 4 rows");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('no content helper when no data', function (assert) {
|
||||
@@ -683,6 +708,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(list.$('.oe_view_nocontent').length, 0,
|
||||
"should not display the no content helper");
|
||||
assert.strictEqual(list.$('table').length, 1, "should have a table in the dom");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
|
||||
@@ -732,6 +758,7 @@ QUnit.module('Views', {
|
||||
"the date field td should not have any content");
|
||||
|
||||
list.$buttons.find('.o_list_button_save').click();
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('list view, editable, with a button', function (assert) {
|
||||
@@ -753,7 +780,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(list.$('table button.o_icon_button i.fa-phone').length, 1,
|
||||
"should have rendered a button");
|
||||
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('list view, editable, can discard', function (assert) {
|
||||
@@ -782,6 +809,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.ok(!list.$buttons.find('.o_list_button_discard').is(':visible'),
|
||||
"discard button should not be visible");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('editable list view, click on the list to save', function (assert) {
|
||||
@@ -821,6 +849,7 @@ QUnit.module('Views', {
|
||||
list.$('tbody tr').last().click();
|
||||
|
||||
assert.strictEqual(createCount, 3, "should have created a record");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('click on a button in a list view', function (assert) {
|
||||
@@ -854,6 +883,7 @@ QUnit.module('Views', {
|
||||
'buttons should have correct icon');
|
||||
|
||||
list.$('.o_list_button:first > button').click(); // click on the button
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('invisible attrs in readonly and editable list', function (assert) {
|
||||
@@ -889,6 +919,7 @@ QUnit.module('Views', {
|
||||
list.$('tbody tr:nth(0) td:nth(4)').click();
|
||||
assert.ok(list.$('tbody tr:nth(0)').hasClass('o_selected_row'),
|
||||
"first row should be in edition");
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('monetary fields are properly rendered', function (assert) {
|
||||
@@ -910,7 +941,6 @@ QUnit.module('Views', {
|
||||
session: {
|
||||
currencies: currencies,
|
||||
},
|
||||
manualDestroy: true,
|
||||
});
|
||||
|
||||
assert.strictEqual(list.$('tbody tr:first td').length, 3,
|
||||
@@ -938,6 +968,7 @@ QUnit.module('Views', {
|
||||
"should have formatted the date");
|
||||
assert.strictEqual(list.$('td:contains(12/12/2016 10:55:05)').length, 1,
|
||||
"should have formatted the datetime");
|
||||
list.destroy();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(pivot.$('td.o_pivot_cell_value:contains(32)').length, 1,
|
||||
"should contain a pivot cell with the sum of all records");
|
||||
pivot.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('pivot view without "string" attribute', function (assert) {
|
||||
@@ -93,13 +94,14 @@ QUnit.module('Views', {
|
||||
|
||||
// this is important for export functionality.
|
||||
assert.strictEqual(pivot.title, _t("Untitled"), "should have a valid title");
|
||||
pivot.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('pivot view grouped by date field', function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var data = this.data;
|
||||
createView({
|
||||
var pivot = createView({
|
||||
View: PivotView,
|
||||
model: "partner",
|
||||
data: this.data,
|
||||
@@ -115,6 +117,7 @@ QUnit.module('Views', {
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
});
|
||||
pivot.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('without measures, pivot view uses __count by default', function (assert) {
|
||||
@@ -136,6 +139,7 @@ QUnit.module('Views', {
|
||||
|
||||
var $countMeasure = pivot.$buttons.find('li[data-field=__count]');
|
||||
assert.ok($countMeasure.hasClass('selected'), "The count measure should be activated");
|
||||
pivot.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('pivot view can be reloaded', function (assert) {
|
||||
@@ -163,6 +167,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(pivot.$('td.o_pivot_cell_value:contains(2)').length, 1,
|
||||
"should contain a pivot cell with the number of remaining records");
|
||||
assert.strictEqual(readGroupCount, 2, "should have done 2 rpcs");
|
||||
pivot.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('pivot view grouped by many2one field', function (assert) {
|
||||
@@ -184,6 +189,7 @@ QUnit.module('Views', {
|
||||
"should display one header with 'xphone'");
|
||||
assert.strictEqual(pivot.$('.o_pivot_header_cell_closed:contains(xpad)').length, 1,
|
||||
"should display one header with 'xpad'");
|
||||
pivot.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('basic folding/unfolding', function (assert) {
|
||||
@@ -229,6 +235,7 @@ QUnit.module('Views', {
|
||||
"should have 4 rows: one for header, 3 for data");
|
||||
assert.strictEqual(rpcCount, 3,
|
||||
"should have done 3 rpcs (initial load) + open header with different groupbys");
|
||||
pivot.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('more folding/unfolding', function (assert) {
|
||||
@@ -254,6 +261,7 @@ QUnit.module('Views', {
|
||||
|
||||
assert.strictEqual(pivot.$('tbody tr').length, 7,
|
||||
"should have 7 rows (1 for total, 1 for xphone, 1 for xpad, 4 for data)");
|
||||
pivot.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('pivot view can be flipped', function (assert) {
|
||||
@@ -283,6 +291,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(rpcCount, 0, "should not have done any rpc");
|
||||
assert.strictEqual(pivot.$('tbody tr').length, 1,
|
||||
"should have 1 rows: 1 for the main header");
|
||||
pivot.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('can toggle extra measure', function (assert) {
|
||||
@@ -327,6 +336,7 @@ QUnit.module('Views', {
|
||||
"should have 3 cells: 1 for the open header, and 2 for data");
|
||||
assert.strictEqual(rpcCount, 2,
|
||||
"should not have done any extra rpcs");
|
||||
pivot.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('no content helper when no active measure', function (assert) {
|
||||
@@ -351,6 +361,7 @@ QUnit.module('Views', {
|
||||
"should have a no_content_helper");
|
||||
assert.strictEqual(pivot.$('table').length, 0,
|
||||
"should not have a table in DOM");
|
||||
pivot.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('no content helper when no data', function (assert) {
|
||||
@@ -375,6 +386,7 @@ QUnit.module('Views', {
|
||||
"should have a no_content_helper");
|
||||
assert.strictEqual(pivot.$('table').length, 0,
|
||||
"should not have a table in DOM");
|
||||
pivot.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('tries to restore previous state after domain change', function (assert) {
|
||||
@@ -411,6 +423,7 @@ QUnit.module('Views', {
|
||||
"should still have 3 cells: 1 for the open header, and 2 for data");
|
||||
assert.strictEqual(pivot.$('.o_pivot_measure_row:contains(Foo)').length, 1,
|
||||
"should still have 1 row for measure Foo");
|
||||
pivot.destroy();
|
||||
});
|
||||
|
||||
});});
|
||||
|
||||
@@ -27,10 +27,6 @@ QUnit.module('Views', {
|
||||
var widget = new Widget();
|
||||
|
||||
testUtils.addMockEnvironment(widget, params);
|
||||
|
||||
setTimeout(function () {
|
||||
widget.destroy();
|
||||
}, 50);
|
||||
return widget;
|
||||
}
|
||||
|
||||
@@ -50,15 +46,16 @@ QUnit.module('Views', {
|
||||
},
|
||||
});
|
||||
|
||||
new dialogs.FormViewDialog(parent, {
|
||||
var dialog = new dialogs.FormViewDialog(parent, {
|
||||
res_model: 'partner',
|
||||
res_id: 1,
|
||||
}).open();
|
||||
|
||||
assert.notOk($('div.modal .modal-body button').length,
|
||||
"should not have any button in body")
|
||||
"should not have any button in body");
|
||||
assert.strictEqual($('div.modal .modal-footer button').length, 1,
|
||||
"should have only one button in footer")
|
||||
"should have only one button in footer");
|
||||
dialog.destroy();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -146,6 +146,7 @@ QUnit.module('DomainSelector', {
|
||||
'["&",["bar","=",True],["foo","=","hello"]]',
|
||||
"the domain input should contain a domain with 'bar' and 'foo'"
|
||||
);
|
||||
domainSelector.destroy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -123,6 +123,7 @@ QUnit.module('ModelFieldSelector', {
|
||||
"field selector popover should be closed now");
|
||||
assert.strictEqual($input.val(), "product_id.name",
|
||||
"field selector input value should be 'product_id.name'");
|
||||
fieldSelector.destroy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -127,6 +127,7 @@ QUnit.module('Views', {
|
||||
"diagram should contain 2 header rows");
|
||||
assert.strictEqual(diagram.$('.o_diagram_header span:eq(0)').text(), 'A first label',
|
||||
"diagram label is correctly inserted");
|
||||
diagram.destroy();
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -160,6 +161,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(diagram.$('text:contains(a new node)').length, 1,
|
||||
"diagram should only have the default nodes at start");
|
||||
|
||||
diagram.destroy();
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -188,6 +190,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(diagram.$('text').first().text(), 'An edited node',
|
||||
"diagram first node should now have new name");
|
||||
|
||||
diagram.destroy();
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -214,6 +217,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(diagram.$('.o_diagram ellipse').length, 1,
|
||||
"diagram should contain 1 'ellipse' nodes (node 2)");
|
||||
|
||||
diagram.destroy();
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -249,6 +253,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(diagram.$('text:contains(a transition from 1 to 3)').length, 1,
|
||||
"diagram should now have a transition from 1 to 3");
|
||||
|
||||
diagram.destroy();
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -281,6 +286,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(diagram.$('text:contains(An edited edge)').length, 1,
|
||||
"diagram should now have the new edge");
|
||||
|
||||
diagram.destroy();
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -311,6 +317,7 @@ QUnit.module('Views', {
|
||||
assert.strictEqual(diagram.$('text:contains(a transition from 2 to 1)').length, 0,
|
||||
"diagram edge label should have been deleted");
|
||||
|
||||
diagram.destroy();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user