diff options
| author | Robot Odoo <xmo+roboto@odoo.com> | 2018-11-19 15:38:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-19 15:38:25 +0100 |
| commit | 7c3d5dc067c7c331dcc0b52bafbdfd067087a3c4 (patch) | |
| tree | 6058f8a893815bf0ed2495649c125523f4def762 /addons/web/static/tests/widgets | |
| parent | 8fc246da31aa2a1c770732ae97e0cb4e840f07cf (diff) | |
| parent | abf32b8b21394491040e5c11c1fea809c1d7c62c (diff) | |
[MERGE][REF] *: update js test suite to use helpers
This rev. introduces robust helpers to use in the JS tests suite to
interact with DOM and components, and starts using them (almost)
everywhere.
All the helpers are exposed though testUtils.js.
There are 2 kinds of helpers:
1. Assertions
-------------
* assert.containsNone, containsN, containsOnce check that the DOM
(or a specific part of the DOM) contains a `selector`. It
generates a correct error message automatically.
ex: assert.notOk(form.$('button').hasClass('btn-primary'));
-> assert.doesNotHaveClass(form.$('button'), 'btn-primary');
* assert.isVisible, isNotVisible check that the DOM has an element
visible or not. They also check that the element is actually in
the DOM (before most tests didn't verify this).
* assert.hasClass, doesNotHaveClass, hasAttrVAlue, check specific
properties of a DOM element, and also validate that it is
applied on a single existing DOM element (before most tests
didn't verify this).
2. Utilities
------------
The goal of the utilities is to centralize the definition of many
standard components and interactions, ensuring that when we
refactor the JS framework, we do not need to change all the tests.
Existing mock utilities (addMockEnvironment, intercept, path,
patchDate, unpatch and fieldsViewGet) are moved to
'testUtils.mock.*'.
Existing DOM utilities are moved to 'testUtils.dom.*'.
New dom utilities are created for opendDatePicker, click,
clickFirst and clickLast. Helper `click` verifies that there is
exactly 1 element visible in the DOM you click on, `clickFirst`
and `clickLast` verify that there are more than one element on the
DOM.
ex: form.$('button').click();
-> testUtils.dom.click(form.$('button'));
New Form utilities: (testUtils.form.*)
clickEdit, clickSave, clickCreate, clickDiscard, all clicks on
the control panel buttons of the form.
`reload` reloads the form data.
New modal, graph, kanban and pivot utils (testUtils.pivot.*,
testUtils.kanban.*, etc.).
New fields utils: (testUtils.fields.*)
* editInput, editSelect: allow to change the value of a field,
using a selector to identify it. They validate that the input
exists and trigger the change event automatically.
* editAndTrigger: allow to modify a field and trigger specific
events after the value change
* many2one (testUtils.fields.many2one.*)
clickOpenDropdown, clickHighlightedItem, clickItem,
searchAndClickItem: use a field name instead of a selector and
do all the complex mechanism to open, filter and highlight
many2one fields.
Joint work with aab, dam, ged, mge, svs and vsc.
closes odoo/odoo#28784
Diffstat (limited to 'addons/web/static/tests/widgets')
4 files changed, 85 insertions, 82 deletions
diff --git a/addons/web/static/tests/widgets/data_export_tests.js b/addons/web/static/tests/widgets/data_export_tests.js index 4569a5a6290..40b59157b02 100644 --- a/addons/web/static/tests/widgets/data_export_tests.js +++ b/addons/web/static/tests/widgets/data_export_tests.js @@ -104,18 +104,19 @@ QUnit.module('widgets', { }; }, }; - list.$('thead th.o_list_record_selector input').click(); - list.sidebar.$('a:contains(Export)').click(); + testUtils.dom.click(list.$('thead th.o_list_record_selector input')); + testUtils.dom.click(list.sidebar.$('.o_dropdown_toggler_btn:contains(Action)')); + testUtils.dom.click(list.sidebar.$('a:contains(Export)')); assert.strictEqual($('.modal').length, 1, "a modal dialog should be open"); assert.strictEqual($('span.o_tree_column:contains(Activities)').length, 1, "the Activities field should be in the list of exportable fields"); // select the field Description, click on add, then export and close - $('.modal span:contains(Description)').click(); - $('.modal .o_add_field').click(); - $('.modal span:contains(Export To File)').click(); - $('.modal span:contains(Close)').click(); + testUtils.dom.click($('.modal span:contains(Description)')); + testUtils.dom.click($('.modal .o_add_field')); + testUtils.dom.click($('.modal span:contains(Export To File)')); + testUtils.dom.click($('.modal span:contains(Close)')); list.destroy(); framework.blockUI = blockUI; @@ -183,28 +184,29 @@ QUnit.module('widgets', { }; // Open the export modal - list.$('thead th.o_list_record_selector input').click(); - list.sidebar.$('a:contains(Export)').click(); + testUtils.dom.click(list.$('thead th.o_list_record_selector input')); + testUtils.dom.click(list.sidebar.$('.o_dropdown_toggler_btn:contains(Action)')); + testUtils.dom.click(list.sidebar.$('a:contains(Export)')); assert.strictEqual($('.modal').length, 1, "a modal dialog should be open"); // Select 'Activities' in fields to export assert.strictEqual($('.modal select.o_fields_list option').length, 0, "the fields list should be empty"); - $('.modal .o_export_tree_item:contains(Activities)').click(); - $('.modal button:contains(Add)').click(); + testUtils.dom.click($('.modal .o_export_tree_item:contains(Activities)')); + testUtils.dom.click($('.modal button:contains(Add)')); assert.strictEqual($('.modal select.o_fields_list option').length, 1, "there should be one item in the fields list"); // Save fields list - $('.modal a:contains(Save fields list)').click(); - $('.modal .o_save_list > input').val('fields list').trigger('input'); - $('.modal .o_save_list > button').click(); + testUtils.dom.click($('.modal a:contains(Save fields list)')); + testUtils.fields.editInput($('.modal .o_save_list > input'), 'fields list'); + testUtils.dom.click($('.modal .o_save_list > button')); assert.verifySteps(['build_search_data', 'create'], "create should have been called"); // Close the modal and destroy list - $('.modal button span:contains(Close)').click(); + testUtils.dom.click($('.modal button span:contains(Close)')); list.destroy(); // restore create function diff --git a/addons/web/static/tests/widgets/domain_selector_tests.js b/addons/web/static/tests/widgets/domain_selector_tests.js index a1369090f51..6a9df11935a 100644 --- a/addons/web/static/tests/widgets/domain_selector_tests.js +++ b/addons/web/static/tests/widgets/domain_selector_tests.js @@ -60,7 +60,7 @@ QUnit.module('DomainSelector', { readonly: false, debugMode: true, }); - testUtils.addMockEnvironment(domainSelector, {data: this.data}); + testUtils.mock.addMockEnvironment(domainSelector, {data: this.data}); domainSelector.appendTo($target); // As we gave an empty domain, there should be a visible button to add @@ -71,7 +71,7 @@ QUnit.module('DomainSelector', { // Clicking on the button should add a visible field selector in the // widget so that the user can change the field chain - $domainAddFirstNodeButton.click(); + testUtils.dom.click($domainAddFirstNodeButton); var $fieldSelector = domainSelector.$(".o_field_selector:visible"); assert.strictEqual($fieldSelector.length, 1, "there should be a field selector"); @@ -97,7 +97,7 @@ QUnit.module('DomainSelector', { // Clicking the "Bar" field should change the internal domain and this // should be displayed in the debug input - $barLi.click(); + testUtils.dom.click($barLi); assert.strictEqual( domainSelector.$(".o_domain_debug_input").val(), '[["bar","=",True]]', @@ -108,7 +108,7 @@ QUnit.module('DomainSelector', { // should add the default "['id', '=', 1]" domain var $plus = domainSelector.$(".fa-plus-circle"); assert.strictEqual($plus.length, 1, "there should be a '+' button"); - $plus.click(); + testUtils.dom.click($plus); assert.strictEqual( domainSelector.$(".o_domain_debug_input").val(), '["&",["bar","=",True],["id","=",1]]', @@ -119,7 +119,7 @@ QUnit.module('DomainSelector', { // domains and the "|" operator var $dots = domainSelector.$(".fa-ellipsis-h"); assert.strictEqual($dots.length, 2, "there should be two '...' buttons"); - $dots.first().click(); + testUtils.dom.click($dots.first()); assert.strictEqual( domainSelector.$(".o_domain_debug_input").val(), '["&","&",["bar","=",True],"|",["id","=",1],["id","=",1],["id","=",1]]', @@ -140,8 +140,8 @@ QUnit.module('DomainSelector', { // "foo" fields, with the initial "&" operator var $minus = domainSelector.$(".o_domain_delete_node_button"); assert.strictEqual($minus.length, 5, "there should be five 'x' buttons"); - $minus.last().click(); - domainSelector.$(".o_domain_delete_node_button").last().click(); + testUtils.dom.click($minus.last()); + testUtils.dom.click(domainSelector.$(".o_domain_delete_node_button").last()); assert.strictEqual( domainSelector.$(".o_domain_debug_input").val(), '["&",["bar","=",True],["foo","=","hello"]]', @@ -159,7 +159,7 @@ QUnit.module('DomainSelector', { var domainSelector = new DomainSelector(null, "partner", [["nice_datetime", "=", "2017-03-27 15:42:00"]], { readonly: false, }); - testUtils.addMockEnvironment(domainSelector, {data: this.data}); + testUtils.mock.addMockEnvironment(domainSelector, {data: this.data}); domainSelector.appendTo($target); // Check that there is a datepicker to choose the date @@ -168,8 +168,8 @@ QUnit.module('DomainSelector', { "there should be a datepicker"); var val = $datepicker.find('input').val(); - testUtils.openDatepicker($datepicker); - $('.bootstrap-datetimepicker-widget :not(.today)[data-action="selectDay"]').click(); + testUtils.dom.openDatepicker($datepicker); + testUtils.dom.clickFirst($('.bootstrap-datetimepicker-widget :not(.today)[data-action="selectDay"]')); assert.notEqual(domainSelector.$(".o_datepicker:visible input").val(), val, "datepicker value should have changed"); @@ -186,10 +186,10 @@ QUnit.module('DomainSelector', { debugMode: true, readonly: false, }); - testUtils.addMockEnvironment(domainSelector, {data: this.data}); + testUtils.mock.addMockEnvironment(domainSelector, {data: this.data}); domainSelector.appendTo($target); - domainSelector.$('.o_domain_leaf_value_input').val('pad').trigger('input').trigger('change'); + testUtils.fields.editAndTrigger(domainSelector.$('.o_domain_leaf_value_input'), 'pad', ['input', 'change']); assert.strictEqual(domainSelector.$('.o_domain_debug_input').val(), '[["product_id","ilike","pad"]]', "string should have been allowed as m2o value"); @@ -206,7 +206,7 @@ QUnit.module('DomainSelector', { debugMode: true, readonly: false, }); - testUtils.addMockEnvironment(domainSelector, {data: this.data}); + testUtils.mock.addMockEnvironment(domainSelector, {data: this.data}); domainSelector.appendTo($target); assert.strictEqual(domainSelector.$el.text(), "This domain is not supported.", @@ -226,12 +226,12 @@ QUnit.module('DomainSelector', { debugMode: true, default: [["foo","=","kikou"]], }); - testUtils.addMockEnvironment(domainSelector, {data: this.data}); + testUtils.mock.addMockEnvironment(domainSelector, {data: this.data}); domainSelector.appendTo($target); // Clicking on the button should add a visible field selector in the // widget so that the user can change the field chain - domainSelector.$(".o_domain_add_first_node_button:visible").click(); + testUtils.dom.click(domainSelector.$(".o_domain_add_first_node_button:visible")); assert.strictEqual( domainSelector.$(".o_domain_debug_input").val(), diff --git a/addons/web/static/tests/widgets/dropdown_menu_tests.js b/addons/web/static/tests/widgets/dropdown_menu_tests.js index c46c15fe649..83f5d3fecb7 100644 --- a/addons/web/static/tests/widgets/dropdown_menu_tests.js +++ b/addons/web/static/tests/widgets/dropdown_menu_tests.js @@ -8,7 +8,7 @@ function createDropdownMenu(dropdownTitle, groups, params) { params = params || {}; var target = params.debug ? document.body : $('#qunit-fixture'); var menu = new DropdownMenu(null, dropdownTitle, groups); - testUtils.addMockEnvironment(menu, params); + testUtils.mock.addMockEnvironment(menu, params); menu.appendTo(target); return menu; } @@ -44,7 +44,7 @@ QUnit.module('Web', { assert.expect(2); var dropdownMenu = createDropdownMenu(this.dropdownHeader, this.items); - assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 4, 'should have 4 elements counting the dividers'); + assert.containsN(dropdownMenu, '.dropdown-divider, .dropdown-item, .dropdown-item-text', 4, 'should have 4 elements counting the dividers'); assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').eq(1).text().trim(), 'Some Item', 'first element should have "Some Item" description'); dropdownMenu.destroy(); @@ -68,14 +68,14 @@ QUnit.module('Web', { }, }, }); - dropdownMenu.$('button:first').click(); - assert.ok(!dropdownMenu.$('.o_menu_item:first > .dropdown-item').hasClass('selected')); - dropdownMenu.$('.o_menu_item a').first().click(); - assert.ok(dropdownMenu.$('.o_menu_item:first > .dropdown-item').hasClass('selected')); + testUtils.dom.click(dropdownMenu.$('button:first')); + assert.doesNotHaveClass(dropdownMenu.$('.o_menu_item:first > .dropdown-item'), 'selected'); + testUtils.dom.click(dropdownMenu.$('.o_menu_item a').first()); + assert.hasClass(dropdownMenu.$('.o_menu_item:first > .dropdown-item'), 'selected'); assert.ok(dropdownMenu.$('.o_menu_item:first').is(':visible'), 'item should still be visible'); - dropdownMenu.$('.o_menu_item a').first().click(); - assert.ok(!dropdownMenu.$('.o_menu_item:first > .dropdown-item').hasClass('selected')); + testUtils.dom.click(dropdownMenu.$('.o_menu_item a').first()); + assert.doesNotHaveClass(dropdownMenu.$('.o_menu_item:first > .dropdown-item'), 'selected'); assert.ok(dropdownMenu.$('.o_menu_item:first').is(':visible'), 'item should still be visible'); @@ -86,11 +86,12 @@ QUnit.module('Web', { assert.expect(0); var dropdownMenu = createDropdownMenu(this.dropdownHeader, this.items); + testUtils.dom.click(dropdownMenu.$('.o_dropdown_toggler_btn')); dropdownMenu.$el.click(function () { // we do not want a click to get out and change the url, for example throw new Error('No click should get out of the dropdown menu'); }); - dropdownMenu.$('.o_menu_item a').first().click(); + testUtils.dom.click(dropdownMenu.$('.o_menu_item a').first()); dropdownMenu.destroy(); }); @@ -102,14 +103,14 @@ QUnit.module('Web', { var dropdownMenu = createDropdownMenu(this.dropdownHeader, this.items); // open dropdown - dropdownMenu.$('button:first').click(); - assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 4); + testUtils.dom.click(dropdownMenu.$('button:first')); + assert.containsN(dropdownMenu, '.dropdown-divider, .dropdown-item, .dropdown-item-text', 4); // open options menu - dropdownMenu.$('span.fa-caret-right').click(); - assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 7); + testUtils.dom.click(dropdownMenu.$('span.fa-caret-right')); + assert.containsN(dropdownMenu, '.dropdown-divider, .dropdown-item, .dropdown-item-text', 7); // close options menu - dropdownMenu.$('span.fa-caret-down').click(); - assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 4); + testUtils.dom.click(dropdownMenu.$('span.fa-caret-down')); + assert.containsN(dropdownMenu, '.dropdown-divider, .dropdown-item, .dropdown-item-text', 4); dropdownMenu.destroy(); }); @@ -120,13 +121,13 @@ QUnit.module('Web', { this.items[0].options = [{optionId: 1, description: "First Option"}, {optionId: 2, description: "Second Option"}]; var dropdownMenu = createDropdownMenu(this.dropdownHeader, this.items); - dropdownMenu.$('button:first').click(); + testUtils.dom.click(dropdownMenu.$('button:first')); // open options menu - dropdownMenu.$('span.fa-caret-right').click(); - assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 7); - dropdownMenu.$('button:first').click(); - dropdownMenu.$('button:first').click(); - assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 4); + testUtils.dom.click(dropdownMenu.$('span.fa-caret-right')); + assert.containsN(dropdownMenu, '.dropdown-divider, .dropdown-item, .dropdown-item-text', 7); + testUtils.dom.click(dropdownMenu.$('button:first')); + testUtils.dom.click(dropdownMenu.$('button:first')); + assert.containsN(dropdownMenu, '.dropdown-divider, .dropdown-item, .dropdown-item-text', 4); dropdownMenu.destroy(); }); @@ -162,26 +163,26 @@ QUnit.module('Web', { }, }); // open dropdown menu - dropdownMenu.$('button:first').click(); + testUtils.dom.click(dropdownMenu.$('button:first')); // open options menu - dropdownMenu.$('span.fa-caret-right').click(); - assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 7); + testUtils.dom.click(dropdownMenu.$('span.fa-caret-right')); + assert.containsN(dropdownMenu, '.dropdown-divider, .dropdown-item, .dropdown-item-text', 7); // Don't forget there is a hidden li.divider element at first place among children - assert.ok(!dropdownMenu.$('.o_menu_item:nth-child(2) > .dropdown-item').hasClass('selected')); - assert.ok(!dropdownMenu.$('.o_item_option:nth-child(2) > .dropdown-item').hasClass('selected')); - assert.ok(!dropdownMenu.$('.o_item_option:nth-child(3) > .dropdown-item').hasClass('selected')); - dropdownMenu.$('.o_item_option:first').click(); - assert.ok(dropdownMenu.$('.o_menu_item:nth-child(2) > .dropdown-item').hasClass('selected')); - assert.ok(dropdownMenu.$('.o_item_option:nth-child(2) > .dropdown-item').hasClass('selected')); - assert.ok(!dropdownMenu.$('.o_item_option:nth-child(3) > .dropdown-item').hasClass('selected')); - dropdownMenu.$('.o_item_option:nth-child(3)').click(); - assert.ok(dropdownMenu.$('.o_menu_item:nth-child(2) > .dropdown-item').hasClass('selected')); - assert.ok(!dropdownMenu.$('.o_item_option:nth-child(2) > .dropdown-item').hasClass('selected')); - assert.ok(dropdownMenu.$('.o_item_option:nth-child(3) > .dropdown-item').hasClass('selected')); - dropdownMenu.$('.o_item_option:nth-child(3)').click(); - assert.ok(!dropdownMenu.$('.o_menu_item:nth-child(2) > .dropdown-item').hasClass('selected')); - assert.ok(!dropdownMenu.$('.o_item_option:nth-child(2) > .dropdown-item').hasClass('selected')); - assert.ok(!dropdownMenu.$('.o_item_option:nth-child(3) > .dropdown-item').hasClass('selected')); + assert.doesNotHaveClass(dropdownMenu.$('.o_menu_item:nth-child(2) > .dropdown-item'), 'selected'); + assert.doesNotHaveClass(dropdownMenu.$('.o_item_option:nth-child(2) > .dropdown-item'), 'selected'); + assert.doesNotHaveClass(dropdownMenu.$('.o_item_option:nth-child(3) > .dropdown-item'), 'selected'); + testUtils.dom.click(dropdownMenu.$('.o_item_option:first')); + assert.hasClass(dropdownMenu.$('.o_menu_item:nth-child(2) > .dropdown-item'), 'selected'); + assert.hasClass(dropdownMenu.$('.o_item_option:nth-child(2) > .dropdown-item'), 'selected'); + assert.doesNotHaveClass(dropdownMenu.$('.o_item_option:nth-child(3) > .dropdown-item'), 'selected'); + testUtils.dom.click(dropdownMenu.$('.o_item_option:nth-child(3)')); + assert.hasClass(dropdownMenu.$('.o_menu_item:nth-child(2) > .dropdown-item'), 'selected'); + assert.doesNotHaveClass(dropdownMenu.$('.o_item_option:nth-child(2) > .dropdown-item'), 'selected'); + assert.hasClass(dropdownMenu.$('.o_item_option:nth-child(3) > .dropdown-item'), 'selected'); + testUtils.dom.click(dropdownMenu.$('.o_item_option:nth-child(3)')); + assert.doesNotHaveClass(dropdownMenu.$('.o_menu_item:nth-child(2) > .dropdown-item'), 'selected'); + assert.doesNotHaveClass(dropdownMenu.$('.o_item_option:nth-child(2) > .dropdown-item'), 'selected'); + assert.doesNotHaveClass(dropdownMenu.$('.o_item_option:nth-child(3) > .dropdown-item'), 'selected'); dropdownMenu.destroy(); }); @@ -195,10 +196,10 @@ QUnit.module('Web', { }, }, }); - dropdownMenu.$('button:first').click(); - assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 4); - dropdownMenu.$('span.o_trash_button').click(); - assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 2); + testUtils.dom.click(dropdownMenu.$('button:first')); + assert.containsN(dropdownMenu, '.dropdown-divider, .dropdown-item, .dropdown-item-text', 4); + testUtils.dom.click(dropdownMenu.$('span.o_trash_button')); + assert.containsN(dropdownMenu, '.dropdown-divider, .dropdown-item, .dropdown-item-text', 2); dropdownMenu.destroy(); }); }); diff --git a/addons/web/static/tests/widgets/model_field_selector_tests.js b/addons/web/static/tests/widgets/model_field_selector_tests.js index 23b5ed5d05c..9cbba06ad97 100644 --- a/addons/web/static/tests/widgets/model_field_selector_tests.js +++ b/addons/web/static/tests/widgets/model_field_selector_tests.js @@ -59,7 +59,7 @@ QUnit.module('ModelFieldSelector', { readonly: false, debugMode: true, }); - testUtils.addMockEnvironment(fieldSelector, {data: this.data}); + testUtils.mock.addMockEnvironment(fieldSelector, {data: this.data}); fieldSelector.appendTo($target); var $value = fieldSelector.$("> .o_field_selector_value"); @@ -84,7 +84,7 @@ QUnit.module('ModelFieldSelector', { // Clicking the "Bar" field should close the popover and set the field // chain to "bar" as it is a basic field - $barLi.click(); + testUtils.dom.click($barLi); assert.notOk($fieldSelectorPopover.is("visible"), "field selector popover should be closed now"); assert.strictEqual(getValueFromDOM($value), "Bar", @@ -118,7 +118,7 @@ QUnit.module('ModelFieldSelector', { // Clicking on the "Product" field should update the popover to show // the product fields (so only "Product Name" should be there) - $productLi.click(); + testUtils.dom.click($productLi); $lis = $fieldSelectorPopover.find("li"); assert.strictEqual($lis.length, 1, "there should be only one field proposition for 'product' model"); @@ -127,7 +127,7 @@ QUnit.module('ModelFieldSelector', { // Clicking on "Product Name" should close the popover and set the chain // to "product_id.name" - $lis.first().click(); + testUtils.dom.click($lis.first()); assert.notOk($fieldSelectorPopover.is("visible"), "field selector popover should be closed now"); assert.strictEqual(getValueFromDOM($value), "Product -> Product Name", @@ -135,8 +135,8 @@ QUnit.module('ModelFieldSelector', { // Remove the current selection and recreate it again fieldSelector.$el.trigger('focusin'); - fieldSelector.$('.o_field_selector_prev_page').click(); - fieldSelector.$('.o_field_selector_close').click(); + testUtils.dom.click(fieldSelector.$('.o_field_selector_prev_page')); + testUtils.dom.click(fieldSelector.$('.o_field_selector_close')); fieldSelector.$el.trigger('focusin'); $fieldSelectorPopover = fieldSelector.$(".o_field_selector_popover:visible"); @@ -151,9 +151,9 @@ QUnit.module('ModelFieldSelector', { assert.strictEqual($productLi.length, 1, "field selector popover should contain the 'Product' field"); - $productLi.click(); + testUtils.dom.click($productLi); $lis = $fieldSelectorPopover.find("li"); - $lis.first().click(); + testUtils.dom.click($lis.first()); assert.notOk($fieldSelectorPopover.is("visible"), "field selector popover should be closed now"); assert.strictEqual(getValueFromDOM($value), "Product -> Product Name", @@ -180,7 +180,7 @@ QUnit.module('ModelFieldSelector', { return field.type === 'many2one'; }, }); - testUtils.addMockEnvironment(fieldSelector, {data: this.data}); + testUtils.mock.addMockEnvironment(fieldSelector, {data: this.data}); fieldSelector.appendTo($target); fieldSelector.$el.trigger('focusin'); @@ -202,7 +202,7 @@ QUnit.module('ModelFieldSelector', { readonly: false, showSearchInput: true, }); - testUtils.addMockEnvironment(fieldSelector, {data: this.data}); + testUtils.mock.addMockEnvironment(fieldSelector, {data: this.data}); fieldSelector.appendTo($target); fieldSelector.$el.trigger('focusin'); |
