Skip to content

[IMP] html_builder: Tests for NavbarLinkPopover and MenuDataPlugin #4602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

dabo-odoo
Copy link

No description provided.

@robodoo
Copy link

robodoo commented May 7, 2025

This PR targets the un-managed branch odoo-dev/odoo:master-mysterious-egg, it needs to be retargeted before it can be merged.

@dabo-odoo dabo-odoo force-pushed the master-mysterious-egg-dabo-navbar-popover-tests branch 2 times, most recently from 0231f05 to 0b6ae9c Compare May 9, 2025 11:20
@dabo-odoo dabo-odoo force-pushed the master-mysterious-egg-dabo-navbar-popover-tests branch from 0b6ae9c to 5934928 Compare May 12, 2025 06:40
</ul>
<p>Outside</p>`
);
await waitFor(".o-we-linkpopover", { timeout: 1500 });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You always need this long timeout ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it can be completely removed if needed

Comment on lines 30 to 40
setContent(
el,
`<ul class="top_menu">
<li>
<a class="nav-link" href="exists">
<span>Top Me[]nu Item</span>
</a>
</li>
</ul>
<p>Outside</p>`
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way to set the selection is to use setSelection.
const anchorNode = el.querySelector(".nav-link > span)
setSelection({ anchorNode, anchorOffset: 4})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You just need less code

@@ -0,0 +1,273 @@
import { describe, expect, test } from "@odoo/hoot";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move your file in tests/website_builder/


defineWebsiteModels();

describe("Top Menu should open a NavbarLinkPopover", () => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NavbarLinkPopover

});
});

describe("should open dialogs when editing link or menu", () => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use the name of the component

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MenuDialog

};
},
};
mockService("orm", fakeORMService);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it s not enough to just mock the RPC ? (onRpc)

@dabo-odoo dabo-odoo force-pushed the master-mysterious-egg-dabo-navbar-popover-tests branch from 5934928 to bb21851 Compare May 12, 2025 12:45
@FrancoisGe FrancoisGe merged commit 9643ee5 into master-mysterious-egg May 12, 2025
@FrancoisGe FrancoisGe deleted the master-mysterious-egg-dabo-navbar-popover-tests branch May 12, 2025 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants