mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-20 17:12:06 +02:00
24 lines
966 B
JavaScript
24 lines
966 B
JavaScript
import { setupInteractionWhiteList, startInteractions } from "@web/../tests/public/helpers";
|
|
|
|
import { describe, expect, test } from "@odoo/hoot";
|
|
import { queryOne } from "@odoo/hoot-dom";
|
|
|
|
setupInteractionWhiteList("public.login");
|
|
|
|
describe.current.tags("interaction_dev");
|
|
|
|
test("add and remove loading effect", async () => {
|
|
const { core } = await startInteractions(`
|
|
<div class="oe_login_form">
|
|
<button type="submit">log in</button>
|
|
</div>`);
|
|
expect(core.interactions).toHaveLength(1);
|
|
// Not using manuallyDispatchProgrammaticEvent to keep a minimalist test. We
|
|
// don't need to send a proper "submit" event with FormData, method, action,
|
|
// etc. for this test.
|
|
const ev = new Event("submit");
|
|
queryOne(".oe_login_form").dispatchEvent(ev);
|
|
expect("button").toHaveClass(["o_btn_loading", "disabled"]);
|
|
ev.preventDefault();
|
|
expect("button").not.toHaveClass(["o_btn_loading", "disabled"]);
|
|
});
|