Add experiments folder. Add usage.md and SKILL.md. Fix Sheet interactions and add dynamic sheet mode.
This commit is contained in:
@@ -11,7 +11,7 @@ import { createNativeNavigationProfiler } from "./profiler";
|
||||
|
||||
const Page = defineComponent({ template: "<div>page</div>" });
|
||||
|
||||
async function harness(blockB: boolean | "redirect" = false) {
|
||||
async function harness(blockB: boolean | "redirect" = false, maxInactive = 2) {
|
||||
const router = createRouter({
|
||||
history: createMemoryHistory(),
|
||||
routes: [
|
||||
@@ -61,7 +61,7 @@ async function harness(blockB: boolean | "redirect" = false) {
|
||||
);
|
||||
await router.push("/a");
|
||||
await router.isReady();
|
||||
const native = createNativeRouter({ router, cache: { maxInactive: 2 } });
|
||||
const native = createNativeRouter({ router, cache: { maxInactive } });
|
||||
const app = createApp(Page);
|
||||
app.use(router);
|
||||
app.use(native);
|
||||
@@ -433,8 +433,15 @@ describe("native router transactions", () => {
|
||||
it("dismisses with the presented route animation regardless of the route below it", async () => {
|
||||
const { native } = await harness();
|
||||
await native.push("/b");
|
||||
const underlayKey = native.activeKey.value;
|
||||
await native.present("/modal", "sheet");
|
||||
|
||||
expect(
|
||||
native.entries.value.find(
|
||||
(entry) => entry.key === native.activeKey.value,
|
||||
),
|
||||
).toMatchObject({ presentation: "sheet", underlayKey });
|
||||
|
||||
await native.beginInteractive("dismiss");
|
||||
expect(native.transaction.value).toMatchObject({
|
||||
direction: "back",
|
||||
@@ -443,6 +450,19 @@ describe("native router transactions", () => {
|
||||
await native.cancelInteractive();
|
||||
});
|
||||
|
||||
it("protects a visible sheet underlay even when inactive caching is disabled", async () => {
|
||||
const { native } = await harness(false, 0);
|
||||
await native.push("/b");
|
||||
const underlayKey = native.activeKey.value;
|
||||
|
||||
await native.present("/modal", "sheet");
|
||||
|
||||
expect(
|
||||
native.entries.value.find((entry) => entry.key === underlayKey),
|
||||
).toMatchObject({ mounted: true, status: "inactive" });
|
||||
await native.dismiss();
|
||||
});
|
||||
|
||||
it("refuses to overlap a second transaction with an active gesture", async () => {
|
||||
const { native } = await harness();
|
||||
const first = await native.beginInteractive("push", "/b");
|
||||
|
||||
Reference in New Issue
Block a user