[FIX] *: adapt QUnit tests and tours

[FIX] *: selectors in tours

[FIX][TMP] account: CogMenu selector in tours

[FIX][TMP] web*: Breadcrumb targetting in tours

Adds a `o_breadcrumb` class to target the whole breadcrumb, no matter
how much elements it contains (collapsed parts, visible path, single
name...).

add classname on last breadcrumb item

[FIX][TMP] project: View buttons selector in tours (moved away from CP)

[FIX][TMP] project: Kanban selectors in tours (quick create)

[FIX][TMP] *: SearchBar selectors in tours (toggle menu)

[FIX][TMP] *: ButtonBox selector in tours

[WIP][IMP] web: add toggleSearchBarMenu in search helpers

adapt and unskip 3 list tests

adapt and unskip calendar tests

unskip web_tour test that actually pass

post rebase fix

allow to lose cell focus after multi edition (given to searchbar) - bug reported, to check later

post rebase fixes

fix

Part-of: odoo/odoo#116641
This commit is contained in:
Pierre Paridans
2023-05-12 22:59:22 +02:00
parent 3aaa0bfff1
commit eef262abf4
112 changed files with 3673 additions and 2329 deletions
@@ -376,7 +376,10 @@ QUnit.module("Fields", (hooks) => {
resId: 1,
});
await click(target, ".o_form_button_create");
await click(
target,
".o_control_panel_main_buttons .d-none.d-xl-inline-flex .o_form_button_create"
);
await click(target, ".o_field_many2one[name='product_id'] input");
await click(
target.querySelector(".o_field_many2one[name='product_id'] .dropdown-item")
@@ -474,7 +477,7 @@ QUnit.module("Fields", (hooks) => {
);
});
QUnit.test('isUploading state should be set to false after upload', async function(assert) {
QUnit.test("isUploading state should be set to false after upload", async function (assert) {
assert.expect(1);
serverData.models.partner.onchanges = {
document: function (obj) {
@@ -498,7 +501,7 @@ QUnit.module("Fields", (hooks) => {
await editInput(target, ".o_field_binary .o_input_file", file);
assert.equal(
target.querySelector(".o_select_file_button").innerText,
"UPLOAD YOUR FILE",
"Upload your file",
"displayed value should be upload your file"
);
});
@@ -224,7 +224,11 @@ QUnit.module("Fields", (hooks) => {
</tree>`,
domain: [["id", "<", 0]],
});
await click(target.querySelector(".o_list_button_add"));
await click(
target.querySelector(
".o_control_panel_main_buttons .d-none.d-xl-inline-flex .o_list_button_add"
)
);
const date_column_width = target
.querySelector('.o_list_table thead th[data-name="date_field"]')
.style.width.replace("px", "");
@@ -268,7 +268,11 @@ QUnit.module("Fields", (hooks) => {
);
await editInput(target, 'div[name="float_field"] input', "18.8958938598598");
await click(target.querySelector(".o_list_button_save"));
await click(
target.querySelector(
".o_control_panel_main_buttons .d-none.d-xl-inline-flex .o_list_button_save"
)
);
assert.strictEqual(
target.querySelector(".o_field_widget").textContent,
"18.896",
@@ -652,7 +652,7 @@ QUnit.module("Fields", (hooks) => {
);
await clickSave(target);
await click(target, ".o_form_button_create");
await click(target, ".o_control_panel_main_buttons .d-none .o_form_button_create");
assert.strictEqual(
target.querySelector("img[data-alt='Binary file']").dataset.src,
"/web/static/img/placeholder.png",
@@ -262,7 +262,11 @@ QUnit.module("Fields", (hooks) => {
"The value should be displayed properly in the input."
);
await click(target.querySelector(".o_list_button_save"));
await click(
target.querySelector(
".o_control_panel_main_buttons .d-none.d-xl-inline-flex .o_list_button_save"
)
);
assert.strictEqual(
target.querySelector("td:not(.o_list_record_selector)").textContent,
"-28",
@@ -181,7 +181,11 @@ QUnit.module("Fields", (hooks) => {
);
// save and check the result
await click(target.querySelector(".o_list_button_save"));
await click(
target.querySelector(
".o_control_panel_main_buttons .d-none.d-xl-inline-flex .o_list_button_save"
)
);
assert.strictEqual(
target.querySelectorAll(".o_field_widget .badge:not(:empty)").length,
3,
@@ -59,13 +59,13 @@ QUnit.module("Fields", (hooks) => {
assert.containsN(
target,
".o_field_many2many_tags_avatar.o_field_widget .o_avatar",
".o_field_many2many_tags_avatar.o_field_widget .o_avatar img",
2,
"should have 2 records"
);
assert.strictEqual(
target.querySelector(".o_field_many2many_tags_avatar.o_field_widget .o_avatar img").dataset
.src,
target.querySelector(".o_field_many2many_tags_avatar.o_field_widget .o_avatar img")
.dataset.src,
"/web/image/partner/2/avatar_128",
"should have correct avatar image"
);
@@ -116,13 +116,13 @@ QUnit.module("Fields", (hooks) => {
);
assert.containsN(
target,
".o_data_row:nth-child(2) .o_field_many2many_tags_avatar .o_avatar:not(.o_m2m_avatar_empty)",
".o_data_row:nth-child(2) .o_field_many2many_tags_avatar .o_avatar:not(.o_m2m_avatar_empty) img",
4,
"should have 4 records"
);
assert.containsN(
target,
".o_data_row:nth-child(3) .o_field_many2many_tags_avatar .o_avatar:not(.o_m2m_avatar_empty)",
".o_data_row:nth-child(3) .o_field_many2many_tags_avatar .o_avatar:not(.o_m2m_avatar_empty) img",
5,
"should have 5 records"
);
@@ -175,7 +175,7 @@ QUnit.module("Fields", (hooks) => {
);
assert.containsN(
target,
".o_data_row:nth-child(4) .o_field_many2many_tags_avatar .o_avatar:not(.o_m2m_avatar_empty)",
".o_data_row:nth-child(4) .o_field_many2many_tags_avatar .o_avatar:not(.o_m2m_avatar_empty) img",
4,
"should have 4 records"
);
@@ -213,16 +213,20 @@ QUnit.module("Fields", (hooks) => {
await click(target.querySelector(".o_data_row .o_many2many_tags_avatar_cell"));
assert.containsN(
target,
".o_data_row.o_selected_row .o_many2many_tags_avatar_cell .o_avatar",
".o_data_row.o_selected_row .o_many2many_tags_avatar_cell .o_avatar img",
1,
"should have 1 many2many badges in edit mode"
);
await selectDropdownItem(target, "partner_ids", "second record");
await click(target.querySelector(".o_list_button_save"));
await click(
target.querySelector(
".o_control_panel_main_buttons .d-none.d-xl-inline-flex .o_list_button_save"
)
);
assert.containsN(
target,
".o_data_row:first-child .o_field_many2many_tags_avatar .o_avatar",
".o_data_row:first-child .o_field_many2many_tags_avatar .o_avatar img",
2,
"should have 2 records"
);
@@ -333,13 +337,13 @@ QUnit.module("Fields", (hooks) => {
assert.containsN(
target,
".o_kanban_record:nth-child(2) .o_field_many2many_tags_avatar .o_avatar",
".o_kanban_record:nth-child(2) .o_field_many2many_tags_avatar .o_avatar img",
2,
"should have 2 records"
);
assert.containsN(
target,
".o_kanban_record:nth-child(3) .o_field_many2many_tags_avatar .o_avatar",
".o_kanban_record:nth-child(3) .o_field_many2many_tags_avatar .o_avatar img",
2,
"should have 2 records"
);
@@ -374,7 +378,7 @@ QUnit.module("Fields", (hooks) => {
assert.containsN(
target,
".o_kanban_record:nth-child(4) .o_field_many2many_tags_avatar .o_avatar",
".o_kanban_record:nth-child(4) .o_field_many2many_tags_avatar .o_avatar img",
2,
"should have 2 records"
);
@@ -26,8 +26,7 @@ import {
import {
editSearch,
getFacetTexts,
toggleFilterMenu,
toggleGroupByMenu,
toggleSearchBarMenu,
toggleMenuItem,
validateSearch,
} from "@web/../tests/search/helpers";
@@ -626,7 +625,7 @@ QUnit.module("Fields", (hooks) => {
const modal = target.querySelector(".modal");
await toggleFilterMenu(modal);
await toggleSearchBarMenu(modal);
await toggleMenuItem(modal, "Filter");
assert.strictEqual($("tr.o_data_row").length, 0, "should display 0 records");
@@ -1767,7 +1766,10 @@ QUnit.module("Fields", (hooks) => {
assert.containsN(target, ".o_data_row", 3);
await click(target, ".o_list_button_add");
await click(
target,
".o_control_panel_main_buttons .d-none.d-xl-inline-flex .o_list_button_add"
);
assert.containsN(target, ".o_data_row", 4);
@@ -3980,32 +3982,14 @@ QUnit.module("Fields", (hooks) => {
await click(target, `.o_field_widget[name="trululu"] .o_m2o_dropdown_option_search_more`);
// dropdown selector
const filterMenuCss = ".o_search_options > .o_filter_menu";
const groupByMenuCss = ".o_search_options > .o_group_by_menu";
const searchDropdown = ".o_control_panel_actions .o-dropdown";
await click(document.querySelector(`${filterMenuCss} > .dropdown-toggle`));
await click(document.querySelector(`${searchDropdown} .dropdown-toggle`));
assert.hasClass(document.querySelector(filterMenuCss), "show");
assert.hasClass(document.querySelector(searchDropdown), "show");
assert.isVisible(
document.querySelector(`${filterMenuCss} > .dropdown-menu`),
"the filter dropdown menu should be visible"
);
assert.doesNotHaveClass(document.querySelector(groupByMenuCss), "show");
assert.isNotVisible(
document.querySelector(`${groupByMenuCss} > .dropdown-menu`),
"the Group by dropdown menu should be not visible"
);
await click(document.querySelector(`${groupByMenuCss} > .dropdown-toggle`));
assert.hasClass(document.querySelector(groupByMenuCss), "show");
assert.isVisible(
document.querySelector(`${groupByMenuCss} > .dropdown-menu`),
"the group by dropdown menu should be visible"
);
assert.doesNotHaveClass(document.querySelector(filterMenuCss), "show");
assert.isNotVisible(
document.querySelector(`${filterMenuCss} > .dropdown-menu`),
"the filter dropdown menu should be not visible"
document.querySelector(`${searchDropdown} > .dropdown-menu`),
"the search bar dropdown menu should be visible"
);
});
@@ -4198,7 +4182,7 @@ QUnit.module("Fields", (hooks) => {
await selectDropdownItem(target, "trululu", "Search More...");
const modal = target.querySelector(".modal");
await toggleGroupByMenu(modal);
await toggleSearchBarMenu(modal);
await toggleMenuItem(modal, "Bar");
await click(modal.querySelectorAll(".o_group_header")[1]);
@@ -4371,20 +4355,23 @@ QUnit.module("Fields", (hooks) => {
const target = getFixture();
await doAction(webClient, 1);
assert.containsOnce(target, "a.o_form_uri", "should display 1 m2o link in form");
assert.containsN(
assert.containsOnce(
target,
".breadcrumb-item",
1,
".o_breadcrumb",
"Should only contain one breadcrumb at the start"
);
await click(target.querySelector("a.o_form_uri"));
assert.verifySteps(["get_formview_action"]);
assert.containsN(
assert.containsOnce(
target,
".breadcrumb-item",
2,
"Should contain 2 breadcrumbs after the clicking on the link"
"Should contain 1 breadcrumb link after the clicking on the link"
);
assert.containsOnce(
target,
".o_breadcrumb",
"Should also contain the active breadcrumb item"
);
});
@@ -4440,7 +4427,7 @@ QUnit.module("Fields", (hooks) => {
await click(target, ".o_field_widget .o_external_button");
assert.verifySteps(["get_formview_action"]);
assert.strictEqual(target.querySelector(".breadcrumb").textContent, "first recordNew");
assert.strictEqual(target.querySelector(".breadcrumb").textContent, "first record");
});
QUnit.test("external_button opens a FormViewDialog in dialogs", async function (assert) {
@@ -771,7 +771,11 @@ QUnit.module("Fields", (hooks) => {
</tree>`,
});
await click(target.querySelector(".o_list_button_add"));
await click(
target.querySelector(
".o_control_panel_main_buttons .d-none.d-xl-inline-flex .o_list_button_add"
)
);
assert.containsOnce(
target,
".o_selected_row .o_field_widget[name=float_field] input",
@@ -63,72 +63,15 @@ QUnit.module("Fields", (hooks) => {
"should have a pie chart"
);
assert.strictEqual(
target.querySelector(".o_field_percent_pie.o_field_widget .o_pie .o_pie_value")
target.querySelector(".o_field_percent_pie.o_field_widget .o_pie_info .o_pie_value")
.textContent,
"10%",
"should have 10% as pie value since int_field=10"
);
assert.strictEqual(
target.querySelector(".o_field_percent_pie.o_field_widget .o_pie .o_mask").style
.transform,
"rotate(180deg)",
"left mask should be covering the whole left side of the pie"
);
assert.strictEqual(
target.querySelectorAll(".o_field_percent_pie.o_field_widget .o_pie .o_mask")[1].style
.transform,
"rotate(36deg)",
"right mask should be rotated from 360*(10/100) = 36 degrees"
);
assert.containsOnce(
target,
".o_field_percent_pie.o_field_widget .o_pie",
"should have a pie chart"
);
assert.strictEqual(
target.querySelector(".o_field_percent_pie.o_field_widget .o_pie .o_pie_value")
.textContent,
"10%",
"should have 10% as pie value since int_field=10"
);
assert.ok(
String(
target.querySelector(".o_field_percent_pie.o_field_widget .o_pie .o_mask").style
.transform
).includes("rotate(180deg)"),
"left mask should be covering the whole left side of the pie"
);
assert.ok(
String(
target.querySelectorAll(".o_field_percent_pie.o_field_widget .o_pie .o_mask")[1]
.style.transform
).includes("rotate(36deg)"),
"right mask should be rotated from 360*(10/100) = 36 degrees"
);
assert.containsOnce(
target,
".o_field_percent_pie.o_field_widget .o_pie",
"should have a pie chart"
);
assert.strictEqual(
target.querySelector(".o_field_percent_pie.o_field_widget .o_pie .o_pie_value")
.textContent,
"10%",
"should have 10% as pie value since int_field=10"
);
assert.strictEqual(
target.querySelector(".o_field_percent_pie.o_field_widget .o_pie .o_mask").style
.transform,
"rotate(180deg)",
"left mask should be covering the whole left side of the pie"
);
assert.strictEqual(
target.querySelectorAll(".o_field_percent_pie.o_field_widget .o_pie .o_mask")[1].style
.transform,
"rotate(36deg)",
"right mask should be rotated from 360*(10/100) = 36 degrees"
target.querySelector(".o_field_percent_pie.o_field_widget .o_pie").style.background,
"conic-gradient( var(--PercentPieField-color-active) 0% 10%, var(--PercentPieField-color-static) 0% 100% )",
"pie should have a background computed for its value of 10%"
);
});
@@ -154,117 +97,15 @@ QUnit.module("Fields", (hooks) => {
"should have a pie chart"
);
assert.strictEqual(
target.querySelector(".o_field_percent_pie.o_field_widget .o_pie .o_pie_value")
.textContent,
"80%",
"should have 80% as pie value since int_field=80"
);
assert.ok(
String(
target.querySelector(".o_field_percent_pie.o_field_widget .o_pie .o_mask").style
.transform
).includes("rotate(288deg)"),
"left mask should be rotated from 360*(80/100) = 288 degrees"
);
assert.hasClass(
target.querySelectorAll(".o_field_percent_pie.o_field_widget .o_pie .o_mask")[1],
"o_full",
"right mask should be hidden since the value > 50%"
);
assert.containsOnce(
target,
".o_field_percent_pie.o_field_widget .o_pie",
"should have a pie chart"
);
assert.strictEqual(
target.querySelector(".o_field_percent_pie.o_field_widget .o_pie .o_pie_value")
target.querySelector(".o_field_percent_pie.o_field_widget .o_pie_info .o_pie_value")
.textContent,
"80%",
"should have 80% as pie value since int_field=80"
);
assert.strictEqual(
target.querySelector(".o_field_percent_pie.o_field_widget .o_pie .o_mask").style
.transform,
"rotate(288deg)",
"left mask should be rotated from 360*(80/100) = 288 degrees"
);
assert.hasClass(
target.querySelectorAll(".o_field_percent_pie.o_field_widget .o_pie .o_mask")[1],
"o_full",
"right mask should be hidden since the value > 50%"
);
assert.containsOnce(
target,
".o_field_percent_pie.o_field_widget .o_pie",
"should have a pie chart"
);
assert.strictEqual(
target.querySelector(".o_field_percent_pie.o_field_widget .o_pie .o_pie_value")
.textContent,
"80%",
"should have 80% as pie value since int_field=80"
);
assert.strictEqual(
target.querySelector(".o_field_percent_pie.o_field_widget .o_pie .o_mask").style
.transform,
"rotate(288deg)",
"left mask should be rotated from 360*(80/100) = 288 degrees"
);
assert.hasClass(
target.querySelectorAll(".o_field_percent_pie.o_field_widget .o_pie .o_mask")[1],
"o_full",
"right mask should be hidden since the value > 50%"
target.querySelector(".o_field_percent_pie.o_field_widget .o_pie").style.background,
"conic-gradient( var(--PercentPieField-color-active) 0% 80%, var(--PercentPieField-color-static) 0% 100% )",
"pie should have a background computed for its value of 80%"
);
});
// TODO: This test would pass without any issue since all the classes and
// custom style attributes are correctly set on the widget in list
// view, but since the scss itself for this widget currently only
// applies inside the form view, the widget is unusable. This test can
// be uncommented when we refactor the scss files so that this widget
// stylesheet applies in both form and list view.
// QUnit.test('percentpie widget in editable list view', async function(assert) {
// assert.expect(10);
//
// var list = await createView({
// View: ListView,
// model: 'partner',
// data: this.data,
// arch: '<tree editable="bottom">' +
// '<field name="foo"/>' +
// '<field name="int_field" widget="percentpie"/>' +
// '</tree>',
// });
//
// assert.containsN(list, '.o_field_percent_pie .o_pie', 5,
// "should have five pie charts");
// assert.strictEqual(target.querySelector('.o_field_percent_pie:first .o_pie .o_pie_value').textContent,
// '10%', "should have 10% as pie value since int_field=10");
// assert.strictEqual(target.querySelector('.o_field_percent_pie:first .o_pie .o_mask').attr('style'),
// 'rotate(180deg)', "left mask should be covering the whole left side of the pie");
// assert.strictEqual(target.querySelector('.o_field_percent_pie:first .o_pie .o_mask').last().attr('style'),
// 'rotate(36deg)', "right mask should be rotated from 360*(10/100) = 36 degrees");
//
// // switch to edit mode and check the result
// testUtils.dom.click( target.querySelector('tbody td:not(.o_list_record_selector)'));
// assert.strictEqual(target.querySelector('.o_field_percent_pie:first .o_pie .o_pie_value').textContent,
// '10%', "should have 10% as pie value since int_field=10");
// assert.strictEqual(target.querySelector('.o_field_percent_pie:first .o_pie .o_mask').attr('style'),
// 'rotate(180deg)', "left mask should be covering the whole right side of the pie");
// assert.strictEqual(target.querySelector('.o_field_percent_pie:first .o_pie .o_mask').last().attr('style'),
// 'rotate(36deg)', "right mask should be rotated from 360*(10/100) = 36 degrees");
//
// // save
// testUtils.dom.click( list.$buttons.find('.o_list_button_save'));
// assert.strictEqual(target.querySelector('.o_field_percent_pie:first .o_pie .o_pie_value').textContent,
// '10%', "should have 10% as pie value since int_field=10");
// assert.strictEqual(target.querySelector('.o_field_percent_pie:first .o_pie .o_mask').attr('style'),
// 'rotate(180deg)', "left mask should be covering the whole right side of the pie");
// assert.strictEqual(target.querySelector('.o_field_percent_pie:first .o_pie .o_mask').last().attr('style'),
// 'rotate(36deg)', "right mask should be rotated from 360*(10/100) = 36 degrees");
//
// list.destroy();
// });
});
@@ -140,7 +140,11 @@ QUnit.module("Fields", (hooks) => {
await editInput(cell, "input", "new");
// save
await click(target.querySelector(".o_list_button_save"));
await click(
target.querySelector(
".o_control_panel_main_buttons .d-none.d-xl-inline-flex .o_list_button_save"
)
);
cell = target.querySelector("tbody td:not(.o_list_record_selector)");
assert.doesNotHaveClass(
cell.parentElement,
@@ -343,7 +343,10 @@ QUnit.module("Fields", (hooks) => {
assert.verifySteps(['write [[1],{"selection":"1"}]']);
assert.containsOnce(target, ".o_kanban_record .fa-star");
await click(target, ".o-kanban-button-new");
await click(
target,
".o_control_panel_main_buttons .d-none.d-xl-inline-flex .o-kanban-button-new"
);
await click(target, ".o_kanban_quick_create .o_kanban_add");
await click(target.querySelector(".o_priority a.o_priority_star.fa-star-o"), null, true);
assert.verifySteps(['write [[6],{"selection":"1"}]']);
@@ -404,7 +407,10 @@ QUnit.module("Fields", (hooks) => {
);
// save
await click(target, ".o_list_button_save");
await click(
target,
".o_control_panel_main_buttons .d-none.d-xl-inline-flex .o_list_button_save"
);
assert.containsN(
target.querySelectorAll(".o_data_row")[0],
@@ -514,7 +520,10 @@ QUnit.module("Fields", (hooks) => {
);
// save
await click(target, ".o_list_button_save");
await click(
target,
".o_control_panel_main_buttons .d-none.d-xl-inline-flex .o_list_button_save"
);
rows = target.querySelectorAll(".o_data_row");
assert.containsN(
@@ -1,9 +1,6 @@
/** @odoo-module **/
import {
makeFakeLocalizationService,
makeFakeNotificationService,
} from "@web/../tests/helpers/mock_services";
import { makeFakeLocalizationService } from "@web/../tests/helpers/mock_services";
import {
click,
clickSave,
@@ -507,13 +504,6 @@ QUnit.module("Fields", (hooks) => {
"ProgressBarField: write gibbrish instead of int throws warning",
async function (assert) {
serverData.models.partner.records[0].int_field = 99;
const mock = () => {
assert.step("Show error message");
return () => {};
};
registry.category("services").add("notification", makeFakeNotificationService(mock), {
force: true,
});
await makeView({
serverData,
@@ -535,7 +525,11 @@ QUnit.module("Fields", (hooks) => {
await editInput(target, ".o_progressbar_value .o_input", "trente sept virgule neuf");
await clickSave(target);
assert.containsOnce(target, ".o_form_dirty", "The form has not been saved");
assert.verifySteps(["Show error message"], "The error message was shown correctly");
assert.strictEqual(
target.querySelector(".o_form_button_save").disabled,
true,
"save button is disabled"
);
}
);
@@ -555,7 +549,8 @@ QUnit.module("Fields", (hooks) => {
});
assert.containsOnce(
target, ".o_progressbar .bg-warning",
target,
".o_progressbar .bg-warning",
"As the value has excedded the max value, the color should be set to bg-warning"
);
}
@@ -865,7 +865,7 @@ QUnit.module("Fields", (hooks) => {
mockRPC: (route, { method, args }) => {
if (method === "onchange") {
return {
value: {reference: "partner,2"},
value: { reference: "partner,2" },
};
} else if (method === "create") {
assert.strictEqual(args.length, 1);
@@ -874,10 +874,16 @@ QUnit.module("Fields", (hooks) => {
},
});
await click(target, '.o_list_button_add');
await click(
target,
".o_control_panel_main_buttons .d-none.d-xl-inline-flex .o_list_button_add"
);
await click(target, '.o_list_char[name="display_name"] input');
await editInput(target, '.o_list_char[name="display_name"] input', "Blabla");
await click(target, '.o_list_button_save');
await click(
target,
".o_control_panel_main_buttons .d-none.d-xl-inline-flex .o_list_button_save"
);
});
QUnit.test(
@@ -82,14 +82,18 @@ QUnit.module("Fields", (hooks) => {
".o_field_widget.o_field_state_selection span.o_status.o_status_green",
"should not have one green status since selection is the second, blocked state"
);
assert.containsNone(target, ".dropdown-menu", "there should not be a dropdown");
assert.containsNone(target, ".o_content .dropdown-menu", "there should not be a dropdown");
// Click on the status button to make the dropdown appear
await click(target, ".o_field_widget.o_field_state_selection .o_status");
assert.containsOnce(document.body, ".dropdown-menu", "there should be a dropdown");
assert.containsOnce(
document.body,
".o_content .dropdown-menu",
"there should be a dropdown"
);
assert.containsN(
target,
".dropdown-menu .dropdown-item",
".o_content .dropdown-menu .dropdown-item",
3,
"there should be three options in the dropdown"
);
@@ -100,8 +104,12 @@ QUnit.module("Fields", (hooks) => {
);
// Click on the first option, "Normal"
await click(target.querySelector(".dropdown-menu .dropdown-item"));
assert.containsNone(target, ".dropdown-menu", "there should not be a dropdown anymore");
await click(target.querySelector(".o_content .dropdown-menu .dropdown-item"));
assert.containsNone(
target,
".o_content .dropdown-menu",
"there should not be a dropdown anymore"
);
assert.containsNone(
target,
".o_field_widget.o_field_state_selection span.o_status.o_status_red",
@@ -118,7 +126,11 @@ QUnit.module("Fields", (hooks) => {
"should have one grey status since selection is the first, normal state"
);
assert.containsNone(target, ".dropdown-menu", "there should still not be a dropdown");
assert.containsNone(
target,
".o_content .dropdown-menu",
"there should still not be a dropdown"
);
assert.containsNone(
target,
".o_field_widget.o_field_state_selection span.o_status.o_status_red",
@@ -137,7 +149,7 @@ QUnit.module("Fields", (hooks) => {
// Click on the status button to make the dropdown appear
await click(target, ".o_field_widget.o_field_state_selection .o_status");
assert.containsOnce(target, ".dropdown-menu", "there should be a dropdown");
assert.containsOnce(target, ".o_content .dropdown-menu", "there should be a dropdown");
assert.containsN(
target,
".dropdown-menu .dropdown-item",
@@ -146,8 +158,12 @@ QUnit.module("Fields", (hooks) => {
);
// Click on the last option, "Done"
await click(target, ".dropdown-menu .dropdown-item:last-child");
assert.containsNone(target, ".dropdown-menu", "there should not be a dropdown anymore");
await click(target, ".o_content .dropdown-menu .dropdown-item:last-child");
assert.containsNone(
target,
".o_content .dropdown-menu",
"there should not be a dropdown anymore"
);
assert.containsNone(
target,
".o_field_widget.o_field_state_selection span.o_status.o_status_red",
@@ -163,7 +179,7 @@ QUnit.module("Fields", (hooks) => {
await click(target.querySelector(".o_form_button_save"));
assert.containsNone(
target,
".dropdown-menu",
".o_content .dropdown-menu",
"there should still not be a dropdown anymore"
);
assert.containsNone(
@@ -281,7 +297,7 @@ QUnit.module("Fields", (hooks) => {
".o_state_selection_cell .o_field_state_selection span.o_status.o_status_green",
"should have one green status"
);
assert.containsNone(target, ".dropdown-menu", "there should not be a dropdown");
assert.containsNone(target, ".o_content .dropdown-menu", "there should not be a dropdown");
// Click on the status button to make the dropdown appear
let cell = target.querySelector("tbody td.o_state_selection_cell");
@@ -293,16 +309,16 @@ QUnit.module("Fields", (hooks) => {
"o_selected_row",
"should not be in edit mode since we clicked on the state selection widget"
);
assert.containsOnce(target, ".dropdown-menu", "there should be a dropdown");
assert.containsOnce(target, ".o_content .dropdown-menu", "there should be a dropdown");
assert.containsN(
target,
".dropdown-menu .dropdown-item",
".o_content .dropdown-menu .dropdown-item",
3,
"there should be three options in the dropdown"
);
// Click on the first option, "Normal"
await click(target.querySelector(".dropdown-menu .dropdown-item"));
await click(target.querySelector(".o_content .dropdown-menu .dropdown-item"));
assert.containsN(
target,
".o_state_selection_cell .o_field_state_selection span.o_status",
@@ -319,7 +335,7 @@ QUnit.module("Fields", (hooks) => {
".o_state_selection_cell .o_field_state_selection span.o_status.o_status_green",
"should still have one green status"
);
assert.containsNone(target, ".dropdown-menu", "there should not be a dropdown");
assert.containsNone(target, ".o_content .dropdown-menu", "there should not be a dropdown");
assert.containsNone(target, "tr.o_selected_row", "should not be in edit mode");
// switch to edit mode and check the result
@@ -342,16 +358,16 @@ QUnit.module("Fields", (hooks) => {
".o_state_selection_cell .o_field_state_selection span.o_status.o_status_green",
"should still have one green status"
);
assert.containsNone(target, ".dropdown-menu", "there should not be a dropdown");
assert.containsNone(target, ".o_content .dropdown-menu", "there should not be a dropdown");
// Click on the status button to make the dropdown appear
await click(
target.querySelector(".o_state_selection_cell .o_field_state_selection span.o_status")
);
assert.containsOnce(target, ".dropdown-menu", "there should be a dropdown");
assert.containsOnce(target, ".o_content .dropdown-menu", "there should be a dropdown");
assert.containsN(
target,
".dropdown-menu .dropdown-item",
".o_content .dropdown-menu .dropdown-item",
3,
"there should be three options in the dropdown"
);
@@ -359,7 +375,11 @@ QUnit.module("Fields", (hooks) => {
// Click on another row
const lastCell = target.querySelectorAll("tbody td.o_state_selection_cell")[4];
await click(lastCell);
assert.containsNone(target, ".dropdown-menu", "there should not be a dropdown anymore");
assert.containsNone(
target,
".o_content .dropdown-menu",
"there should not be a dropdown anymore"
);
const firstCell = target.querySelector("tbody td.o_state_selection_cell");
assert.doesNotHaveClass(
firstCell.parentElement,
@@ -378,17 +398,21 @@ QUnit.module("Fields", (hooks) => {
".o_state_selection_cell .o_field_state_selection span.o_status"
)[3]
);
assert.containsOnce(target, ".dropdown-menu", "there should be a dropdown");
assert.containsOnce(target, ".o_content .dropdown-menu", "there should be a dropdown");
assert.containsN(
target,
".dropdown-menu .dropdown-item",
".o_content .dropdown-menu .dropdown-item",
3,
"there should be three options in the dropdown"
);
// Click on the last option, "Done"
await click(target, ".dropdown-menu .dropdown-item:last-child");
assert.containsNone(target, ".dropdown-menu", "there should not be a dropdown anymore");
await click(target, ".o_content .dropdown-menu .dropdown-item:last-child");
assert.containsNone(
target,
".o_content .dropdown-menu",
"there should not be a dropdown anymore"
);
assert.containsN(
target,
".o_state_selection_cell .o_field_state_selection span.o_status",
@@ -406,10 +430,14 @@ QUnit.module("Fields", (hooks) => {
2,
"should now have two green status"
);
assert.containsNone(target, ".dropdown-menu", "there should not be a dropdown");
assert.containsNone(target, ".o_content .dropdown-menu", "there should not be a dropdown");
// save
await click(target.querySelector(".o_list_button_save"));
await click(
target.querySelector(
".o_control_panel_main_buttons .d-none.d-xl-inline-flex .o_list_button_save"
)
);
assert.containsN(
target,
".o_state_selection_cell .o_field_state_selection span.o_status",
@@ -427,7 +455,7 @@ QUnit.module("Fields", (hooks) => {
2,
"should have two green status"
);
assert.containsNone(target, ".dropdown-menu", "there should not be a dropdown");
assert.containsNone(target, ".o_content .dropdown-menu", "there should not be a dropdown");
});
QUnit.test(
@@ -584,7 +584,11 @@ QUnit.module("Fields", (hooks) => {
arch: '<tree editable="top"><field name="foo"/></tree>',
});
await click(target.querySelector(".o_list_button_add"));
await click(
target.querySelector(
".o_control_panel_main_buttons .d-none.d-xl-inline-flex .o_list_button_add"
)
);
assert.strictEqual(
target.querySelector("textarea"),
@@ -226,7 +226,11 @@ QUnit.module("Fields", (hooks) => {
await editInput(cell, "input", "brolo");
// save
await click(target.querySelector(".o_list_button_save"));
await click(
target.querySelector(
".o_control_panel_main_buttons .d-none.d-xl-inline-flex .o_list_button_save"
)
);
cell = target.querySelector("tbody td:not(.o_list_record_selector)");
assert.doesNotHaveClass(
cell.parentElement,