[REF] web: adapt uncorrect onchange test
In previous commit (https://github.com/odoo/odoo/pull/119214), this line was added to make the block onchange and check if the view was rerendered correctly, but having `await nextTick()` inside an RPC doesn't make sense. So we use `makeDeferrer()` which is the tool provided for that matter. closes odoo/odoo#122110 X-original-commit: a1056b1299f1edae736ea1ac00b6895e1c758104 Signed-off-by: Georis François (fge) <fge@odoo.com>
This commit is contained in:
@@ -18592,6 +18592,7 @@ QUnit.module("Views", (hooks) => {
|
||||
});
|
||||
|
||||
QUnit.test("x2many onchange, check result", async function (assert) {
|
||||
const def = makeDeferred();
|
||||
serverData.models.foo.onchanges = {
|
||||
m2m: function () {},
|
||||
};
|
||||
@@ -18607,7 +18608,7 @@ QUnit.module("Views", (hooks) => {
|
||||
async mockRPC(route, args) {
|
||||
if (args.method === "onchange") {
|
||||
assert.step("onchange");
|
||||
await nextTick();
|
||||
await def;
|
||||
return { value: { m2o: [3, "Value 3"] } };
|
||||
}
|
||||
},
|
||||
@@ -18626,6 +18627,9 @@ QUnit.module("Views", (hooks) => {
|
||||
|
||||
assert.verifySteps(["onchange"]);
|
||||
await click(target.querySelector(".o_list_button_save:not(.btn-link)"));
|
||||
def.resolve();
|
||||
await nextTick();
|
||||
|
||||
assert.strictEqual(
|
||||
target.querySelector(".o_data_cell.o_many2many_tags_cell").textContent,
|
||||
"Value 1Value 2Value 3"
|
||||
|
||||
Reference in New Issue
Block a user