Skip to content
Permalink
Browse files

[IMP]web: use testUtils.dom helpers

  • Loading branch information...
msh-odoo committed Mar 26, 2019
1 parent 3f3148a commit 1b24019e8a475527865999772cd339c77566241b
@@ -6232,13 +6232,13 @@ QUnit.module('relational_fields', {
},
});

form.$('.o_field_x2many_list_row_add a').click();
testUtils.dom.click(form.$('.o_field_x2many_list_row_add a'));
assert.strictEqual(form.$('tr.o_data_row').length, 1,
"there should be one data row");

var $dropdown = form.$('tr.o_selected_row .o_field_many2one input').autocomplete('widget');
form.$('tr.o_selected_row .o_field_many2one input').click();
$dropdown.find('.o_m2o_dropdown_option:contains(Create and Edit)').mouseenter().click(); // Open Create and Edit
testUtils.dom.click(form.$('tr.o_selected_row .o_field_many2one input'));
testUtils.dom.click($dropdown.find('.o_m2o_dropdown_option:contains(Create and Edit)').mouseenter()); // Open Create and Edit

$('.modal').trigger({type: 'keydown', which: $.ui.keyCode.ESCAPE}); // escape on modal

@@ -4231,7 +4231,8 @@ QUnit.module('Views', {
},
res_id: 2,
});
form.$buttons.find('.o_form_button_edit').click();

testUtils.dom.click(form.$buttons.find('.o_form_button_edit'));

assert.strictEqual(document.activeElement, form.$('[name="product_id"] input')[0],
"product_id should have focus by default");
@@ -4248,7 +4249,7 @@ QUnit.module('Views', {
assert.strictEqual(form.renderer.lastActivatedFieldIndex, 0, "lastActivatedFieldIndex should be 0");

var $dropdown = form.$('.o_field_many2one input').autocomplete('widget');
form.$('.o_field_many2one input').click();
testUtils.dom.click(form.$('.o_field_many2one input'));

// Open Create Edit Dialog
testUtils.dom.click($dropdown.find('.o_m2o_dropdown_option:contains(Create)').mouseenter());
@@ -4282,7 +4283,7 @@ QUnit.module('Views', {
res_id: 2,
});

form.$buttons.find('.o_form_button_edit').click();
testUtils.dom.click(form.$buttons.find('.o_form_button_edit'));
assert.strictEqual(document.activeElement, form.$('.o_field_widget[name="product_id"] input')[0],
"product_id should be focused");

@@ -3274,7 +3274,7 @@ QUnit.module('Views', {
arch: '<tree editable="bottom"><field name="foo"/></tree>',
});

list.$('tr.o_data_row:last td:eq(1)').click();
testUtils.dom.click(list.$('tr.o_data_row:last td:eq(1)'));
assert.strictEqual(document.activeElement,
list.$('tr.o_selected_row .o_field_widget')[0], "foo should have focus");

0 comments on commit 1b24019

Please sign in to comment.
You can’t perform that action at this time.