Strengthen shell behavior tests and profile toolbox loading
All checks were successful
Deploy Sokko G / deploy (push) Successful in 18s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 18s
This commit is contained in:
parent
a9b68a5712
commit
b53c7c17c8
8 changed files with 323 additions and 61 deletions
21
e2e/fixtures/shell-probe.js
Normal file
21
e2e/fixtures/shell-probe.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// Rôle : monte les vrais overlays et textes éditoriaux sous StrictMode pour tester leur cycle de vie.
|
||||
import { createElement, StrictMode } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { flushSync } from "react-dom";
|
||||
import { ConfirmModal, CreateToolboxModal, NotificationToast } from "../../website/src/components/ToolboxModals.jsx";
|
||||
import { RichText } from "../../website/src/components/RichText.jsx";
|
||||
|
||||
export function mountShellProbe(element) {
|
||||
const root = createRoot(element);
|
||||
const closed = [];
|
||||
const onClose = (value) => closed.push(value);
|
||||
function render({ confirm = false, create = false, toast = null, text = "" } = {}) {
|
||||
flushSync(() => root.render(createElement(StrictMode, null,
|
||||
confirm && createElement(ConfirmModal, { key: "confirm", title: "Confirmation test", message: "Continuer ?", onClose }),
|
||||
create && createElement(CreateToolboxModal, { key: "create", onClose }),
|
||||
toast && createElement(NotificationToast, { key: "toast", ...toast, onClose }),
|
||||
createElement("div", { id: "editorial-text", key: "text" }, createElement(RichText, { text }))
|
||||
)));
|
||||
}
|
||||
return { render, closed, unmount: () => root.unmount() };
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue