Skip to content

Commit

Permalink
Fix compile errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenh committed Oct 17, 2024
1 parent d9a4926 commit 875b605
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/components/Stepper.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Step, Stepper } from "src/components/Stepper";
import { click, render } from "src/utils/rtl";
import { zeroTo } from "src/utils/sb";

describe(Stepper, () => {
describe("Stepper", () => {
it("renders and invokes onChange", async () => {
const onChange = jest.fn();
// Given the stepper with 3 steps. The first disabled and complete, the second incomplete, and the third in error state.
Expand Down
20 changes: 10 additions & 10 deletions src/components/SuperDrawer/useSuperDrawer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe("useSuperDrawer", () => {
const canCloseDrawerCheck = jest.fn(() => true);

// Given the useSuperDrawer hook
const hook = renderHook(useSuperDrawer, { wrapper }).result.current;
const hook = renderHook(useSuperDrawer, { wrapper: wrapper as any }).result.current;
// And a opened SuperDrawer
act(() => hook.openInDrawer({ content: "content" }));

Expand All @@ -55,8 +55,8 @@ describe("useSuperDrawer", () => {

it("should not add canCloseDrawerCheck when SuperDrawer is closed", () => {
// Given the useSuperDrawer hook
const superDrawerHook = renderHook(useSuperDrawer, { wrapper }).result.current;
const beamHook = renderHook(() => useBeamContext(), { wrapper }).result.current;
const superDrawerHook = renderHook(useSuperDrawer, { wrapper: wrapper as any }).result.current;
const beamHook = renderHook(() => useBeamContext(), { wrapper: wrapper as any }).result.current;

// When adding a canCloseDrawerCheck
act(() => superDrawerHook.addCanCloseDrawerCheck(() => true));
Expand All @@ -69,7 +69,7 @@ describe("useSuperDrawer", () => {
const canCloseDrawerDetailCheck = jest.fn(() => true);

// Given the useSuperDrawer hook
const hook = renderHook(useSuperDrawer, { wrapper }).result.current;
const hook = renderHook(useSuperDrawer, { wrapper: wrapper as any }).result.current;
// And a opened SuperDrawer with a detail content
act(() => {
hook.openInDrawer({ content: "content" });
Expand All @@ -88,8 +88,8 @@ describe("useSuperDrawer", () => {

it("should not add canCloseDrawerCheckDetail when SuperDrawer details is closed", () => {
// Given the useSuperDrawer and beamContent hook
const superDrawerHook = renderHook(useSuperDrawer, { wrapper }).result.current;
const beamHook = renderHook(() => useBeamContext(), { wrapper }).result.current;
const superDrawerHook = renderHook(useSuperDrawer, { wrapper: wrapper as any }).result.current;
const beamHook = renderHook(() => useBeamContext(), { wrapper: wrapper as any }).result.current;
// And a opened SuperDrawer with no detail content
act(() => {
superDrawerHook.openInDrawer({ content: "content" });
Expand All @@ -104,7 +104,7 @@ describe("useSuperDrawer", () => {

it("should show ConfirmCloseModal when a canCloseDrawerCheck fails", async () => {
// Given a useSuperDrawer and BeamContext hook
const hook = renderHook(useSuperDrawer, { wrapper }).result.current;
const hook = renderHook(useSuperDrawer, { wrapper: wrapper as any }).result.current;
// And a opened SuperDrawer
act(() => hook.openInDrawer({ content: "content" }));

Expand All @@ -117,7 +117,7 @@ describe("useSuperDrawer", () => {

it("should show ConfirmCloseModal when a canCloseDrawerDetailCheck fails", async () => {
// Given a useSuperDrawer and BeamContext hook
const hook = renderHook(useSuperDrawer, { wrapper }).result.current;
const hook = renderHook(useSuperDrawer, { wrapper: wrapper as any }).result.current;
// And a opened SuperDrawer
act(() => {
hook.openInDrawer({ content: "content" });
Expand All @@ -135,7 +135,7 @@ describe("useSuperDrawer", () => {
const onClose = jest.fn();

// Given the useSuperDrawer hook
const hook = renderHook(useSuperDrawer, { wrapper }).result.current;
const hook = renderHook(useSuperDrawer, { wrapper: wrapper as any }).result.current;

// When the drawer is opened and closed
act(() => hook.openInDrawer({ content: "content", onClose }));
Expand All @@ -149,7 +149,7 @@ describe("useSuperDrawer", () => {

it("should not throw when attempting to closeDrawer with an empty content stack", () => {
// Given a useSuperDrawer and BeamContext hook
const hook = renderHook(useSuperDrawer, { wrapper }).result.current;
const hook = renderHook(useSuperDrawer, { wrapper: wrapper as any }).result.current;
// And a closed SuperDrawer
// When we call onClose
// Then we do not expect to have an error thrown
Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/utils/RowStates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class RowStates<R extends Kinded> {
this.header.children = [this.keptGroupRow, ...this.topRows];

// Then mark any remaining as removed
for (const state of maybeKept) state.markRemoved();
for (const state of maybeKept) (state as any).markRemoved();

// After the first load of real data, we detach collapse state, to respect
// any incoming initCollapsed.
Expand Down
18 changes: 9 additions & 9 deletions src/components/Tabs.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe("TabsWithContent", () => {
it("renders tabs as links", async () => {
const router = withRouter("/tab1");
// Given tabs with `path` values
const testTabs: RouteTabWithContent<string>[] = [
const testTabs: RouteTabWithContent[] = [
{ name: "Tab A", path: "/tab1", href: "/tab1", render: () => <TestTabContent content="Tab 1 Content" /> },
{ name: "Tab B", path: "/tab2", href: "/tab2", render: () => <TestTabContent content="Tab 2 Content" /> },
];
Expand All @@ -125,9 +125,9 @@ describe("TabsWithContent", () => {

it("can match tab based on multiple paths", async () => {
// Given a route
const router = withRouter("/ce:1", "/:ceId");
const router = withRouter("/ce:1");
// And a tab that supports multiple routes
const testTabs: RouteTabWithContent<string>[] = [
const testTabs: RouteTabWithContent[] = [
{
name: "Tab A",
path: "/:ceId/line-items",
Expand All @@ -149,8 +149,8 @@ describe("TabsWithContent", () => {

it("can navigate between tabs when rendered as links", async () => {
// Given Route-able tabs, rendered at the first tab's route
const router = withRouter("/tab1", "/");
const testTabs: RouteTabWithContent<string>[] = [
const router = withRouter("/tab1");
const testTabs: RouteTabWithContent[] = [
{ name: "Tab A", path: "/tab1", href: "/tab1", render: () => <TestTabContent content="Tab 1 Content" /> },
{ name: "Tab B", path: "/tab2", href: "/tab2", render: () => <TestTabContent content="Tab 2 Content" /> },
];
Expand All @@ -169,8 +169,8 @@ describe("TabsWithContent", () => {

it("captures path parameters within Route context", async () => {
// Given Route-able tabs with path parameters
const router = withRouter("/ce:1/overview", "/");
const testTabs: RouteTabWithContent<string>[] = [
const router = withRouter("/ce:1/overview");
const testTabs: RouteTabWithContent[] = [
{ name: "Tab A", path: "/:ceId/overview", href: "/ce:1/overview", render: () => <TestRouteTab /> },
{
name: "Tab B",
Expand All @@ -192,13 +192,13 @@ describe("TabsWithContent", () => {

it("renders a disabled route tab as a div", async () => {
// Give a disabled tab (must include two non-disabled tabs to have tab-list show).
const testTabs: RouteTabWithContent<string>[] = [
const testTabs: RouteTabWithContent[] = [
{ name: "Tab A", path: "/a", href: "/a", render: () => <TestRouteTab /> },
{ name: "Tab B", path: "/b", href: "/b", render: () => <TestRouteTab /> },
{ name: "Tab C", path: "/c", href: "/c", render: () => <TestRouteTab />, disabled: true },
];

const r = await render(<TabsWithContent tabs={testTabs} />, withRouter("/a", ""));
const r = await render(<TabsWithContent tabs={testTabs} />, withRouter("/a"));

// Then the disabled tab should be rendered as a div
expect(r.tabs_tabC.tagName).toBe("DIV");
Expand Down
2 changes: 1 addition & 1 deletion src/forms/BoundTreeSelectField.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { NestedOption } from "src/inputs";
import { HasIdAndName } from "src/types";
import { blur, click, focus, render } from "src/utils/rtl";

describe(BoundTreeSelectField, () => {
describe("BoundTreeSelectField", () => {
it("shows the current value and label", async () => {
const author = createObjectState(formConfig, { favoriteGenres: ["g:4"] });
const r = await render(<BoundTreeSelectField field={author.favoriteGenres} options={genres} />);
Expand Down
2 changes: 1 addition & 1 deletion src/forms/FormStateApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function FormStateApp() {

const formState = useFormState({
config: formConfig,
init: queryResponse,
init: { input: queryResponse },
addRules(state) {
state.lastName.rules.push(() => {
return state.firstName.value === state.lastName.value ? "Last name cannot equal first name" : undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/inputs/NumberField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export function NumberField(props: NumberFieldProps) {
? { style: "unit", unit: "day", unitDisplay: "long" as const, maximumFractionDigits: 0 }
: {};

return { ...defaultFormatOptions, ...typeFormat };
return { ...defaultFormatOptions, ...typeFormat } as any;
}, [type, numberFormatOptions, defaultFormatOptions, numFractionDigits]);
const numberParser = useMemo(() => new NumberParser(locale, formatOptions), [locale, formatOptions]);

Expand Down
2 changes: 1 addition & 1 deletion src/utils/rtl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function render(
wrappers = [
...otherWrappers,
...(!omitBeamContext ? [withBeamRTL] : []),
...(at ? [_withRouter(at.url, at.route)] : [_withRouter()]),
...(at ? [_withRouter(at.url)] : [_withRouter()]),
];
} else {
wrappers = [withBeamRTL];
Expand Down
4 changes: 2 additions & 2 deletions src/utils/sb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { BeamProvider } from "src/components";
import { Css, Properties } from "src/Css";
import { withRouter as rtlWithRouter } from "src/utils/rtl";

export function withRouter(url?: string, path?: string): Decorator {
return (Story: () => JSX.Element) => rtlWithRouter(url, path).wrap(<Story />);
export function withRouter(url?: string): Decorator {
return (Story: () => JSX.Element) => rtlWithRouter(url).wrap(<Story />);
}

/* Models our currently used parameters. */
Expand Down

0 comments on commit 875b605

Please sign in to comment.