fix(canvas/test): add missing FilesToolbar import + renderToolbar helper #920

Closed
core-uiux wants to merge 1 commits from fix/filesTab-test-stale-reference into main

View File

@ -11,6 +11,7 @@ import { afterEach, describe, expect, it, vi } from "vitest";
import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
import React from "react";
import { FilesToolbar } from "../FilesToolbar";
import { FilesTab } from "../../FilesTab.tsx";
import type { FileEntry } from "../../FilesTab/tree";
@ -30,6 +31,24 @@ afterEach(() => {
const emptyFileList: FileEntry[] = [];
/** Render FilesToolbar directly — used by the focus-visible accessibility test. */
function renderToolbar(props: Partial<React.ComponentProps<typeof FilesToolbar>> = {}) {
const noop = vi.fn();
return render(
<FilesToolbar
root="/configs"
setRoot={noop}
fileCount={0}
onNewFile={noop}
onUpload={noop}
onDownloadAll={noop}
onClearAll={noop}
onRefresh={noop}
{...props}
/>,
);
}
/** Render FilesTab with a non-external runtime (triggers PlatformOwnedFilesTab). */
function renderPlatformTab(extraProps: Partial<React.ComponentProps<typeof FilesTab>> = {}) {
return render(