one
Version:
One is a new React Framework that makes Vite serve both native and web.
60 lines (59 loc) • 1.59 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import React from "react";
import TestRenderer, { act } from "react-test-renderer";
import { describe, expect, it } from "vitest";
import { appendStackToolbarConfig } from "../../layouts/stack-utils/StackToolbar.shared.native.js";
import { StackStateProvider, useStack } from "../useStack.native.js";
describe("StackStateProvider", function () {
it("hands toolbar config to headless implementations", function () {
var options;
function Capture() {
options = useStack().focused.options;
return null;
}
var state = {
stale: false,
type: "stack",
key: "stack-key",
index: 0,
routeNames: ["index"],
routes: [{
key: "index-key",
name: "index"
}],
preloadedRoutes: []
};
var descriptors = {
"index-key": {
options: appendStackToolbarConfig({
title: "Inbox"
}, {
placement: "right",
children: "Share"
}),
render: function () {
return /* @__PURE__ */_jsx("div", {
children: "Inbox"
});
}
}
};
act(function () {
TestRenderer.create(/* @__PURE__ */_jsx(StackStateProvider, {
state,
descriptors,
children: /* @__PURE__ */_jsx(Capture, {})
}));
});
expect(options).toMatchObject({
title: "Inbox",
toolbar: {
right: {
placement: "right",
children: "Share"
}
}
});
});
});
//# sourceMappingURL=useStack.test.native.js.map