[FIX] web: tests: fields: color picker improve stop click test

Before this commit, we asserted that the view did not switch to form when clicking
on the the color picker. It was wrong because there is no action manager, hence no possibility
to effectively switch view.

After this commit, we assert that the list view's callback selectRecord is not called, which
is equivalent.

closes odoo/odoo#96159

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Lucas Perais
2022-07-18 18:42:17 +02:00
parent 6807eea38c
commit 2deb6aa1eb
@@ -133,7 +133,7 @@ QUnit.module("Fields", (hooks) => {
});
QUnit.test(
"stop event propagation on click to avoid oppening record on tree view",
"stop event propagation on click to avoid opening record on tree view",
async function (assert) {
await makeView({
type: "list",
@@ -142,24 +142,21 @@ QUnit.module("Fields", (hooks) => {
arch: `
<tree>
<field name="int_field" widget="color_picker"/>
<field name="display_name" />
</tree>`,
selectRecord() {
assert.step("record selected to open");
},
});
await click(target, ".o_field_color_picker button");
assert.strictEqual(
document.querySelectorAll(".o_list_renderer").length,
1,
"The current view should still be a list view"
);
assert.verifySteps([]);
await click(target, ".o_field_color_picker .o_colorlist_item_color_6");
assert.verifySteps([]);
assert.strictEqual(
document.querySelectorAll(".o_list_renderer").length,
1,
"The current view should still be a list view"
);
await click(target, ".o_data_row .o_data_cell:nth-child(2)");
assert.verifySteps(["record selected to open"]);
}
);