MCPcopy
hub / github.com/nilbuild/driver.js / addCustomFooterButton

Function addCustomFooterButton

tests/custom-buttons.test.ts:21–44  ·  view source on GitHub ↗
(opts: { keepDefaultStyle: boolean })

Source from the content-addressed store, hash-verified

19});
20
21function addCustomFooterButton(opts: { keepDefaultStyle: boolean }): {
22 button: HTMLButtonElement;
23 onClick: ReturnType<typeof vi.fn>;
24} {
25 const onClick = vi.fn();
26 const button = document.createElement("button");
27 button.id = "custom-footer-btn";
28 button.innerText = "Custom";
29 if (opts.keepDefaultStyle) {
30 button.classList.add("driver-popover-footer-btn");
31 }
32 button.addEventListener("click", onClick);
33
34 const d = createDriver({
35 animate: false,
36 steps: SAMPLE_STEPS,
37 onPopoverRender: popover => {
38 popover.footerButtons.appendChild(button);
39 },
40 });
41 d.drive();
42
43 return { button, onClick };
44}
45
46describe("footer button styling", () => {
47 it("styles the built-in navigation buttons through the footer button class", () => {

Callers 1

Calls 1

createDriverFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…