@uselets/ui 1.18.3 → 1.18.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{combobox-oMHLoLqV.js → combobox-ITDBYTtM.js} +2 -2
- package/dist/{combobox-oMHLoLqV.js.map → combobox-ITDBYTtM.js.map} +1 -1
- package/dist/{command-Ce8Ojl-B.js → command-BxkAy8PP.js} +2 -2
- package/dist/{command-Ce8Ojl-B.js.map → command-BxkAy8PP.js.map} +1 -1
- package/dist/components/accordion.spec.js +1 -1
- package/dist/components/alert-dialog.spec.js +1 -1
- package/dist/components/alert.spec.js +1 -1
- package/dist/components/anchor.spec.js +1 -1
- package/dist/components/area-chart.spec.js +1 -1
- package/dist/components/avatar.spec.js +1 -1
- package/dist/components/badge.spec.js +1 -1
- package/dist/components/bar-chart.spec.js +1 -1
- package/dist/components/breadcrumb.spec.js +1 -1
- package/dist/components/button-group.spec.js +1 -1
- package/dist/components/button.spec.js +1 -1
- package/dist/components/calendar.spec.js +1 -1
- package/dist/components/card.spec.js +1 -1
- package/dist/components/carousel.spec.js +1 -1
- package/dist/components/center.spec.js +1 -1
- package/dist/components/chart.spec.js +1 -1
- package/dist/components/checkbox.spec.js +1 -1
- package/dist/components/code.spec.js +1 -1
- package/dist/components/collapsible.spec.js +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/combobox.spec.js +1 -1
- package/dist/components/command.js +1 -1
- package/dist/components/command.spec.js +1 -1
- package/dist/components/container.spec.js +1 -1
- package/dist/components/data-table.js +1 -1
- package/dist/components/data-table.spec.js +1 -1
- package/dist/components/date-range-picker.js +1 -1
- package/dist/components/date-range-picker.spec.js +1 -1
- package/dist/components/dialog.spec.js +1 -1
- package/dist/components/donut-chart.spec.js +1 -1
- package/dist/components/drawer.spec.js +1 -1
- package/dist/components/dropdown-menu.spec.js +1 -1
- package/dist/components/dropzone.spec.js +1 -1
- package/dist/components/empty.spec.js +1 -1
- package/dist/components/field.spec.js +1 -1
- package/dist/components/flex.spec.js +1 -1
- package/dist/components/grid.spec.js +1 -1
- package/dist/components/group.spec.js +1 -1
- package/dist/components/heading.spec.js +1 -1
- package/dist/components/hover-card.spec.js +1 -1
- package/dist/components/input-group.js +1 -1
- package/dist/components/input-group.spec.js +1 -1
- package/dist/components/input-otp.spec.js +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/input.spec.js +1 -1
- package/dist/components/input.spec.js.map +1 -1
- package/dist/components/kbd.spec.js +1 -1
- package/dist/components/label.spec.js +1 -1
- package/dist/components/list.spec.js +1 -1
- package/dist/components/logo.spec.js +1 -1
- package/dist/components/marker.spec.js +1 -1
- package/dist/components/mask-input.js +1 -1
- package/dist/components/mask-input.spec.js +1 -1
- package/dist/components/native-select.js +1 -1
- package/dist/components/native-select.spec.js +1 -1
- package/dist/components/navigation-menu.spec.js +1 -1
- package/dist/components/number-field.spec.js +1 -1
- package/dist/components/pagination.spec.js +1 -1
- package/dist/components/phone-input.js +1 -1
- package/dist/components/phone-input.spec.js +1 -1
- package/dist/components/pie-chart.spec.js +1 -1
- package/dist/components/popover.spec.js +1 -1
- package/dist/components/progress.spec.js +1 -1
- package/dist/components/radio-group.spec.js +1 -1
- package/dist/components/resizable.spec.js +1 -1
- package/dist/components/ring-progress.spec.js +1 -1
- package/dist/components/scroll-area.spec.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/select.spec.js +1 -1
- package/dist/components/separator.spec.js +1 -1
- package/dist/components/sidebar.js +1 -1
- package/dist/components/sidebar.spec.js +1 -1
- package/dist/components/simple-grid.spec.js +1 -1
- package/dist/components/skeleton.spec.js +1 -1
- package/dist/components/slider.spec.js +1 -1
- package/dist/components/sonner.spec.js +1 -1
- package/dist/components/spinner.spec.js +1 -1
- package/dist/components/stack.spec.js +1 -1
- package/dist/components/stepper.spec.js +1 -1
- package/dist/components/switch.spec.js +1 -1
- package/dist/components/table.spec.js +1 -1
- package/dist/components/tabs.spec.js +1 -1
- package/dist/components/text.spec.js +1 -1
- package/dist/components/textarea.js +1 -1
- package/dist/components/textarea.spec.js +1 -1
- package/dist/components/theme.spec.js +1 -1
- package/dist/components/timeline.spec.js +1 -1
- package/dist/components/toggle-group.spec.js +1 -1
- package/dist/components/toggle.spec.js +1 -1
- package/dist/components/tooltip.spec.js +1 -1
- package/dist/components/unstyled-button.spec.js +1 -1
- package/dist/components/visibility.spec.js +1 -1
- package/dist/{data-table-tnfPcXqc.js → data-table-BGfSiHDT.js} +2 -2
- package/dist/{data-table-tnfPcXqc.js.map → data-table-BGfSiHDT.js.map} +1 -1
- package/dist/{date-range-picker-w3ZVRIII.js → date-range-picker-BjkVzFWQ.js} +2 -2
- package/dist/{date-range-picker-w3ZVRIII.js.map → date-range-picker-BjkVzFWQ.js.map} +1 -1
- package/dist/hooks/use-breakpoint-value.spec.js +1 -1
- package/dist/hooks/use-breakpoint-value.spec.js.map +1 -1
- package/dist/hooks/use-breakpoint.spec.js +1 -1
- package/dist/hooks/use-disclosure.spec.js +1 -1
- package/dist/hooks/use-document-visibility.spec.js +1 -1
- package/dist/hooks/use-hotkeys.spec.js +1 -1
- package/dist/hooks/use-idle.spec.js +1 -1
- package/dist/hooks/use-interval.spec.js +1 -1
- package/dist/hooks/use-local-storage.spec.js +1 -1
- package/dist/hooks/use-mask.spec.js +1 -1
- package/dist/hooks/use-mobile.spec.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{input-BhEEV_nn.js → input-CJLsPlXh.js} +2 -2
- package/dist/{input-BhEEV_nn.js.map → input-CJLsPlXh.js.map} +1 -1
- package/dist/{input-group-BUTp8vYe.js → input-group-mcar-tED.js} +2 -2
- package/dist/{input-group-BUTp8vYe.js.map → input-group-mcar-tED.js.map} +1 -1
- package/dist/{mask-input-BnifHAsJ.js → mask-input-cCmVKrHj.js} +2 -2
- package/dist/{mask-input-BnifHAsJ.js.map → mask-input-cCmVKrHj.js.map} +1 -1
- package/dist/{native-select-DZW3Y7nq.js → native-select-Iq25QUH-.js} +2 -2
- package/dist/native-select-Iq25QUH-.js.map +1 -0
- package/dist/{phone-input-ambhiSLO.js → phone-input-DqgYa1un.js} +2 -2
- package/dist/{phone-input-ambhiSLO.js.map → phone-input-DqgYa1un.js.map} +1 -1
- package/dist/{react.esm-BkhVXJ8s.js → react.esm-dE9nuHcL.js} +2 -2
- package/dist/{react.esm-BkhVXJ8s.js.map → react.esm-dE9nuHcL.js.map} +1 -1
- package/dist/select-CVwVLyWt.js +2 -0
- package/dist/select-CVwVLyWt.js.map +1 -0
- package/dist/{sidebar-f9maf3VF.js → sidebar-CJriMotD.js} +2 -2
- package/dist/{sidebar-f9maf3VF.js.map → sidebar-CJriMotD.js.map} +1 -1
- package/dist/skills/uselets-ui/references/package-guide.md +1 -1
- package/dist/styles/gomax.css +2 -0
- package/dist/styles/max.css +2 -0
- package/dist/styles/theme.css +1 -0
- package/dist/textarea-eJQTMC_d.js +2 -0
- package/dist/textarea-eJQTMC_d.js.map +1 -0
- package/package.json +13 -13
- package/skills/uselets-ui/references/package-guide.md +1 -1
- package/dist/native-select-DZW3Y7nq.js.map +0 -1
- package/dist/select-C3QYNv4t.js +0 -2
- package/dist/select-C3QYNv4t.js.map +0 -1
- package/dist/textarea-C8zrf9Rz.js +0 -2
- package/dist/textarea-C8zrf9Rz.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"../command-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"../command-BxkAy8PP.js";import{a as l,n as u,o as d,r as f}from"../react.esm-dE9nuHcL.js";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{useState as h}from"react";var MockResizeObserver=class{observe(){}unobserve(){}disconnect(){}};beforeAll(()=>{Element.prototype.scrollIntoView=vi.fn(),global.ResizeObserver=MockResizeObserver});function BasicCommand(){return m(c,{children:[p(e,{placeholder:`Search actions...`}),m(s,{children:[p(o,{children:`Nothing found.`}),m(n,{heading:`Shortcuts`,children:[m(a,{value:`changelog`,children:[`Open changelog`,p(r,{children:`G C`})]}),p(a,{value:`release`,children:`Generate release`})]}),p(t,{}),p(n,{heading:`Docs`,children:p(a,{value:`components`,children:`Components`})})]})]})}describe(`Command`,()=>{it(`renders the search input inside its wrapper with a search icon addon`,()=>{let{container:e}=f(p(BasicCommand,{}));expect(e.querySelector(`[data-slot="command-input-wrapper"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="command-input"]`)).not.toBeNull(),expect(l.getByPlaceholderText(`Search actions...`)).not.toBeNull()}),it(`renders groups, items, a separator and the shortcut hint`,()=>{let{container:e}=f(p(BasicCommand,{}));expect(l.getByText(`Shortcuts`)).not.toBeNull(),expect(l.getByText(`Docs`)).not.toBeNull(),expect(l.getByText(`Open changelog`)).not.toBeNull(),expect(l.getByText(`G C`)).not.toBeNull(),expect(e.querySelector(`[data-slot="command-separator"]`)).not.toBeNull()}),it(`filters items based on the input value and shows CommandEmpty when nothing matches`,()=>{f(p(BasicCommand,{}));let e=l.getByPlaceholderText(`Search actions...`);u.change(e,{target:{value:`components`}}),expect(l.queryByText(`Open changelog`)).toBeNull(),expect(l.getByText(`Components`)).not.toBeNull(),u.change(e,{target:{value:`this matches nothing`}}),expect(l.getByText(`Nothing found.`)).not.toBeNull()}),describe(`CommandItem`,()=>{it(`marks an item selected on pointer move via aria-selected and data-selected`,()=>{f(p(BasicCommand,{}));let e=l.getByText(`Components`).closest(`[data-slot="command-item"]`);u.pointerMove(e),expect(e.getAttribute(`aria-selected`)).toBe(`true`),expect(e.getAttribute(`data-selected`)).toBe(`true`)})})}),describe(`CommandDialog`,()=>{it(`renders the command palette inside a dialog and closes on Escape`,async()=>{function Wrapper(){let[t,n]=h(!0);return p(i,{open:t,onOpenChange:n,children:m(c,{children:[p(e,{placeholder:`Search actions...`}),m(s,{children:[p(o,{children:`Nothing found.`}),p(a,{value:`new-story`,children:`New story`})]})]})})}f(p(Wrapper,{})),expect(await l.findByRole(`dialog`)).not.toBeNull(),expect(l.getByText(`New story`)).not.toBeNull(),u.keyDown(document,{key:`Escape`,code:`Escape`}),await d(()=>expect(l.queryByRole(`dialog`)).toBeNull())}),it(`uses the provided title and description for the accessible header`,async()=>{f(p(i,{defaultOpen:!0,title:`Quick actions`,description:`Search and run a command`,children:p(c,{children:p(s,{children:p(a,{value:`only-item`,children:`Only item`})})})})),await l.findByRole(`dialog`),expect(l.getByText(`Quick actions`)).not.toBeNull(),expect(l.getByText(`Search and run a command`)).not.toBeNull()})});
|
|
2
2
|
//# sourceMappingURL=command.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../container-CikeKdez.js";import{r as t}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../container-CikeKdez.js";import{r as t}from"../react.esm-dE9nuHcL.js";import{jsx as n}from"react/jsx-runtime";describe(`Container`,()=>{it(`renders a div with the default size and data-slot`,()=>{let{container:r}=t(n(e,{children:`Content`})),i=r.querySelector(`[data-slot="container"]`);expect(i).not.toBeNull(),expect(i?.tagName).toBe(`DIV`),expect(i?.getAttribute(`data-size`)).toBe(`lg`),expect(i?.className).toContain(`max-w-7xl`),expect(i?.className).toContain(`mx-auto`)}),it(`applies the sm size variant`,()=>{let{container:r}=t(n(e,{size:`sm`,children:`Content`})),i=r.querySelector(`[data-slot="container"]`);expect(i?.getAttribute(`data-size`)).toBe(`sm`),expect(i?.className).toContain(`max-w-3xl`)}),it(`applies the full size variant`,()=>{let{container:r}=t(n(e,{size:`full`,children:`Content`})),i=r.querySelector(`[data-slot="container"]`);expect(i?.getAttribute(`data-size`)).toBe(`full`),expect(i?.className).toContain(`max-w-none`)}),it(`merges a custom className with the base styling`,()=>{let{container:r}=t(n(e,{className:`custom-container`,children:`Content`})),i=r.querySelector(`[data-slot="container"]`);expect(i?.className).toContain(`custom-container`),expect(i?.className).toContain(`w-full`)}),it(`forwards the ref to the underlying div element`,()=>{let r={current:null};t(n(e,{ref:r,children:`Content`})),expect(r.current).not.toBeNull(),expect(r.current?.getAttribute(`data-slot`)).toBe(`container`)})});
|
|
2
2
|
//# sourceMappingURL=container.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"../data-table-
|
|
1
|
+
import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"../data-table-BGfSiHDT.js";export{u as DataTable,o as DataTableBody,c as DataTableColumnHeader,i as DataTableHeader,e as DataTablePagination,s as DataTableRoot,l as DataTableToolbar,t as DataTableViewOptions,a as createDataTableSelectColumn,d as defaultDataTableLabels,n as useDataTable,r as useDataTableContext};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../table-CuE0Aenj.js";import{a as t,c as n,d as r,f as i,i as a,l as o,n as s,o as c,r as l,t as u,u as d}from"../data-table-tnfPcXqc.js";import{a as f,n as p,r as m}from"../react.esm-BkhVXJ8s.js";import{jsx as h,jsxs as g}from"react/jsx-runtime";const _=[{id:`1`,name:`Ada Lovelace`,email:`ada@example.com`,age:36},{id:`2`,name:`Grace Hopper`,email:`grace@example.com`,age:85},{id:`3`,name:`Alan Turing`,email:`alan@example.com`,age:41},{id:`4`,name:`Katherine Johnson`,email:`katherine@example.com`,age:101},{id:`5`,name:`Margaret Hamilton`,email:`margaret@example.com`,age:89}],v=[{accessorKey:`name`,header:({column:e})=>h(l,{column:e,title:`Name`}),cell:({row:e})=>e.getValue(`name`)},{accessorKey:`email`,header:`Email`,cell:({row:e})=>e.getValue(`email`)},{accessorKey:`age`,header:`Age`,cell:({row:e})=>e.getValue(`age`)}];function getBodyRowNames(e){return Array.from(e.querySelectorAll(`[data-slot="table-body"] [data-slot="table-row"]`)).map(e=>e.querySelector(`[data-slot="table-cell"]`)?.textContent)}describe(`DataTable`,()=>{it(`renders a header cell per column and a body row per data item`,()=>{let{container:e}=m(h(u,{columns:v,data:_}));expect(f.getByRole(`columnheader`,{name:`Email`})).not.toBeNull(),expect(f.getByRole(`columnheader`,{name:`Age`})).not.toBeNull(),expect(e.querySelectorAll(`[data-slot="table-body"] [data-slot="table-row"]`)).toHaveLength(_.length),expect(f.getByText(`Ada Lovelace`)).not.toBeNull(),expect(f.getByText(`katherine@example.com`)).not.toBeNull()}),it(`renders the default empty-state message spanning all columns when data is empty`,()=>{let{container:e}=m(h(u,{columns:v,data:[]})),t=e.querySelector(`[data-slot="table-body"] [data-slot="table-cell"]`);expect(f.getByText(d.emptyMessage)).not.toBeNull(),expect(t?.getAttribute(`colspan`)).toBe(String(v.length))}),it(`renders a custom empty message provided via labels`,()=>{m(h(u,{columns:v,data:[],labels:{emptyMessage:`No people found`}})),expect(f.getByText(`No people found`)).not.toBeNull(),expect(f.queryByText(d.emptyMessage)).toBeNull()}),it(`sorts rows ascending, then descending, then clears sorting on repeated header clicks`,()=>{let{container:e}=m(h(u,{columns:v,data:_,enableSorting:!0})),t=f.getByRole(`button`);p.click(t),expect(getBodyRowNames(e)).toEqual([`Ada Lovelace`,`Alan Turing`,`Grace Hopper`,`Katherine Johnson`,`Margaret Hamilton`]),p.click(t),expect(getBodyRowNames(e)).toEqual([`Margaret Hamilton`,`Katherine Johnson`,`Grace Hopper`,`Alan Turing`,`Ada Lovelace`]),p.click(t),expect(getBodyRowNames(e)).toEqual(_.map(e=>e.name))}),it(`does not render a sort toggle when sorting is disabled at the table level`,()=>{m(h(u,{columns:v,data:_})),expect(f.queryByRole(`button`)).toBeNull()}),it(`supports row selection with header select-all and per-row checkboxes`,()=>{m(h(u,{columns:v,data:_,enableRowSelection:!0}));let e=f.getByRole(`checkbox`,{name:d.selectAllRows}),t=f.getAllByRole(`checkbox`,{name:d.selectRow});expect(t).toHaveLength(_.length),expect(e.getAttribute(`data-state`)).toBe(`unchecked`),p.click(t[0]),expect(t[0].getAttribute(`data-state`)).toBe(`checked`),expect(e.getAttribute(`data-state`)).toBe(`indeterminate`),p.click(e);for(let e of f.getAllByRole(`checkbox`,{name:d.selectRow}))expect(e.getAttribute(`data-state`)).toBe(`checked`);expect(e.getAttribute(`data-state`)).toBe(`checked`)}),it(`does not prepend a second select column when the columns already define one`,()=>{let e=[{id:`select`,header:()=>`S`,cell:()=>`x`},...v];m(h(u,{columns:e,data:_,enableRowSelection:!0})),expect(f.getAllByRole(`columnheader`)).toHaveLength(e.length)}),it(`actually paginates rows when showPagination is set`,()=>{let{container:e}=m(h(u,{columns:v,data:_,showPagination:!0,pageSize:2}));expect(getBodyRowNames(e)).toEqual([`Ada Lovelace`,`Grace Hopper`])})}),describe(`DataTableToolbar`,()=>{it(`renders no toolbar content when there is no filter, no toolbarActions, and column visibility is off`,()=>{let{container:e}=m(h(u,{columns:v,data:_}));expect(e.querySelector(`[data-slot="input"]`)).toBeNull(),expect(f.queryByRole(`button`,{name:d.columnsButton})).toBeNull()}),it(`filters rows by a single column via the toolbar input`,()=>{let{container:e}=m(h(u,{columns:v,data:_,filterColumns:`name`})),t=f.getByPlaceholderText(d.filterPlaceholder);p.change(t,{target:{value:`ada`}}),expect(getBodyRowNames(e)).toEqual([`Ada Lovelace`])}),it(`lets the active filter column be switched and resets the previous filter value`,()=>{let{container:e}=m(h(u,{columns:v,data:_,filterColumns:[`name`,`email`]})),t=f.getByLabelText(d.filterColumnSelectorLabel),n=f.getByPlaceholderText(d.filterPlaceholder);p.change(n,{target:{value:`ada`}}),expect(getBodyRowNames(e)).toEqual([`Ada Lovelace`]),p.change(t,{target:{value:`email`}}),expect(getBodyRowNames(e)).toEqual(_.map(e=>e.name)),p.change(n,{target:{value:`grace@`}}),expect(getBodyRowNames(e)).toEqual([`Grace Hopper`])}),it(`renders static toolbarActions content`,()=>{m(h(u,{columns:v,data:_,toolbarActions:h(`button`,{type:`button`,children:`Export`})})),expect(f.getByRole(`button`,{name:`Export`})).not.toBeNull()}),it(`renders function toolbarActions with access to the live table instance`,()=>{m(h(u,{columns:v,data:_,toolbarActions:e=>g(`span`,{children:[e.getRowModel().rows.length,` rows`]})})),expect(f.getByText(`${_.length} rows`)).not.toBeNull()}),it(`renders the column-visibility button when showColumnVisibility is set`,()=>{m(h(u,{columns:v,data:_,showColumnVisibility:!0})),expect(f.getByRole(`button`,{name:d.columnsButton})).not.toBeNull()})}),describe(`DataTableColumnHeader`,()=>{function fakeColumn(e){return{getCanSort:e.getCanSort??(()=>!0),getIsSorted:e.getIsSorted??(()=>!1),toggleSorting:e.toggleSorting??(()=>{}),clearSorting:e.clearSorting??(()=>{})}}it(`renders only the title, with no sort control, when the column cannot sort`,()=>{let{container:e}=m(h(l,{column:fakeColumn({getCanSort:()=>!1}),title:`Name`}));expect(f.getByText(`Name`)).not.toBeNull(),expect(e.querySelector(`button`)).toBeNull()}),it(`toggles to ascending sort when clicked while unsorted`,()=>{let e=vi.fn(),{container:t}=m(h(l,{column:fakeColumn({getIsSorted:()=>!1,toggleSorting:e}),title:`Name`}));p.click(t.querySelector(`button`)),expect(e).toHaveBeenCalledWith(!1)}),it(`toggles to descending sort when clicked while sorted ascending`,()=>{let e=vi.fn(),{container:t}=m(h(l,{column:fakeColumn({getIsSorted:()=>`asc`,toggleSorting:e}),title:`Name`}));p.click(t.querySelector(`button`)),expect(e).toHaveBeenCalledWith(!0)}),it(`clears sorting when clicked while sorted descending`,()=>{let e=vi.fn(),{container:t}=m(h(l,{column:fakeColumn({getIsSorted:()=>`desc`,clearSorting:e}),title:`Name`}));p.click(t.querySelector(`button`)),expect(e).toHaveBeenCalledTimes(1)})}),describe(`DataTablePagination`,()=>{it(`throws when rendered without a table prop or DataTableRoot context`,()=>{expect(()=>m(h(t,{}))).toThrow("DataTablePagination requires a `table` prop or to be rendered within <DataTableRoot>")}),it(`paginates rows and updates page/button state when navigating first/next/last/previous`,()=>{let{container:n}=m(g(c,{columns:v,data:_,enablePagination:!0,pageSize:2,children:[g(e,{children:[h(a,{}),h(s,{})]}),h(t,{})]}));expect(getBodyRowNames(n)).toEqual([`Ada Lovelace`,`Grace Hopper`]),expect(f.getByText(d.pageOf(1,3))).not.toBeNull(),expect(f.getByRole(`button`,{name:d.goToPreviousPage}).disabled).toBe(!0),p.click(f.getByRole(`button`,{name:d.goToNextPage})),expect(getBodyRowNames(n)).toEqual([`Alan Turing`,`Katherine Johnson`]),expect(f.getByText(d.pageOf(2,3))).not.toBeNull(),p.click(f.getByRole(`button`,{name:d.goToLastPage})),expect(getBodyRowNames(n)).toEqual([`Margaret Hamilton`]),expect(f.getByRole(`button`,{name:d.goToNextPage}).disabled).toBe(!0),p.click(f.getByRole(`button`,{name:d.goToFirstPage})),expect(getBodyRowNames(n)).toEqual([`Ada Lovelace`,`Grace Hopper`]),p.click(f.getByRole(`button`,{name:d.goToNextPage})),p.click(f.getByRole(`button`,{name:d.goToPreviousPage})),expect(getBodyRowNames(n)).toEqual([`Ada Lovelace`,`Grace Hopper`])})}),describe(`DataTableViewOptions`,()=>{it(`throws when rendered without a table prop or DataTableRoot context`,()=>{expect(()=>m(h(n,{}))).toThrow("DataTableViewOptions requires a `table` prop or to be rendered within <DataTableRoot>")}),it(`renders nothing when there are no hideable columns`,()=>{let{container:e}=m(h(n,{table:{getAllColumns:()=>[]}}));expect(e.firstChild).toBeNull()}),it(`opens the dropdown and hides a column when its checkbox item is toggled off`,()=>{let{container:e}=m(h(u,{columns:v,data:_,showColumnVisibility:!0})),t=f.getByRole(`button`,{name:d.columnsButton});p.pointerDown(t,{button:0,pointerId:1}),p.pointerUp(t,{button:0,pointerId:1});let n=f.getByRole(`menuitemcheckbox`,{name:`email`});p.pointerDown(n,{button:0,pointerId:1}),p.pointerUp(n,{button:0,pointerId:1}),p.click(n),expect(f.queryByRole(`columnheader`,{name:`Email`})).toBeNull(),expect(e.querySelector(`[data-slot="table-container"]`)).not.toBeNull()})}),describe(`createDataTableSelectColumn`,()=>{it(`returns a non-sortable, non-hideable select column definition`,()=>{let e=o();expect(e.id).toBe(`select`),expect(e.enableSorting).toBe(!1),expect(e.enableHiding).toBe(!1),expect(typeof e.header).toBe(`function`),expect(typeof e.cell).toBe(`function`)}),it(`uses custom select-all and select-row labels when the table provides them`,()=>{m(h(u,{columns:v,data:_,enableRowSelection:!0,labels:{selectAllRows:`Pick all`,selectRow:`Pick one`}})),expect(f.getByRole(`checkbox`,{name:`Pick all`})).not.toBeNull(),expect(f.getAllByRole(`checkbox`,{name:`Pick one`})).toHaveLength(_.length)})}),describe(`useDataTable`,()=>{function Harness(e){return h(`span`,{"data-testid":`column-count`,children:r(e).getAllColumns().length})}it(`does not add a select column when row selection is disabled`,()=>{m(h(Harness,{columns:v,data:_})),expect(f.getByTestId(`column-count`).textContent).toBe(String(v.length))}),it(`prepends a select column when row selection is enabled`,()=>{m(h(Harness,{columns:v,data:_,enableRowSelection:!0})),expect(f.getByTestId(`column-count`).textContent).toBe(String(v.length+1))})}),describe(`DataTableRoot`,()=>{it(`renders children within context when given an externally created table (controlled mode)`,()=>{function Wrapper(){return h(c,{table:r({columns:v,data:_}),children:g(e,{children:[h(a,{}),h(s,{})]})})}let{container:t}=m(h(Wrapper,{}));expect(t.querySelectorAll(`[data-slot="table-body"] [data-slot="table-row"]`)).toHaveLength(_.length)}),it(`builds its own table from columns and data when no table prop is given (uncontrolled mode)`,()=>{let{container:t}=m(h(c,{columns:v,data:_,children:g(e,{children:[h(a,{}),h(s,{})]})}));expect(t.querySelectorAll(`[data-slot="table-body"] [data-slot="table-row"]`)).toHaveLength(_.length)}),it(`applies the className to the wrapping element`,()=>{let{container:t}=m(h(c,{columns:v,data:_,className:`custom-root`,children:h(e,{children:h(a,{})})}));expect(t.firstChild.className).toContain(`custom-root`)})}),describe(`useDataTableContext`,()=>{it(`throws a descriptive error when called outside of DataTableRoot`,()=>{function Consumer(){return i(),null}expect(()=>m(h(Consumer,{}))).toThrow(`useDataTableContext must be used within <DataTableRoot>`)})});
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../table-CuE0Aenj.js";import{a as t,c as n,d as r,f as i,i as a,l as o,n as s,o as c,r as l,t as u,u as d}from"../data-table-BGfSiHDT.js";import{a as f,n as p,r as m}from"../react.esm-dE9nuHcL.js";import{jsx as h,jsxs as g}from"react/jsx-runtime";const _=[{id:`1`,name:`Ada Lovelace`,email:`ada@example.com`,age:36},{id:`2`,name:`Grace Hopper`,email:`grace@example.com`,age:85},{id:`3`,name:`Alan Turing`,email:`alan@example.com`,age:41},{id:`4`,name:`Katherine Johnson`,email:`katherine@example.com`,age:101},{id:`5`,name:`Margaret Hamilton`,email:`margaret@example.com`,age:89}],v=[{accessorKey:`name`,header:({column:e})=>h(l,{column:e,title:`Name`}),cell:({row:e})=>e.getValue(`name`)},{accessorKey:`email`,header:`Email`,cell:({row:e})=>e.getValue(`email`)},{accessorKey:`age`,header:`Age`,cell:({row:e})=>e.getValue(`age`)}];function getBodyRowNames(e){return Array.from(e.querySelectorAll(`[data-slot="table-body"] [data-slot="table-row"]`)).map(e=>e.querySelector(`[data-slot="table-cell"]`)?.textContent)}describe(`DataTable`,()=>{it(`renders a header cell per column and a body row per data item`,()=>{let{container:e}=m(h(u,{columns:v,data:_}));expect(f.getByRole(`columnheader`,{name:`Email`})).not.toBeNull(),expect(f.getByRole(`columnheader`,{name:`Age`})).not.toBeNull(),expect(e.querySelectorAll(`[data-slot="table-body"] [data-slot="table-row"]`)).toHaveLength(_.length),expect(f.getByText(`Ada Lovelace`)).not.toBeNull(),expect(f.getByText(`katherine@example.com`)).not.toBeNull()}),it(`renders the default empty-state message spanning all columns when data is empty`,()=>{let{container:e}=m(h(u,{columns:v,data:[]})),t=e.querySelector(`[data-slot="table-body"] [data-slot="table-cell"]`);expect(f.getByText(d.emptyMessage)).not.toBeNull(),expect(t?.getAttribute(`colspan`)).toBe(String(v.length))}),it(`renders a custom empty message provided via labels`,()=>{m(h(u,{columns:v,data:[],labels:{emptyMessage:`No people found`}})),expect(f.getByText(`No people found`)).not.toBeNull(),expect(f.queryByText(d.emptyMessage)).toBeNull()}),it(`sorts rows ascending, then descending, then clears sorting on repeated header clicks`,()=>{let{container:e}=m(h(u,{columns:v,data:_,enableSorting:!0})),t=f.getByRole(`button`);p.click(t),expect(getBodyRowNames(e)).toEqual([`Ada Lovelace`,`Alan Turing`,`Grace Hopper`,`Katherine Johnson`,`Margaret Hamilton`]),p.click(t),expect(getBodyRowNames(e)).toEqual([`Margaret Hamilton`,`Katherine Johnson`,`Grace Hopper`,`Alan Turing`,`Ada Lovelace`]),p.click(t),expect(getBodyRowNames(e)).toEqual(_.map(e=>e.name))}),it(`does not render a sort toggle when sorting is disabled at the table level`,()=>{m(h(u,{columns:v,data:_})),expect(f.queryByRole(`button`)).toBeNull()}),it(`supports row selection with header select-all and per-row checkboxes`,()=>{m(h(u,{columns:v,data:_,enableRowSelection:!0}));let e=f.getByRole(`checkbox`,{name:d.selectAllRows}),t=f.getAllByRole(`checkbox`,{name:d.selectRow});expect(t).toHaveLength(_.length),expect(e.getAttribute(`data-state`)).toBe(`unchecked`),p.click(t[0]),expect(t[0].getAttribute(`data-state`)).toBe(`checked`),expect(e.getAttribute(`data-state`)).toBe(`indeterminate`),p.click(e);for(let e of f.getAllByRole(`checkbox`,{name:d.selectRow}))expect(e.getAttribute(`data-state`)).toBe(`checked`);expect(e.getAttribute(`data-state`)).toBe(`checked`)}),it(`does not prepend a second select column when the columns already define one`,()=>{let e=[{id:`select`,header:()=>`S`,cell:()=>`x`},...v];m(h(u,{columns:e,data:_,enableRowSelection:!0})),expect(f.getAllByRole(`columnheader`)).toHaveLength(e.length)}),it(`actually paginates rows when showPagination is set`,()=>{let{container:e}=m(h(u,{columns:v,data:_,showPagination:!0,pageSize:2}));expect(getBodyRowNames(e)).toEqual([`Ada Lovelace`,`Grace Hopper`])})}),describe(`DataTableToolbar`,()=>{it(`renders no toolbar content when there is no filter, no toolbarActions, and column visibility is off`,()=>{let{container:e}=m(h(u,{columns:v,data:_}));expect(e.querySelector(`[data-slot="input"]`)).toBeNull(),expect(f.queryByRole(`button`,{name:d.columnsButton})).toBeNull()}),it(`filters rows by a single column via the toolbar input`,()=>{let{container:e}=m(h(u,{columns:v,data:_,filterColumns:`name`})),t=f.getByPlaceholderText(d.filterPlaceholder);p.change(t,{target:{value:`ada`}}),expect(getBodyRowNames(e)).toEqual([`Ada Lovelace`])}),it(`lets the active filter column be switched and resets the previous filter value`,()=>{let{container:e}=m(h(u,{columns:v,data:_,filterColumns:[`name`,`email`]})),t=f.getByLabelText(d.filterColumnSelectorLabel),n=f.getByPlaceholderText(d.filterPlaceholder);p.change(n,{target:{value:`ada`}}),expect(getBodyRowNames(e)).toEqual([`Ada Lovelace`]),p.change(t,{target:{value:`email`}}),expect(getBodyRowNames(e)).toEqual(_.map(e=>e.name)),p.change(n,{target:{value:`grace@`}}),expect(getBodyRowNames(e)).toEqual([`Grace Hopper`])}),it(`renders static toolbarActions content`,()=>{m(h(u,{columns:v,data:_,toolbarActions:h(`button`,{type:`button`,children:`Export`})})),expect(f.getByRole(`button`,{name:`Export`})).not.toBeNull()}),it(`renders function toolbarActions with access to the live table instance`,()=>{m(h(u,{columns:v,data:_,toolbarActions:e=>g(`span`,{children:[e.getRowModel().rows.length,` rows`]})})),expect(f.getByText(`${_.length} rows`)).not.toBeNull()}),it(`renders the column-visibility button when showColumnVisibility is set`,()=>{m(h(u,{columns:v,data:_,showColumnVisibility:!0})),expect(f.getByRole(`button`,{name:d.columnsButton})).not.toBeNull()})}),describe(`DataTableColumnHeader`,()=>{function fakeColumn(e){return{getCanSort:e.getCanSort??(()=>!0),getIsSorted:e.getIsSorted??(()=>!1),toggleSorting:e.toggleSorting??(()=>{}),clearSorting:e.clearSorting??(()=>{})}}it(`renders only the title, with no sort control, when the column cannot sort`,()=>{let{container:e}=m(h(l,{column:fakeColumn({getCanSort:()=>!1}),title:`Name`}));expect(f.getByText(`Name`)).not.toBeNull(),expect(e.querySelector(`button`)).toBeNull()}),it(`toggles to ascending sort when clicked while unsorted`,()=>{let e=vi.fn(),{container:t}=m(h(l,{column:fakeColumn({getIsSorted:()=>!1,toggleSorting:e}),title:`Name`}));p.click(t.querySelector(`button`)),expect(e).toHaveBeenCalledWith(!1)}),it(`toggles to descending sort when clicked while sorted ascending`,()=>{let e=vi.fn(),{container:t}=m(h(l,{column:fakeColumn({getIsSorted:()=>`asc`,toggleSorting:e}),title:`Name`}));p.click(t.querySelector(`button`)),expect(e).toHaveBeenCalledWith(!0)}),it(`clears sorting when clicked while sorted descending`,()=>{let e=vi.fn(),{container:t}=m(h(l,{column:fakeColumn({getIsSorted:()=>`desc`,clearSorting:e}),title:`Name`}));p.click(t.querySelector(`button`)),expect(e).toHaveBeenCalledTimes(1)})}),describe(`DataTablePagination`,()=>{it(`throws when rendered without a table prop or DataTableRoot context`,()=>{expect(()=>m(h(t,{}))).toThrow("DataTablePagination requires a `table` prop or to be rendered within <DataTableRoot>")}),it(`paginates rows and updates page/button state when navigating first/next/last/previous`,()=>{let{container:n}=m(g(c,{columns:v,data:_,enablePagination:!0,pageSize:2,children:[g(e,{children:[h(a,{}),h(s,{})]}),h(t,{})]}));expect(getBodyRowNames(n)).toEqual([`Ada Lovelace`,`Grace Hopper`]),expect(f.getByText(d.pageOf(1,3))).not.toBeNull(),expect(f.getByRole(`button`,{name:d.goToPreviousPage}).disabled).toBe(!0),p.click(f.getByRole(`button`,{name:d.goToNextPage})),expect(getBodyRowNames(n)).toEqual([`Alan Turing`,`Katherine Johnson`]),expect(f.getByText(d.pageOf(2,3))).not.toBeNull(),p.click(f.getByRole(`button`,{name:d.goToLastPage})),expect(getBodyRowNames(n)).toEqual([`Margaret Hamilton`]),expect(f.getByRole(`button`,{name:d.goToNextPage}).disabled).toBe(!0),p.click(f.getByRole(`button`,{name:d.goToFirstPage})),expect(getBodyRowNames(n)).toEqual([`Ada Lovelace`,`Grace Hopper`]),p.click(f.getByRole(`button`,{name:d.goToNextPage})),p.click(f.getByRole(`button`,{name:d.goToPreviousPage})),expect(getBodyRowNames(n)).toEqual([`Ada Lovelace`,`Grace Hopper`])})}),describe(`DataTableViewOptions`,()=>{it(`throws when rendered without a table prop or DataTableRoot context`,()=>{expect(()=>m(h(n,{}))).toThrow("DataTableViewOptions requires a `table` prop or to be rendered within <DataTableRoot>")}),it(`renders nothing when there are no hideable columns`,()=>{let{container:e}=m(h(n,{table:{getAllColumns:()=>[]}}));expect(e.firstChild).toBeNull()}),it(`opens the dropdown and hides a column when its checkbox item is toggled off`,()=>{let{container:e}=m(h(u,{columns:v,data:_,showColumnVisibility:!0})),t=f.getByRole(`button`,{name:d.columnsButton});p.pointerDown(t,{button:0,pointerId:1}),p.pointerUp(t,{button:0,pointerId:1});let n=f.getByRole(`menuitemcheckbox`,{name:`email`});p.pointerDown(n,{button:0,pointerId:1}),p.pointerUp(n,{button:0,pointerId:1}),p.click(n),expect(f.queryByRole(`columnheader`,{name:`Email`})).toBeNull(),expect(e.querySelector(`[data-slot="table-container"]`)).not.toBeNull()})}),describe(`createDataTableSelectColumn`,()=>{it(`returns a non-sortable, non-hideable select column definition`,()=>{let e=o();expect(e.id).toBe(`select`),expect(e.enableSorting).toBe(!1),expect(e.enableHiding).toBe(!1),expect(typeof e.header).toBe(`function`),expect(typeof e.cell).toBe(`function`)}),it(`uses custom select-all and select-row labels when the table provides them`,()=>{m(h(u,{columns:v,data:_,enableRowSelection:!0,labels:{selectAllRows:`Pick all`,selectRow:`Pick one`}})),expect(f.getByRole(`checkbox`,{name:`Pick all`})).not.toBeNull(),expect(f.getAllByRole(`checkbox`,{name:`Pick one`})).toHaveLength(_.length)})}),describe(`useDataTable`,()=>{function Harness(e){return h(`span`,{"data-testid":`column-count`,children:r(e).getAllColumns().length})}it(`does not add a select column when row selection is disabled`,()=>{m(h(Harness,{columns:v,data:_})),expect(f.getByTestId(`column-count`).textContent).toBe(String(v.length))}),it(`prepends a select column when row selection is enabled`,()=>{m(h(Harness,{columns:v,data:_,enableRowSelection:!0})),expect(f.getByTestId(`column-count`).textContent).toBe(String(v.length+1))})}),describe(`DataTableRoot`,()=>{it(`renders children within context when given an externally created table (controlled mode)`,()=>{function Wrapper(){return h(c,{table:r({columns:v,data:_}),children:g(e,{children:[h(a,{}),h(s,{})]})})}let{container:t}=m(h(Wrapper,{}));expect(t.querySelectorAll(`[data-slot="table-body"] [data-slot="table-row"]`)).toHaveLength(_.length)}),it(`builds its own table from columns and data when no table prop is given (uncontrolled mode)`,()=>{let{container:t}=m(h(c,{columns:v,data:_,children:g(e,{children:[h(a,{}),h(s,{})]})}));expect(t.querySelectorAll(`[data-slot="table-body"] [data-slot="table-row"]`)).toHaveLength(_.length)}),it(`applies the className to the wrapping element`,()=>{let{container:t}=m(h(c,{columns:v,data:_,className:`custom-root`,children:h(e,{children:h(a,{})})}));expect(t.firstChild.className).toContain(`custom-root`)})}),describe(`useDataTableContext`,()=>{it(`throws a descriptive error when called outside of DataTableRoot`,()=>{function Consumer(){return i(),null}expect(()=>m(h(Consumer,{}))).toThrow(`useDataTableContext must be used within <DataTableRoot>`)})});
|
|
2
2
|
//# sourceMappingURL=data-table.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,c as t,d as n,i as r,l as i,n as a,o,r as s,s as c,t as l,u}from"../date-range-picker-
|
|
1
|
+
import{a as e,c as t,d as n,i as r,l as i,n as a,o,r as s,s as c,t as l,u}from"../date-range-picker-BjkVzFWQ.js";export{l as DateRangePicker,a as DateRangePickerActions,s as DateRangePickerApply,r as DateRangePickerCalendar,e as DateRangePickerContent,o as DateRangePickerDateFields,c as DateRangePickerPreset,t as DateRangePickerPresets,i as DateRangePickerReset,u as DateRangePickerTrigger,n as DateRangePickerValue};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,d as t,i as n,t as r,u as i}from"../date-range-picker-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,d as t,i as n,t as r,u as i}from"../date-range-picker-BjkVzFWQ.js";import{a,n as o,r as s}from"../react.esm-dE9nuHcL.js";import{jsx as c,jsxs as l}from"react/jsx-runtime";function startOfDay(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function addDays(e,t){let n=startOfDay(e);return n.setDate(n.getDate()+t),n}function isoDate(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function formatPtBr(e){return new Intl.DateTimeFormat(`pt-BR`,{day:`2-digit`,month:`2-digit`,year:`numeric`}).format(e)}function getTriggerValueText(e){return e.querySelector(`[data-slot="date-range-picker-value"]`)?.textContent}function openPicker(e){let t=e.querySelector(`button`);o.click(t)}describe(`DateRangePicker`,()=>{it(`shows the default placeholder on the trigger when no range is selected`,()=>{let{container:e}=s(c(r,{}));expect(getTriggerValueText(e)).toBe(`Selecione um período`)}),it(`shows a custom placeholder on the trigger when provided`,()=>{let{container:e}=s(c(r,{placeholder:`Escolha o período`}));expect(getTriggerValueText(e)).toBe(`Escolha o período`)}),it(`opens the popover content when the trigger is clicked`,async()=>{let{container:e}=s(c(r,{}));expect(a.queryByRole(`grid`)).toBeNull(),openPicker(e),expect(await a.findAllByRole(`grid`)).toHaveLength(2),expect(a.getByRole(`button`,{name:`Aplicar`})).not.toBeNull(),expect(a.getByRole(`button`,{name:`Resetar`})).not.toBeNull()}),it(`selects a start and end date from the calendar and commits the range on apply`,async()=>{let e=vi.fn(),t=vi.fn(),{container:n}=s(c(r,{onValueChange:e,onApply:t}));openPicker(n),await a.findAllByRole(`grid`);let i=startOfDay(new Date),l=addDays(i,2),u=document.querySelector(`[data-day="${isoDate(i)}"] button`);expect(u).not.toBeNull(),o.click(u);let d=document.querySelector(`[data-day="${isoDate(l)}"] button`);expect(d).not.toBeNull(),o.click(d),o.click(a.getByRole(`button`,{name:`Aplicar`})),expect(e).toHaveBeenCalledWith({from:i,to:l}),expect(t).toHaveBeenCalledWith({from:i,to:l}),expect(a.queryByRole(`grid`)).toBeNull(),expect(getTriggerValueText(n)).toBe(`${formatPtBr(i)} - ${formatPtBr(l)}`)}),it(`applies a preset range when a preset option is clicked`,async()=>{let e=vi.fn(),{container:t}=s(c(r,{onValueChange:e}));openPicker(t),await a.findAllByRole(`grid`);let n=startOfDay(new Date),i=addDays(n,-7);o.click(a.getByRole(`button`,{name:`Últimos 7 dias`})),o.click(a.getByRole(`button`,{name:`Aplicar`})),expect(e).toHaveBeenCalledWith({from:i,to:n}),expect(getTriggerValueText(t)).toBe(`${formatPtBr(i)} - ${formatPtBr(n)}`)}),it(`does not open the popover and stays inert when the trigger is disabled`,()=>{let e=vi.fn(),{container:t}=s(c(r,{onOpenChange:e,children:c(i,{disabled:!0})})),n=t.querySelector(`button`);expect(n.disabled).toBe(!0),o.click(n),expect(e).not.toHaveBeenCalled(),expect(a.queryByRole(`grid`)).toBeNull()}),it(`reflects a controlled value prop in the trigger label`,()=>{let e={from:new Date(2024,0,5),to:new Date(2024,0,20)},{container:t}=s(c(r,{value:e,onValueChange:vi.fn()}));expect(getTriggerValueText(t)).toBe(`${formatPtBr(e.from)} - ${formatPtBr(e.to)}`)}),it(`formats the controlled value using the provided locale`,()=>{let e={from:new Date(2024,0,5),to:new Date(2024,0,20)},{container:t}=s(c(r,{value:e,onValueChange:vi.fn(),locale:{code:`en-US`}})),n=new Intl.DateTimeFormat(`en-US`,{day:`2-digit`,month:`2-digit`,year:`numeric`});expect(getTriggerValueText(t)).toBe(`${n.format(e.from)} - ${n.format(e.to)}`)}),it(`resets the draft and commits a null value when reset is clicked`,async()=>{let e=vi.fn(),t=vi.fn(),{container:n}=s(c(r,{value:{from:new Date(2024,0,5),to:new Date(2024,0,20)},onValueChange:e,onReset:t}));openPicker(n),await a.findAllByRole(`grid`),o.click(a.getByRole(`button`,{name:`Resetar`})),expect(e).toHaveBeenCalledWith(null),expect(t).toHaveBeenCalledTimes(1),expect(a.queryByRole(`grid`)).toBeNull()}),it(`keeps the popover open when open is controlled and still notifies onOpenChange`,async()=>{let e=vi.fn();s(c(r,{open:!0,onOpenChange:e})),expect(await a.findAllByRole(`grid`)).toHaveLength(2),o.click(a.getByRole(`button`,{name:`Resetar`})),expect(e).toHaveBeenCalledWith(!1),expect(a.getAllByRole(`grid`)).toHaveLength(2)}),describe(`useDateRangePicker guard`,()=>{it(`throws when a subcomponent renders outside DateRangePicker`,()=>{expect(()=>s(c(t,{}))).toThrow(`DateRangePicker components must be used within DateRangePicker.`)})}),describe(`DateRangePickerTrigger asChild`,()=>{it(`renders the supplied child in place of the default markup, and it still opens the popover`,async()=>{let{container:t}=s(l(r,{children:[c(i,{asChild:!0,children:c(`button`,{type:`button`,children:`Abrir período`})}),c(e,{children:c(n,{})})]}));expect(t.querySelector(`[data-slot="date-range-picker-value"]`)).toBeNull(),o.click(a.getByRole(`button`,{name:`Abrir período`})),expect(await a.findAllByRole(`grid`)).toHaveLength(2)})}),describe(`DateRangePickerDateFields`,()=>{function getDateInputs(){return document.querySelectorAll(`input[type="date"]`)}it(`commits a range and shows a single formatted date when only the from field is filled`,async()=>{let e=vi.fn(),{container:t}=s(c(r,{onValueChange:e}));openPicker(t),await a.findAllByRole(`grid`);let n=new Date(2024,0,10),[i]=getDateInputs();o.change(i,{target:{value:isoDate(n)}}),o.click(a.getByRole(`button`,{name:`Aplicar`})),expect(e).toHaveBeenCalledWith({from:n,to:void 0}),expect(getTriggerValueText(t)).toBe(formatPtBr(n))}),it(`commits a range and shows a single formatted date when only the to field is filled`,async()=>{let e=vi.fn(),{container:t}=s(c(r,{onValueChange:e}));openPicker(t),await a.findAllByRole(`grid`);let n=new Date(2024,0,10),[,i]=getDateInputs();o.change(i,{target:{value:isoDate(n)}}),o.click(a.getByRole(`button`,{name:`Aplicar`})),expect(e).toHaveBeenCalledWith({from:void 0,to:n}),expect(getTriggerValueText(t)).toBe(formatPtBr(n))}),it(`clears the draft when a filled field is emptied`,async()=>{let e=vi.fn(),{container:t}=s(c(r,{onValueChange:e}));openPicker(t),await a.findAllByRole(`grid`);let[n]=getDateInputs();o.change(n,{target:{value:isoDate(new Date(2024,0,10))}}),o.change(n,{target:{value:``}}),o.click(a.getByRole(`button`,{name:`Aplicar`})),expect(e).toHaveBeenCalledWith(null)}),it(`swaps from/to when a to-date earlier than the existing from-date is entered`,async()=>{let e=vi.fn(),{container:t}=s(c(r,{onValueChange:e}));openPicker(t),await a.findAllByRole(`grid`);let n=new Date(2024,0,5),i=new Date(2024,0,20),[l,u]=getDateInputs();o.change(l,{target:{value:isoDate(i)}}),o.change(u,{target:{value:isoDate(n)}}),o.click(a.getByRole(`button`,{name:`Aplicar`})),expect(e).toHaveBeenCalledWith({from:n,to:i})}),it(`swaps from/to when a from-date later than the existing to-date is entered`,async()=>{let e=vi.fn(),{container:t}=s(c(r,{onValueChange:e}));openPicker(t),await a.findAllByRole(`grid`);let n=new Date(2024,0,5),i=new Date(2024,0,20),[l,u]=getDateInputs();o.change(u,{target:{value:isoDate(n)}}),o.change(l,{target:{value:isoDate(i)}}),o.click(a.getByRole(`button`,{name:`Aplicar`})),expect(e).toHaveBeenCalledWith({from:n,to:i})})}),describe(`DateRangePickerPresets relative fields`,()=>{it(`commits a range ending yesterday when a day-count is entered into "Dias até hoje"`,async()=>{let e=vi.fn(),{container:t}=s(c(r,{onValueChange:e}));openPicker(t),await a.findAllByRole(`grid`);let n=addDays(startOfDay(new Date),-1);o.change(a.getByLabelText(`Dias até hoje`),{target:{value:`7`}}),o.click(a.getByRole(`button`,{name:`Aplicar`})),expect(e).toHaveBeenCalledWith({from:addDays(n,-6),to:n})}),it(`derives its displayed value from the draft and clears itself once the draft no longer matches`,async()=>{let{container:e}=s(c(r,{onValueChange:vi.fn()}));openPicker(e),await a.findAllByRole(`grid`);let t=a.getByLabelText(`Dias até hoje`);o.change(t,{target:{value:`7`}}),expect(t.value).toBe(`7`),o.click(a.getByRole(`button`,{name:`Últimos 30 dias`})),expect(t.value).toBe(``)}),it(`ignores non-positive or non-numeric input without changing the draft`,async()=>{let e=vi.fn(),{container:t}=s(c(r,{onValueChange:e}));openPicker(t),await a.findAllByRole(`grid`);let n=a.getByLabelText(`Dias até hoje`);o.change(n,{target:{value:`0`}}),o.change(n,{target:{value:`abc`}}),o.click(a.getByRole(`button`,{name:`Aplicar`})),expect(e).toHaveBeenCalledWith(null)})}),describe(`DateRangePickerCalendar`,()=>{it(`fires onMonthChange and advances the shared month when navigating to the next month`,async()=>{let t=vi.fn(),{container:u}=s(l(r,{children:[c(i,{}),c(e,{children:c(n,{onMonthChange:t})})]}));openPicker(u),await a.findAllByRole(`grid`),o.click(a.getByRole(`button`,{name:`Go to the Next Month`})),expect(t).toHaveBeenCalledTimes(1),expect(t).toHaveBeenCalledWith(expect.any(Date))})})});
|
|
2
2
|
//# sourceMappingURL=date-range-picker.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../button-oI3hbOgp.js";import{a as t,d as n,i as r,n as i,o as a,r as o,s,t as c,u as l}from"../dialog-B7I4Ky1i.js";import{a as u,n as d,o as f,r as p}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../button-oI3hbOgp.js";import{a as t,d as n,i as r,n as i,o as a,r as o,s,t as c,u as l}from"../dialog-B7I4Ky1i.js";import{a as u,n as d,o as f,r as p}from"../react.esm-dE9nuHcL.js";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{createRef as g}from"react";describe(`Dialog`,()=>{it(`is closed until the trigger is clicked, then renders its content in a portal`,async()=>{p(h(c,{children:[m(n,{children:`Open settings`}),m(r,{children:h(s,{children:[m(l,{children:`Settings`}),m(t,{children:`Manage your preferences.`})]})})]})),expect(u.queryByRole(`dialog`)).toBeNull(),d.click(u.getByRole(`button`,{name:`Open settings`})),expect(await u.findByRole(`dialog`)).not.toBeNull(),expect(u.getByText(`Settings`)).not.toBeNull(),expect(u.getByText(`Manage your preferences.`)).not.toBeNull()}),it(`renders a close button by default and closes the dialog when it is clicked`,async()=>{p(h(c,{children:[m(n,{children:`Open settings`}),m(r,{children:m(l,{children:`Settings`})})]})),d.click(u.getByRole(`button`,{name:`Open settings`})),await u.findByRole(`dialog`),d.click(u.getByRole(`button`,{name:`Close`})),await f(()=>expect(u.queryByRole(`dialog`)).toBeNull())}),it(`hides the close button when showCloseButton is false`,async()=>{p(h(c,{children:[m(n,{children:`Open`}),m(r,{showCloseButton:!1,children:m(l,{children:`Settings`})})]})),d.click(u.getByRole(`button`,{name:`Open`})),await u.findByRole(`dialog`),expect(u.queryByRole(`button`,{name:`Close`})).toBeNull()}),it(`defaults to size "sm" and applies size-specific classes controlled by the parent Dialog`,async()=>{let{unmount:e}=p(m(c,{defaultOpen:!0,children:m(r,{children:m(l,{children:`Settings`})})})),t=await u.findByRole(`dialog`);expect(t.className).toContain(`sm:max-w-sm`),e(),p(m(c,{defaultOpen:!0,size:`full`,children:m(r,{children:m(l,{children:`Settings`})})})),t=await u.findByRole(`dialog`),expect(t.className).toContain(`w-screen`)}),it(`closes on Escape by default (dismissible)`,async()=>{p(m(c,{defaultOpen:!0,children:m(r,{children:m(l,{children:`Settings`})})})),await u.findByRole(`dialog`),d.keyDown(document,{key:`Escape`,code:`Escape`}),await f(()=>expect(u.queryByRole(`dialog`)).toBeNull())}),it(`prevents closing on Escape when dismissible is false`,async()=>{p(m(c,{defaultOpen:!0,dismissible:!1,children:m(r,{children:m(l,{children:`Settings`})})})),await u.findByRole(`dialog`),d.keyDown(document,{key:`Escape`,code:`Escape`}),expect(u.queryByRole(`dialog`)).not.toBeNull()}),describe(`DialogBody and DialogFooter`,()=>{it(`renders DialogBody content and closes via an extra Close action in DialogFooter`,async()=>{p(m(c,{defaultOpen:!0,children:h(r,{showCloseButton:!1,children:[m(l,{children:`Settings`}),m(i,{children:`Body content`}),m(a,{showCloseButton:!0,children:m(e,{children:`Save`})})]})}));let t=await u.findByRole(`dialog`);expect(t.querySelector(`[data-slot="dialog-body"]`)?.textContent).toBe(`Body content`);let n=t.querySelector(`[data-slot="dialog-footer"]`);expect(n?.textContent).toContain(`Save`),d.click(u.getByRole(`button`,{name:`Close`})),await f(()=>expect(u.queryByRole(`dialog`)).toBeNull())})}),describe(`DialogClose`,()=>{it(`closes the dialog when an explicit DialogClose element is clicked`,async()=>{p(m(c,{defaultOpen:!0,children:h(r,{showCloseButton:!1,children:[m(l,{children:`Settings`}),m(o,{children:`Dismiss`})]})})),await u.findByRole(`dialog`),d.click(u.getByRole(`button`,{name:`Dismiss`})),await f(()=>expect(u.queryByRole(`dialog`)).toBeNull())})}),it(`forwards overlayRef to the DialogOverlay element`,async()=>{let e=g();p(m(c,{defaultOpen:!0,children:m(r,{overlayRef:e,children:m(l,{children:`Settings`})})})),await u.findByRole(`dialog`),expect(e.current).not.toBeNull(),expect(e.current?.getAttribute(`data-slot`)).toBe(`dialog-overlay`)})});
|
|
2
2
|
//# sourceMappingURL=dialog.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../donut-chart-BHU4kDE6.js";import{a as t,r as n}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../donut-chart-BHU4kDE6.js";import{a as t,r as n}from"../react.esm-dE9nuHcL.js";import{jsx as r}from"react/jsx-runtime";beforeAll(()=>{vi.stubGlobal(`ResizeObserver`,class{observe(){}unobserve(){}disconnect(){}}),Object.defineProperty(HTMLElement.prototype,"offsetWidth",{configurable:!0,value:500}),Object.defineProperty(HTMLElement.prototype,"offsetHeight",{configurable:!0,value:300}),HTMLElement.prototype.getBoundingClientRect=()=>({width:500,height:300,top:0,left:0,right:500,bottom:300,x:0,y:0,toJSON(){}})});const i=[{name:`chrome`,value:275},{name:`safari`,value:200},{name:`firefox`,value:187}];function sectorArcRadii(e){return[...(e.querySelector(`.recharts-sector`)?.getAttribute(`d`)??``).matchAll(/A\s*([\d.]+),/g)].map(e=>Number(e[1]))}describe(`DonutChart`,()=>{it(`renders with data-slot="donut-chart" on the chart wrapper`,()=>{let{container:t}=n(r(e,{data:i}));expect(t.querySelector(`[data-slot="donut-chart"]`)).not.toBeNull()}),it(`accepts a data array without throwing`,()=>{expect(()=>n(r(e,{data:i}))).not.toThrow()}),it(`renders one recharts pie sector per data entry`,()=>{let{container:t}=n(r(e,{data:i}));expect(t.querySelectorAll(`.recharts-pie-sector`).length).toBe(i.length)}),it(`carves out a hollow inner radius using the default thickness of 0.35`,()=>{let{container:t}=n(r(e,{data:i,outerRadius:100,animationDuration:0})),[a,o]=sectorArcRadii(t);expect(a).toBe(100),expect(o).toBeCloseTo(65)}),it.each([{thickness:0,expectedRatio:1},{thickness:.5,expectedRatio:.5},{thickness:.9,expectedRatio:.1}])(`derives innerRadius from a numeric outerRadius as outerRadius * (1 - thickness) (thickness=$thickness)`,({thickness:t,expectedRatio:a})=>{let{container:o}=n(r(e,{data:i,outerRadius:100,thickness:t,animationDuration:0})),[s,c]=sectorArcRadii(o);expect(s).toBe(100),expect(c).toBeCloseTo(100*a)}),it(`clamps a thickness below 0 to a ratio of 1 (fully hollow up to the outer radius)`,()=>{let{container:t}=n(r(e,{data:i,outerRadius:100,thickness:-1,animationDuration:0})),[a,o]=sectorArcRadii(t);expect(a).toBe(100),expect(o).toBeCloseTo(100)}),it.each([1,2])(`clamps a thickness of %d or more to a ratio of 0, collapsing the inner radius to a single arc`,t=>{let{container:a}=n(r(e,{data:i,outerRadius:100,thickness:t,animationDuration:0}));expect(sectorArcRadii(a)).toHaveLength(1)}),it(`derives a proportional innerRadius when outerRadius is a percentage string`,()=>{let{container:t}=n(r(e,{data:i,outerRadius:`50%`,thickness:.5,animationDuration:0})),[a,o]=sectorArcRadii(t);expect(o/a).toBeCloseTo(.5)}),it(`falls back to the raw outerRadius value when it does not match the percentage pattern`,()=>{expect(()=>n(r(e,{data:i,outerRadius:`fill`,animationDuration:0}))).not.toThrow()}),it(`renders a tooltip wrapper by default and omits it when withTooltip is false`,()=>{let{container:t}=n(r(e,{data:i}));expect(t.querySelectorAll(`.recharts-tooltip-wrapper`).length).toBe(1);let{container:a}=n(r(e,{data:i,withTooltip:!1}));expect(a.querySelectorAll(`.recharts-tooltip-wrapper`).length).toBe(0)}),it(`omits the legend by default and renders it when withLegend is true`,async()=>{let{container:a}=n(r(e,{data:i}));expect(a.querySelectorAll(`.recharts-legend-wrapper`).length).toBe(0);let{container:o}=n(r(e,{data:i,withLegend:!0}));expect(o.querySelectorAll(`.recharts-legend-wrapper`).length).toBe(1),expect((await t.findAllByText(`chrome`)).length).toBeGreaterThan(0)}),it(`omits slice labels by default and renders them when withLabels is true`,()=>{let{container:t}=n(r(e,{data:i,animationDuration:0}));expect(t.querySelectorAll(`.recharts-pie-label-text`).length).toBe(0);let{container:a}=n(r(e,{data:i,withLabels:!0,animationDuration:0}));expect(a.querySelectorAll(`.recharts-pie-label-text`).length).toBe(i.length)}),it(`does not throw when withTotal and a custom totalLabel are enabled`,()=>{expect(()=>n(r(e,{data:i,withTotal:!0,totalLabel:`Sum`}))).not.toThrow()})});
|
|
2
2
|
//# sourceMappingURL=donut-chart.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,d as t,i as n,n as r,o as i,r as a,s as o,t as s,u as c}from"../drawer-BO4mP6y1.js";import{a as l,n as u,o as d,r as f}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,d as t,i as n,n as r,o as i,r as a,s as o,t as s,u as c}from"../drawer-BO4mP6y1.js";import{a as l,n as u,o as d,r as f}from"../react.esm-dE9nuHcL.js";import{jsx as p,jsxs as m}from"react/jsx-runtime";function renderBasicDrawer(l={}){return f(m(s,{children:[p(t,{children:`Open drawer`}),m(n,{...l,children:[m(o,{children:[p(c,{children:`Settings`}),p(e,{children:`Manage your preferences`})]}),p(r,{children:`Body content`}),p(i,{children:p(a,{children:`Cancel`})})]})]}))}describe(`Drawer`,()=>{it(`is closed until the trigger is activated, then opens the dialog`,async()=>{renderBasicDrawer(),expect(l.queryByRole(`dialog`)).toBeNull(),u.click(l.getByText(`Open drawer`));let e=await l.findByRole(`dialog`);expect(e.getAttribute(`data-slot`)).toBe(`drawer-content`)}),it(`closes when the built-in close button is clicked`,async()=>{renderBasicDrawer(),u.click(l.getByText(`Open drawer`)),await l.findByRole(`dialog`),u.click(l.getByRole(`button`,{name:`Close`})),await d(()=>expect(l.queryByRole(`dialog`)).toBeNull())}),it(`hides the close button when showCloseButton is false`,async()=>{renderBasicDrawer({showCloseButton:!1}),u.click(l.getByText(`Open drawer`)),await l.findByRole(`dialog`),expect(l.queryByRole(`button`,{name:`Close`})).toBeNull()}),it(`renders the title and description with their data-slot and default classes`,async()=>{renderBasicDrawer(),u.click(l.getByText(`Open drawer`));let e=await l.findByText(`Settings`),t=l.getByText(`Manage your preferences`);expect(e.getAttribute(`data-slot`)).toBe(`drawer-title`),expect(e.className).toContain(`text-base`),expect(t.getAttribute(`data-slot`)).toBe(`drawer-description`),expect(t.className).toContain(`text-muted-foreground`)}),it(`renders the body and footer with their data-slot`,async()=>{renderBasicDrawer(),u.click(l.getByText(`Open drawer`));let e=await l.findByText(`Body content`);expect(e.getAttribute(`data-slot`)).toBe(`drawer-body`),expect(l.getByText(`Cancel`).closest(`[data-slot="drawer-footer"]`)).not.toBeNull()}),it(`applies the default right/md direction and size classes to the content`,async()=>{renderBasicDrawer(),u.click(l.getByText(`Open drawer`));let e=await l.findByRole(`dialog`);expect(e.className).toContain(`inset-y-0`),expect(e.className).toContain(`right-0`),expect(e.className).toContain(`w-4/5`),expect(e.className).toContain(`sm:max-w-md`)}),it(`applies compound variant classes for a non-default direction and size`,async()=>{f(m(s,{direction:`top`,size:`lg`,children:[p(t,{children:`Open`}),p(n,{children:p(c,{children:`Top drawer`})})]})),u.click(l.getByText(`Open`));let e=await l.findByRole(`dialog`);expect(e.className).toContain(`inset-x-0`),expect(e.className).toContain(`top-0`),expect(e.className).toContain(`mb-12`),expect(e.className).toContain(`max-h-128`)}),it(`applies text-center classes to the header for horizontal (top/bottom) directions`,async()=>{f(m(s,{direction:`bottom`,children:[p(t,{children:`Open`}),p(n,{children:p(o,{children:`Header content`})})]})),u.click(l.getByText(`Open`));let e=await l.findByText(`Header content`);expect(e.getAttribute(`data-slot`)).toBe(`drawer-header`),expect(e.className).toContain(`text-center`)}),it(`does not apply text-center classes to the header for left/right directions`,async()=>{renderBasicDrawer(),u.click(l.getByText(`Open drawer`));let e=(await l.findByText(`Settings`)).closest(`[data-slot="drawer-header"]`);expect(e.className).not.toContain(`text-center`)}),it(`renders the overlay with its data-slot and forwards overlayProps`,async()=>{let{container:e}=renderBasicDrawer({overlayProps:{"data-testid":`custom-overlay`}});u.click(l.getByText(`Open drawer`)),await l.findByRole(`dialog`);let t=e.ownerDocument.querySelector(`[data-slot="drawer-overlay"]`);expect(t).not.toBeNull(),expect(t?.className).toContain(`fixed`),expect(l.getByTestId(`custom-overlay`)).toBe(t)}),it(`closes on Escape when dismissible (the default)`,async()=>{f(m(s,{children:[p(t,{children:`Open`}),p(n,{children:p(c,{children:`Dismissible`})})]})),u.click(l.getByText(`Open`));let e=await l.findByRole(`dialog`);u.keyDown(e,{key:`Escape`,code:`Escape`}),await d(()=>expect(l.queryByRole(`dialog`)).toBeNull())}),it(`ignores Escape when dismissible is false`,async()=>{f(m(s,{dismissible:!1,children:[p(t,{children:`Open`}),p(n,{children:p(c,{children:`Non dismissible`})})]})),u.click(l.getByText(`Open`));let e=await l.findByRole(`dialog`);u.keyDown(e,{key:`Escape`,code:`Escape`}),expect(l.getByRole(`dialog`)).not.toBeNull()})});
|
|
2
2
|
//# sourceMappingURL=drawer.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,c as t,d as n,f as r,h as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,t as f,u as p}from"../dropdown-menu-zRuQQS5S.js";import{a as m,n as h,o as g,r as _}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,c as t,d as n,f as r,h as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,t as f,u as p}from"../dropdown-menu-zRuQQS5S.js";import{a as m,n as h,o as g,r as _}from"../react.esm-dE9nuHcL.js";import{jsx as v,jsxs as y}from"react/jsx-runtime";function openMenu(e){h.pointerDown(e,{button:0,ctrlKey:!1})}describe(`DropdownMenu`,()=>{it(`is closed until the trigger is activated`,async()=>{_(y(f,{children:[v(i,{children:`Open menu`}),v(d,{children:v(e,{children:`Profile`})})]})),expect(m.queryByRole(`menu`)).toBeNull(),openMenu(m.getByText(`Open menu`));let t=await m.findByRole(`menu`);expect(t.getAttribute(`data-slot`)).toBe(`dropdown-menu-content`)}),describe(`DropdownMenuItem`,()=>{it(`calls onSelect and closes the menu when an item is chosen`,async()=>{let t=vi.fn();_(y(f,{children:[v(i,{children:`Open`}),v(d,{children:v(e,{onSelect:t,children:`Profile`})})]})),openMenu(m.getByText(`Open`));let n=await m.findByRole(`menuitem`,{name:`Profile`});h.click(n),expect(t).toHaveBeenCalledTimes(1),await g(()=>expect(m.queryByRole(`menu`)).toBeNull())}),it(`does not call onSelect for a disabled item`,async()=>{let t=vi.fn();_(y(f,{defaultOpen:!0,children:[v(i,{children:`Open`}),v(d,{children:v(e,{disabled:!0,onSelect:t,children:`Disabled`})})]}));let n=await m.findByRole(`menuitem`,{name:`Disabled`});expect(n.getAttribute(`data-disabled`)).not.toBeNull(),h.click(n),expect(t).not.toHaveBeenCalled()}),it(`exposes inset and destructive variant as data attributes`,async()=>{_(y(f,{defaultOpen:!0,children:[v(i,{children:`Open`}),v(d,{children:v(e,{inset:!0,variant:`destructive`,children:`Delete`})})]}));let t=await m.findByRole(`menuitem`,{name:`Delete`});expect(t.getAttribute(`data-inset`)).toBe(`true`),expect(t.getAttribute(`data-variant`)).toBe(`destructive`)})}),describe(`DropdownMenuCheckboxItem`,()=>{it(`reports the toggled checked state when clicked`,async()=>{let e=vi.fn();_(y(f,{defaultOpen:!0,children:[v(i,{children:`Open`}),v(d,{children:v(c,{checked:!1,onCheckedChange:e,children:`Show sidebar`})})]}));let t=await m.findByRole(`menuitemcheckbox`,{name:`Show sidebar`});expect(t.getAttribute(`aria-checked`)).toBe(`false`),h.click(t),expect(e).toHaveBeenCalledWith(!0)})}),describe(`DropdownMenuRadioGroup`,()=>{it(`reports the selected value when a different radio item is chosen`,async()=>{let e=vi.fn();_(y(f,{defaultOpen:!0,children:[v(i,{children:`Open`}),v(d,{children:y(t,{value:`list`,onValueChange:e,children:[v(o,{value:`list`,children:`List`}),v(o,{value:`grid`,children:`Grid`})]})})]}));let n=await m.findByRole(`menuitemradio`,{name:`List`}),r=m.getByRole(`menuitemradio`,{name:`Grid`});expect(n.getAttribute(`aria-checked`)).toBe(`true`),expect(r.getAttribute(`aria-checked`)).toBe(`false`),h.click(r),expect(e).toHaveBeenCalledWith(`grid`)})}),describe(`DropdownMenuSub`,()=>{it(`opens the submenu and selects an item within it`,async()=>{let t=vi.fn();_(y(f,{defaultOpen:!0,children:[v(i,{children:`Open`}),v(d,{children:y(r,{children:[v(s,{children:`More tools`}),v(u,{children:v(e,{onSelect:t,children:`Extensions`})})]})})]}));let n=await m.findByRole(`menuitem`,{name:`More tools`});h.click(n);let a=await m.findByRole(`menuitem`,{name:`Extensions`});h.click(a),expect(t).toHaveBeenCalledTimes(1)})}),it(`renders a group, label, separator and shortcut with their data-slots`,async()=>{_(y(f,{defaultOpen:!0,children:[v(i,{children:`Open`}),v(d,{children:y(a,{children:[v(l,{inset:!0,children:`Actions`}),v(p,{}),y(e,{children:[`Copy`,v(n,{children:`⌘C`})]})]})})]})),await m.findByText(`Actions`),expect(document.querySelector(`[data-slot="dropdown-menu-group"]`)).not.toBeNull();let t=document.querySelector(`[data-slot="dropdown-menu-label"]`);expect(t?.getAttribute(`data-inset`)).toBe(`true`),expect(document.querySelector(`[data-slot="dropdown-menu-separator"]`)).not.toBeNull();let r=m.getByText(`⌘C`);expect(r.getAttribute(`data-slot`)).toBe(`dropdown-menu-shortcut`)})});
|
|
2
2
|
//# sourceMappingURL=dropdown-menu.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,c as t,f as n,i as r,l as i,n as a,o,p as s,r as c,s as l,t as u,u as d}from"../dropzone-BLZkZThJ.js";import{a as f,n as p,o as m,r as h}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,c as t,f as n,i as r,l as i,n as a,o,p as s,r as c,s as l,t as u,u as d}from"../dropzone-BLZkZThJ.js";import{a as f,n as p,o as m,r as h}from"../react.esm-dE9nuHcL.js";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{createRef as v}from"react";function defaultOnDropFile(e){return Promise.resolve({status:`success`,result:e.name})}function DropzoneHarness(n){let f=s(n);return _(u,{...f,children:[_(a,{"data-testid":`dropzone-area`,children:[g(d,{children:`Upload files`}),g(c,{children:`PNG files up to 5MB`})]}),g(l,{}),g(r,{children:f.fileStatuses.map(n=>_(e,{file:n,children:[g(`span`,{children:n.fileName}),g(o,{}),g(i,{children:`Retry`}),g(t,{children:`Remove`})]},n.id))})]})}function renderDropzone(e={}){return h(g(DropzoneHarness,{onDropFile:defaultOnDropFile,...e}))}function getFileInput(e){return e.querySelector(`input[type="file"]`)}describe(`Dropzone`,()=>{it(`renders the trigger, description, and a hidden file input wired to the dropzone`,()=>{let{container:e}=renderDropzone();expect(f.getByRole(`button`,{name:`Upload files`})).toBeTruthy(),expect(f.getByText(`PNG files up to 5MB`)).toBeTruthy();let t=getFileInput(e);expect(t).not.toBeNull(),expect(t.className).toContain(`sr-only`)}),it(`forwards the ref on DropzoneArea to the underlying DOM node`,()=>{let e=v();function Harness(){return g(u,{...s({onDropFile:defaultOnDropFile}),children:g(a,{ref:e,"data-testid":`dropzone-area`})})}h(g(Harness,{})),expect(e.current).toBeInstanceOf(HTMLDivElement),expect(e.current).toBe(f.getByTestId(`dropzone-area`))}),it(`throws when a Dropzone subcomponent is rendered outside a Dropzone provider`,()=>{expect(()=>h(g(a,{}))).toThrow(`Dropzone components must be used within a Dropzone.`)}),it(`throws when a file-item action is rendered outside a DropzoneFileListItem`,()=>{function Harness(){return g(u,{...s({onDropFile:defaultOnDropFile}),children:g(t,{})})}expect(()=>h(g(Harness,{}))).toThrow(`Dropzone file actions must be used within a DropzoneFileListItem.`)}),describe(`accepted files`,()=>{it(`adds an accepted file and reports success through onFileUploaded`,async()=>{let e=vi.fn(),{container:t}=renderDropzone({onFileUploaded:e}),n=getFileInput(t),r=new File([`content`],`photo.png`,{type:`image/png`});p.change(n,{target:{files:[r]}}),await f.findByText(`photo.png`),await m(()=>expect(e).toHaveBeenCalledWith(`photo.png`));let i=t.querySelector(`[data-slot="dropzone-file-item"]`);expect(i?.getAttribute(`data-status`)).toBe(`success`)})}),describe(`rejected files`,()=>{it(`rejects a file with an invalid type without crashing and surfaces the allowed types`,async()=>{let e=vi.fn(),{container:t}=renderDropzone({validation:{accept:{"image/png":[`.png`]}},onRootError:e}),n=getFileInput(t),r=new File([`not an image`],`notes.txt`,{type:`text/plain`});p.change(n,{target:{files:[r]}}),await m(()=>expect(e).toHaveBeenCalled()),expect(await f.findByText(/only \.png files are allowed/i)).toBeTruthy();let i=t.querySelector(`[data-slot="dropzone-area"]`);expect(i?.getAttribute(`aria-invalid`)).toBe(`true`)}),it(`rejects a file exceeding maxSize without crashing and surfaces the size limit`,async()=>{let e=vi.fn(),{container:t}=renderDropzone({validation:{maxSize:10},onRootError:e}),n=getFileInput(t),r=new File([new Uint8Array(1024)],`large.png`,{type:`image/png`});p.change(n,{target:{files:[r]}}),await m(()=>expect(e).toHaveBeenCalled()),expect(await f.findByText(/max size is 0\.00 MB/i)).toBeTruthy()})}),describe(`DropzoneTrigger`,()=>{it(`opens the native file picker when clicked`,()=>{let e=vi.spyOn(HTMLInputElement.prototype,`click`);renderDropzone(),p.click(f.getByRole(`button`,{name:`Upload files`})),expect(e).toHaveBeenCalled(),e.mockRestore()}),it(`does not open the file picker when the click is prevented`,()=>{let e=vi.spyOn(HTMLInputElement.prototype,`click`);function Harness(){return _(u,{...s({onDropFile:defaultOnDropFile}),children:[g(a,{}),g(d,{onClick:e=>e.preventDefault(),children:`Upload`})]})}h(g(Harness,{})),p.click(f.getByRole(`button`,{name:`Upload`})),expect(e).not.toHaveBeenCalled(),e.mockRestore()})}),describe(`DropzoneRetryFile and DropzoneRemoveFile`,()=>{it(`retries an errored upload and eventually reports success`,async()=>{let e=0,t=vi.fn(async t=>(e+=1,e===1?{status:`error`,error:`network-error`}:{status:`success`,result:t.name})),n=vi.fn(),{container:r}=renderDropzone({onDropFile:t,onFileUploaded:n}),i=getFileInput(r),a=new File([`data`],`report.pdf`,{type:`application/pdf`});p.change(i,{target:{files:[a]}}),await f.findByText(`report.pdf`),expect(await f.findByText(`network-error`)).toBeTruthy(),p.click(f.getByRole(`button`,{name:`Retry`})),await m(()=>{let e=r.querySelector(`[data-slot="dropzone-file-item"]`);expect(e?.getAttribute(`data-status`)).toBe(`success`)}),expect(n).toHaveBeenCalledWith(`report.pdf`),expect(f.getByRole(`button`,{name:`Retry`}).hasAttribute(`disabled`)).toBe(!0)}),it(`removes a file from the list when the remove button is clicked`,async()=>{let e=vi.fn(),{container:t}=renderDropzone({onRemoveFile:e}),n=getFileInput(t),r=new File([`data`],`image.png`,{type:`image/png`});p.change(n,{target:{files:[r]}}),await f.findByText(`image.png`),p.click(f.getByRole(`button`,{name:`Remove`})),await m(()=>expect(f.queryByText(`image.png`)).toBeNull()),expect(e).toHaveBeenCalledTimes(1)})}),describe(`InfiniteProgress`,()=>{it(`reflects the pending, error, and success statuses on the progressbar`,()=>{let{rerender:e}=h(g(n,{status:`pending`})),t=f.getByRole(`progressbar`);expect(t.getAttribute(`aria-valuetext`)).toBe(`indeterminate`),expect(t.getAttribute(`data-status`)).toBe(`pending`),e(g(n,{status:`error`})),expect(f.getByRole(`progressbar`).getAttribute(`aria-valuetext`)).toBe(`error`),e(g(n,{status:`success`})),expect(f.getByRole(`progressbar`).getAttribute(`aria-valuetext`)).toBe(`100%`)}),it(`forwards the ref to the progressbar element`,()=>{let e=v();h(g(n,{ref:e,status:`pending`})),expect(e.current).toBe(f.getByRole(`progressbar`))})})});
|
|
2
2
|
//# sourceMappingURL=dropzone.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,i as t,n,o as r,r as i,t as a}from"../empty-BhKsDYZ5.js";import{a as o,r as s}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,i as t,n,o as r,r as i,t as a}from"../empty-BhKsDYZ5.js";import{a as o,r as s}from"../react.esm-dE9nuHcL.js";import{jsx as c,jsxs as l}from"react/jsx-runtime";describe(`Empty`,()=>{it(`renders the root container with its data-slot and base classes`,()=>{let{container:e}=s(c(a,{children:`No results`})),t=e.querySelector(`[data-slot="empty"]`);expect(t).not.toBeNull(),expect(t?.className).toContain(`flex`),expect(t?.className).toContain(`rounded-xl`),expect(t?.textContent).toBe(`No results`)}),it(`renders EmptyHeader with its data-slot`,()=>{let{container:e}=s(c(t,{children:`Header`})),n=e.querySelector(`[data-slot="empty-header"]`);expect(n).not.toBeNull(),expect(n?.className).toContain(`flex-col`)}),it(`renders EmptyMedia with the default variant`,()=>{let{container:t}=s(c(e,{children:`icon`})),n=t.querySelector(`[data-slot="empty-icon"]`);expect(n?.getAttribute(`data-variant`)).toBe(`default`),expect(n?.className).toContain(`bg-transparent`)}),it(`renders EmptyMedia with the icon variant classes`,()=>{let{container:t}=s(c(e,{variant:`icon`,children:`icon`})),n=t.querySelector(`[data-slot="empty-icon"]`);expect(n?.getAttribute(`data-variant`)).toBe(`icon`),expect(n?.className).toContain(`bg-muted`),expect(n?.className).toContain(`rounded-lg`)}),it(`renders EmptyTitle with its data-slot`,()=>{s(c(r,{children:`Nothing here`}));let e=o.getByText(`Nothing here`);expect(e.getAttribute(`data-slot`)).toBe(`empty-title`),expect(e.className).toContain(`font-medium`)}),it(`renders EmptyDescription with its data-slot`,()=>{s(c(i,{children:`Try adjusting your filters`}));let e=o.getByText(`Try adjusting your filters`);expect(e.getAttribute(`data-slot`)).toBe(`empty-description`),expect(e.className).toContain(`text-muted-foreground`)}),it(`renders EmptyContent with its data-slot`,()=>{let{container:e}=s(c(n,{children:c(`button`,{type:`button`,children:`Retry`})})),t=e.querySelector(`[data-slot="empty-content"]`);expect(t).not.toBeNull(),expect(o.getByRole(`button`,{name:`Retry`})).not.toBeNull()}),it(`composes a full empty state with header, media, title, description and content`,()=>{let{container:u}=s(l(a,{children:[l(t,{children:[c(e,{variant:`icon`,children:`*`}),c(r,{children:`No projects`}),c(i,{children:`Create your first project to get started`})]}),c(n,{children:c(`button`,{type:`button`,children:`Create project`})})]})),d=u.querySelector(`[data-slot="empty"]`);expect(d?.querySelector(`[data-slot="empty-header"]`)).not.toBeNull(),expect(d?.querySelector(`[data-slot="empty-icon"]`)).not.toBeNull(),expect(o.getByText(`No projects`)).not.toBeNull(),expect(o.getByText(`Create your first project to get started`)).not.toBeNull(),expect(d?.querySelector(`[data-slot="empty-content"]`)).not.toBeNull()}),it(`merges custom className with the base classes`,()=>{let{container:e}=s(c(a,{className:`my-custom-class`,children:`Content`})),t=e.querySelector(`[data-slot="empty"]`);expect(t?.className).toContain(`my-custom-class`),expect(t?.className).toContain(`flex`)})});
|
|
2
2
|
//# sourceMappingURL=empty.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c,u as l}from"../field-DzR-XrO7.js";import{t as u}from"../checkbox-DPvW_m7k.js";import{t as d}from"../input-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c,u as l}from"../field-DzR-XrO7.js";import{t as u}from"../checkbox-DPvW_m7k.js";import{t as d}from"../input-CJLsPlXh.js";import{t as f}from"../textarea-eJQTMC_d.js";import{l as p,t as m,u as h}from"../select-CVwVLyWt.js";import{r as g,t as _}from"../native-select-Iq25QUH-.js";import{a as v,r as y}from"../react.esm-dE9nuHcL.js";import{Fragment as b,jsx as x,jsxs as S}from"react/jsx-runtime";describe(`Field`,()=>{it(`renders with the default vertical orientation`,()=>{let{container:e}=y(x(c,{children:`content`})),t=e.querySelector(`[data-slot="field"]`);expect(t.getAttribute(`data-orientation`)).toBe(`vertical`),expect(t.className).toContain(`flex-col`)}),it(`renders horizontal and responsive orientations`,()=>{let{container:e}=y(x(c,{orientation:`horizontal`,children:`content`})),{container:t}=y(x(c,{orientation:`responsive`,children:`content`})),n=e.querySelector(`[data-slot="field"]`),r=t.querySelector(`[data-slot="field"]`);expect(n.getAttribute(`data-orientation`)).toBe(`horizontal`),expect(n.className).toContain(`flex-row`),expect(r.getAttribute(`data-orientation`)).toBe(`responsive`),expect(r.className).toContain(`@md/field-group:flex-row`)}),it(`merges a custom className with its variant classes`,()=>{let{container:e}=y(x(c,{className:`custom-field`,children:`content`}));expect(e.querySelector(`[data-slot="field"]`)?.className).toContain(`custom-field`)}),describe(`automatic control id wiring`,()=>{it(`wires FieldLabel and Input with a generated id when ids are omitted`,()=>{y(S(c,{children:[x(a,{children:`Email`}),x(d,{})]}));let e=v.getByLabelText(`Email`),t=v.getByText(`Email`);expect(e.getAttribute(`id`)).toBeTruthy(),expect(t.getAttribute(`for`)).toBe(e.getAttribute(`id`))}),it(`preserves explicit input ids and label htmlFor values`,()=>{y(S(c,{children:[x(a,{htmlFor:`explicit-label-target`,children:`Email`}),x(d,{id:`explicit-input`})]})),expect(v.getByText(`Email`).getAttribute(`for`)).toBe(`explicit-label-target`),expect(document.getElementById(`explicit-input`)).not.toBeNull()}),it(`does not assign ids or throw outside Field`,()=>{let{container:e}=y(S(b,{children:[x(a,{children:`Email`}),x(d,{})]}));expect(e.querySelector(`[data-slot="field-label"]`)?.getAttribute(`for`)).toBeNull(),expect(e.querySelector(`[data-slot="input"]`)?.getAttribute(`id`)).toBeNull()}),it(`wires representative controls to the generated Field id`,()=>{y(S(b,{children:[S(c,{children:[x(a,{children:`Message`}),x(f,{})]}),S(c,{children:[x(a,{children:`Framework`}),x(_,{children:x(g,{value:`react`,children:`React`})})]}),S(c,{children:[x(a,{children:`Category`}),x(m,{children:x(p,{children:x(h,{placeholder:`Select a category`})})})]}),S(c,{children:[x(a,{children:`Terms`}),x(u,{})]})]}));for(let e of[`Message`,`Framework`,`Category`,`Terms`]){let t=v.getByText(e).getAttribute(`for`);expect(t).toBeTruthy(),expect(document.getElementById(t??``)).not.toBeNull()}})}),describe(`FieldSet`,()=>{it(`renders a fieldset with the expected data-slot and base classes`,()=>{let{container:e}=y(x(r,{children:`content`})),t=e.querySelector(`[data-slot="field-set"]`);expect(t?.tagName).toBe(`FIELDSET`),expect(t?.className).toContain(`flex-col`)})}),describe(`FieldLegend`,()=>{it(`defaults to the legend variant`,()=>{let{container:e}=y(x(s,{children:`Legend`})),t=e.querySelector(`[data-slot="field-legend"]`);expect(t?.getAttribute(`data-variant`)).toBe(`legend`)}),it(`supports the label variant`,()=>{let{container:e}=y(x(s,{variant:`label`,children:`Legend`}));expect(e.querySelector(`[data-slot="field-legend"]`)?.getAttribute(`data-variant`)).toBe(`label`)})}),describe(`FieldGroup`,()=>{it(`renders with the group data-slot and base classes`,()=>{let{container:t}=y(x(e,{children:`content`}));expect(t.querySelector(`[data-slot="field-group"]`)?.className).toContain(`flex-col`)})}),describe(`FieldContent`,()=>{it(`renders with the field-content data-slot`,()=>{let{container:e}=y(x(i,{children:`content`}));expect(e.querySelector(`[data-slot="field-content"]`)).not.toBeNull()})}),describe(`FieldTitle`,()=>{it(`renders as a div with the field-label data-slot`,()=>{let{container:e}=y(x(l,{children:`Title`})),t=e.querySelector(`[data-slot="field-label"]`);expect(t?.tagName).toBe(`DIV`),expect(t?.textContent).toBe(`Title`)})}),describe(`FieldDescription`,()=>{it(`renders as a paragraph with the field-description data-slot`,()=>{let{container:e}=y(x(o,{children:`Helper text`})),t=e.querySelector(`[data-slot="field-description"]`);expect(t?.tagName).toBe(`P`),expect(t?.textContent).toBe(`Helper text`)})}),describe(`FieldSeparator`,()=>{it(`marks data-content as false and renders no content span when childless`,()=>{let{container:e}=y(x(t,{})),n=e.querySelector(`[data-slot="field-separator"]`);expect(n?.getAttribute(`data-content`)).toBe(`false`),expect(e.querySelector(`[data-slot="field-separator-content"]`)).toBeNull()}),it(`marks data-content as true and renders the children in a content span`,()=>{let{container:e}=y(x(t,{children:`or`})),n=e.querySelector(`[data-slot="field-separator"]`),r=e.querySelector(`[data-slot="field-separator-content"]`);expect(n?.getAttribute(`data-content`)).toBe(`true`),expect(r?.textContent).toBe(`or`)})}),describe(`FieldError`,()=>{it(`renders nothing when there are no children and no errors`,()=>{let{container:e}=y(x(n,{}));expect(e.querySelector(`[data-slot="field-error"]`)).toBeNull()}),it(`renders explicit children even when errors are also provided`,()=>{y(x(n,{errors:[{message:`Ignored`}],children:`Custom message`})),expect(v.getByRole(`alert`).textContent).toBe(`Custom message`)}),it(`renders a single error message directly`,()=>{y(x(n,{errors:[{message:`Required`}]})),expect(v.getByRole(`alert`).textContent).toBe(`Required`)}),it(`renders multiple unique error messages as a list`,()=>{y(x(n,{errors:[{message:`Required`},{message:`Too short`}]}));let e=v.getByRole(`alert`).querySelectorAll(`li`);expect(e).toHaveLength(2),expect(e[0]?.textContent).toBe(`Required`),expect(e[1]?.textContent).toBe(`Too short`)}),it(`deduplicates errors sharing the same message`,()=>{y(x(n,{errors:[{message:`Required`},{message:`Required`}]}));let e=v.getByRole(`alert`);expect(e.querySelectorAll(`li`)).toHaveLength(0),expect(e.textContent).toBe(`Required`)}),it(`ignores errors without a message and undefined entries`,()=>{y(x(n,{errors:[void 0,{message:void 0}]})),expect(v.queryByRole(`alert`)).toBeNull()})})});
|
|
2
2
|
//# sourceMappingURL=field.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../flex-BC4Diiy4.js";import{r as t}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../flex-BC4Diiy4.js";import{r as t}from"../react.esm-dE9nuHcL.js";import{jsx as n}from"react/jsx-runtime";describe(`Flex`,()=>{it(`renders a div with default direction and wrap, and data-slot`,()=>{let{container:r}=t(n(e,{children:`Content`})),i=r.querySelector(`[data-slot="flex"]`);expect(i).not.toBeNull(),expect(i?.tagName).toBe(`DIV`),expect(i?.getAttribute(`data-direction`)).toBe(`row`),expect(i?.getAttribute(`data-wrap`)).toBe(`false`),expect(i?.getAttribute(`data-align`)).toBeNull(),expect(i?.getAttribute(`data-justify`)).toBeNull(),expect(i?.className).toContain(`flex-row`),expect(i?.className).toContain(`flex-nowrap`)}),it(`applies the column-reverse direction variant`,()=>{let{container:r}=t(n(e,{direction:`column-reverse`,children:`Content`})),i=r.querySelector(`[data-slot="flex"]`);expect(i?.getAttribute(`data-direction`)).toBe(`column-reverse`),expect(i?.className).toContain(`flex-col-reverse`)}),it(`applies align, justify, gap and wrap variants together`,()=>{let{container:r}=t(n(e,{align:`center`,justify:`between`,gap:`lg`,wrap:!0,children:`Content`})),i=r.querySelector(`[data-slot="flex"]`);expect(i?.getAttribute(`data-align`)).toBe(`center`),expect(i?.getAttribute(`data-justify`)).toBe(`between`),expect(i?.getAttribute(`data-wrap`)).toBe(`true`),expect(i?.className).toContain(`items-center`),expect(i?.className).toContain(`justify-between`),expect(i?.className).toContain(`gap-6`),expect(i?.className).toContain(`flex-wrap`)}),it(`merges a custom className with the base styling`,()=>{let{container:r}=t(n(e,{className:`custom-flex`,children:`Content`})),i=r.querySelector(`[data-slot="flex"]`);expect(i?.className).toContain(`custom-flex`),expect(i?.className).toContain(`min-w-0`)}),it(`forwards the ref to the underlying div element`,()=>{let r={current:null};t(n(e,{ref:r,children:`Content`})),expect(r.current).not.toBeNull(),expect(r.current?.getAttribute(`data-slot`)).toBe(`flex`)})});
|
|
2
2
|
//# sourceMappingURL=flex.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,t}from"../grid-B3He1bGe.js";import{r as n}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,t}from"../grid-B3He1bGe.js";import{r as n}from"../react.esm-dE9nuHcL.js";import{jsx as r}from"react/jsx-runtime";describe(`Grid`,()=>{it(`renders a div with data-slot and the default 12-column template`,()=>{let{container:e}=n(r(t,{children:`Content`})),i=e.querySelector(`[data-slot="grid"]`);expect(i).not.toBeNull(),expect(i?.tagName).toBe(`DIV`),expect(i?.className).toContain(`grid`),expect(i.style.getPropertyValue(`--grid-template-columns`)).toBe(`repeat(12, minmax(0, 1fr))`),expect(i.style.getPropertyValue(`--grid-gap`)).toBe(`0px`)}),it(`applies a custom templateRows and templateColumns`,()=>{let{container:e}=n(r(t,{templateColumns:`repeat(4, 1fr)`,templateRows:`repeat(2, 1fr)`,children:`Content`})),i=e.querySelector(`[data-slot="grid"]`);expect(i.style.getPropertyValue(`--grid-template-columns`)).toBe(`repeat(4, 1fr)`),expect(i.style.getPropertyValue(`--grid-template-rows`)).toBe(`repeat(2, 1fr)`)}),it(`converts the gap prop into a spacing calc value shared by row and column gap`,()=>{let{container:e}=n(r(t,{gap:`md`,children:`Content`})),i=e.querySelector(`[data-slot="grid"]`);expect(i.style.getPropertyValue(`--grid-gap`)).toBe(`calc(var(--spacing) * 4)`),expect(i.style.getPropertyValue(`--grid-row-gap`)).toBe(`var(--grid-gap)`),expect(i.style.getPropertyValue(`--grid-column-gap`)).toBe(`var(--grid-gap)`)}),it(`allows rowGap and columnGap to override the shared gap`,()=>{let{container:e}=n(r(t,{rowGap:`sm`,columnGap:`xl`,children:`Content`})),i=e.querySelector(`[data-slot="grid"]`);expect(i.style.getPropertyValue(`--grid-row-gap`)).toBe(`calc(var(--spacing) * 2)`),expect(i.style.getPropertyValue(`--grid-column-gap`)).toBe(`calc(var(--spacing) * 8)`)}),it(`forwards the ref to the underlying div element`,()=>{let e={current:null};n(r(t,{ref:e,children:`Content`})),expect(e.current).not.toBeNull(),expect(e.current?.getAttribute(`data-slot`)).toBe(`grid`)})}),describe(`GridItem`,()=>{it(`renders a div with data-slot and a default 12-column span`,()=>{let{container:t}=n(r(e,{children:`Content`})),i=t.querySelector(`[data-slot="grid-item"]`);expect(i).not.toBeNull(),expect(i.style.getPropertyValue(`--grid-item-col-span`)).toBe(`12`),expect(i.className).toContain(`min-w-0`)}),it(`applies a custom colSpan and rowSpan`,()=>{let{container:t}=n(r(e,{colSpan:4,rowSpan:2,children:`Content`})),i=t.querySelector(`[data-slot="grid-item"]`);expect(i.style.getPropertyValue(`--grid-item-col-span`)).toBe(`4`),expect(i.style.getPropertyValue(`--grid-item-row-span`)).toBe(`2`)}),it(`forwards the ref to the underlying div element`,()=>{let t={current:null};n(r(e,{ref:t,children:`Content`})),expect(t.current).not.toBeNull(),expect(t.current?.getAttribute(`data-slot`)).toBe(`grid-item`)})});
|
|
2
2
|
//# sourceMappingURL=grid.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../group-B6n_lMc4.js";import{r as t}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../group-B6n_lMc4.js";import{r as t}from"../react.esm-dE9nuHcL.js";import{jsx as n}from"react/jsx-runtime";describe(`Group`,()=>{it(`renders a div with default variants and data-slot`,()=>{let{container:r}=t(n(e,{children:`Content`})),i=r.querySelector(`[data-slot="group"]`);expect(i).not.toBeNull(),expect(i?.tagName).toBe(`DIV`),expect(i?.getAttribute(`data-align`)).toBe(`center`),expect(i?.getAttribute(`data-gap`)).toBe(`md`),expect(i?.getAttribute(`data-wrap`)).toBe(`true`),expect(i?.getAttribute(`data-justify`)).toBeNull(),expect(i?.className).toContain(`items-center`),expect(i?.className).toContain(`gap-4`),expect(i?.className).toContain(`flex-wrap`)}),it(`applies the requested justify variant`,()=>{let{container:r}=t(n(e,{justify:`around`,children:`Content`})),i=r.querySelector(`[data-slot="group"]`);expect(i?.getAttribute(`data-justify`)).toBe(`around`),expect(i?.className).toContain(`justify-around`)}),it(`disables wrapping when wrap is false`,()=>{let{container:r}=t(n(e,{wrap:!1,children:`Content`})),i=r.querySelector(`[data-slot="group"]`);expect(i?.getAttribute(`data-wrap`)).toBe(`false`),expect(i?.className).toContain(`flex-nowrap`)}),it(`applies align and gap variant combinations`,()=>{let{container:r}=t(n(e,{align:`stretch`,gap:`xl`,children:`Content`})),i=r.querySelector(`[data-slot="group"]`);expect(i?.getAttribute(`data-align`)).toBe(`stretch`),expect(i?.className).toContain(`items-stretch`),expect(i?.className).toContain(`gap-8`)}),it(`forwards the ref to the underlying div element`,()=>{let r={current:null};t(n(e,{ref:r,children:`Content`})),expect(r.current).not.toBeNull(),expect(r.current?.getAttribute(`data-slot`)).toBe(`group`)})});
|
|
2
2
|
//# sourceMappingURL=group.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../heading-DaxKLVRm.js";import{a as t,r as n}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../heading-DaxKLVRm.js";import{a as t,r as n}from"../react.esm-dE9nuHcL.js";import{jsx as r}from"react/jsx-runtime";describe(`Heading`,()=>{it(`renders an h2 with the default size and data-slot`,()=>{let{container:t}=n(r(e,{children:`Title`})),i=t.querySelector(`[data-slot="heading"]`);expect(i?.tagName).toBe(`H2`),expect(i?.getAttribute(`data-size`)).toBe(`md`),expect(i?.className).toContain(`text-2xl`)}),it(`applies size variant classes and the matching data-size attribute`,()=>{let{container:t}=n(r(e,{size:`xl`,children:`Title`})),i=t.querySelector(`[data-slot="heading"]`);expect(i?.getAttribute(`data-size`)).toBe(`xl`),expect(i?.className).toContain(`text-4xl`)}),it(`merges a custom className with the variant classes`,()=>{let{container:t}=n(r(e,{className:`custom-class`,children:`Title`})),i=t.querySelector(`[data-slot="heading"]`);expect(i?.className).toContain(`custom-class`),expect(i?.className).toContain(`font-semibold`)}),it(`renders as the provided child element when asChild is set`,()=>{n(r(e,{asChild:!0,children:r(`a`,{href:`/target`,children:`Link heading`})}));let i=t.getByRole(`link`,{name:`Link heading`});expect(i.tagName).toBe(`A`),expect(i.getAttribute(`data-slot`)).toBe(`heading`),expect(i.className).toContain(`font-semibold`)}),it(`forwards a ref to the underlying heading element`,()=>{let t={current:null};n(r(e,{ref:t,children:`Title`})),expect(t.current).toBeInstanceOf(HTMLHeadingElement),expect(t.current?.textContent).toBe(`Title`)})});
|
|
2
2
|
//# sourceMappingURL=heading.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,r as t,t as n}from"../hover-card-Dc8yLsm-.js";import{a as r,r as i}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,r as t,t as n}from"../hover-card-Dc8yLsm-.js";import{a as r,r as i}from"../react.esm-dE9nuHcL.js";import{jsx as a,jsxs as o}from"react/jsx-runtime";describe(`HoverCard`,()=>{it(`renders the trigger with its data-slot and keeps the content out of the DOM when closed`,()=>{i(o(n,{children:[a(t,{children:`Hover me`}),a(e,{children:`Card content`})]}));let s=r.getByText(`Hover me`);expect(s.getAttribute(`data-slot`)).toBe(`hover-card-trigger`),expect(s.getAttribute(`data-state`)).toBe(`closed`),expect(r.queryByText(`Card content`)).toBeNull()}),it(`renders the content with its data-slot when open is controlled to true`,()=>{i(o(n,{open:!0,children:[a(t,{children:`Hover me`}),a(e,{children:`Card content`})]}));let s=r.getByText(`Card content`);expect(s.getAttribute(`data-slot`)).toBe(`hover-card-content`),expect(s.getAttribute(`data-state`)).toBe(`open`),expect(s.className).toContain(`rounded-lg`)}),it(`merges a custom className onto the content`,()=>{i(o(n,{open:!0,children:[a(t,{children:`Hover me`}),a(e,{className:`custom-class`,children:`Card content`})]})),expect(r.getByText(`Card content`).className).toContain(`custom-class`)}),it(`accepts custom align and sideOffset props without breaking rendering`,()=>{i(o(n,{open:!0,children:[a(t,{children:`Hover me`}),a(e,{align:`start`,sideOffset:12,children:`Card content`})]})),expect(r.getByText(`Card content`)).not.toBeNull()})});
|
|
2
2
|
//# sourceMappingURL=hover-card.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t,n,o as r,r as i,t as a}from"../input-group-
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,t as a}from"../input-group-mcar-tED.js";export{a as InputGroup,n as InputGroupAddon,i as InputGroupButton,t as InputGroupInput,e as InputGroupText,r as InputGroupTextarea};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{o as e,t}from"../field-DzR-XrO7.js";import{a as n,i as r,n as i,o as a,r as o,t as s}from"../input-group-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{o as e,t}from"../field-DzR-XrO7.js";import{a as n,i as r,n as i,o as a,r as o,t as s}from"../input-group-mcar-tED.js";import{a as c,n as l,r as u}from"../react.esm-dE9nuHcL.js";import{jsx as d,jsxs as f}from"react/jsx-runtime";describe(`InputGroup`,()=>{it(`renders the root container with its data-slot and base classes`,()=>{let{container:e}=u(d(s,{children:`content`})),t=e.querySelector(`[data-slot="input-group"]`);expect(t).not.toBeNull(),expect(t?.className).toContain(`rounded-lg`),expect(t?.className).toContain(`border`)}),describe(`InputGroupAddon`,()=>{it(`defaults to the inline-start alignment`,()=>{let{container:e}=u(d(i,{children:`$`})),t=e.querySelector(`[data-slot="input-group-addon"]`);expect(t?.getAttribute(`data-align`)).toBe(`inline-start`),expect(t?.className).toContain(`order-first`)}),it(`applies the inline-end alignment classes`,()=>{let{container:e}=u(d(i,{align:`inline-end`,children:`USD`})),t=e.querySelector(`[data-slot="input-group-addon"]`);expect(t?.getAttribute(`data-align`)).toBe(`inline-end`),expect(t?.className).toContain(`order-last`)})}),describe(`InputGroupButton`,()=>{it(`renders as a button with the forwarded variant, color and custom size attributes`,()=>{let e=vi.fn();u(d(o,{size:`icon-sm`,color:`primary`,onClick:e,children:`Action`}));let t=c.getByRole(`button`,{name:`Action`});expect(t.getAttribute(`type`)).toBe(`button`),expect(t.getAttribute(`data-variant`)).toBe(`ghost`),expect(t.getAttribute(`data-color`)).toBe(`primary`),expect(t.getAttribute(`data-size`)).toBe(`icon-sm`),expect(t.className).toContain(`size-8`),l.click(t),expect(e).toHaveBeenCalledTimes(1)}),it(`defaults to the xs size classes`,()=>{u(d(o,{children:`Small`}));let e=c.getByRole(`button`,{name:`Small`});expect(e.getAttribute(`data-size`)).toBe(`xs`),expect(e.className).toContain(`h-6`)})}),it(`renders InputGroupText with its icon-adjacent typography classes`,()=>{u(d(n,{children:`Hint`}));let e=c.getByText(`Hint`);expect(e.tagName).toBe(`SPAN`),expect(e.className).toContain(`text-muted-foreground`)}),describe(`InputGroupInput`,()=>{it(`renders with the input-group-control data-slot and accepts typed input`,()=>{let{container:e}=u(d(r,{placeholder:`Email`})),t=e.querySelector(`[data-slot="input-group-control"]`);expect(t).not.toBeNull(),expect(t.tagName).toBe(`INPUT`),expect(t.className).toContain(`border-0`),l.change(t,{target:{value:`hello@example.com`}}),expect(t.value).toBe(`hello@example.com`)}),it(`reads the Field control id when rendered inside a Field`,()=>{u(f(t,{children:[d(e,{children:`Email`}),d(s,{children:d(r,{})})]}));let n=c.getByLabelText(`Email`),i=c.getByText(`Email`);expect(n.getAttribute(`id`)).toBeTruthy(),expect(i.getAttribute(`for`)).toBe(n.getAttribute(`id`))})}),describe(`InputGroupTextarea`,()=>{it(`renders with the input-group-control data-slot and accepts typed input`,()=>{let{container:e}=u(d(a,{placeholder:`Message`})),t=e.querySelector(`[data-slot="input-group-control"]`);expect(t).not.toBeNull(),expect(t.tagName).toBe(`TEXTAREA`),expect(t.className).toContain(`resize-none`),l.change(t,{target:{value:`Hello there`}}),expect(t.value).toBe(`Hello there`)})}),it(`composes an addon, input and button together`,()=>{let{container:e}=u(f(s,{children:[d(i,{children:d(n,{children:`$`})}),d(r,{placeholder:`Amount`}),d(i,{align:`inline-end`,children:d(o,{children:`Clear`})})]})),t=e.querySelector(`[data-slot="input-group"]`);expect(t?.querySelector(`[data-slot="input-group-addon"]`)).not.toBeNull(),expect(t?.querySelector(`[data-slot="input-group-control"]`)).not.toBeNull(),expect(c.getByRole(`button`,{name:`Clear`})).not.toBeNull()})});
|
|
2
2
|
//# sourceMappingURL=input-group.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{o as e,t}from"../field-DzR-XrO7.js";import{i as n,n as r,o as i,r as a,t as o}from"../input-otp-CzfRHf2V.js";import{n as s,r as c}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{o as e,t}from"../field-DzR-XrO7.js";import{i as n,n as r,o as i,r as a,t as o}from"../input-otp-CzfRHf2V.js";import{n as s,r as c}from"../react.esm-dE9nuHcL.js";import{jsx as l,jsxs as u}from"react/jsx-runtime";if(globalThis.ResizeObserver===void 0){class ResizeObserverStub{observe(){}unobserve(){}disconnect(){}}globalThis.ResizeObserver=ResizeObserverStub}function renderOtp(e={}){return c(l(o,{maxLength:4,pushPasswordManagerStrategy:`none`,...e,children:u(r,{children:[l(n,{index:0}),l(n,{index:1}),l(n,{index:2}),l(n,{index:3})]})}))}describe(`InputOTP`,()=>{it(`renders the underlying input and one slot per index`,()=>{let{container:e}=renderOtp(),t=e.querySelector(`input[data-slot="input-otp"]`),n=e.querySelectorAll(`[data-slot="input-otp-slot"]`);expect(t).not.toBeNull(),expect(n).toHaveLength(4)}),it(`reflects typed digits into the corresponding slots`,()=>{let{container:e}=renderOtp(),t=e.querySelector(`input[data-slot="input-otp"]`);s.change(t,{target:{value:`1234`}});let n=e.querySelectorAll(`[data-slot="input-otp-slot"]`);expect(n[0]?.textContent).toBe(`1`),expect(n[1]?.textContent).toBe(`2`),expect(n[2]?.textContent).toBe(`3`),expect(n[3]?.textContent).toBe(`4`)}),it(`calls onChange as digits are entered and onComplete once the value is full`,()=>{let e=vi.fn(),t=vi.fn(),{container:n}=renderOtp({onChange:e,onComplete:t}),r=n.querySelector(`input[data-slot="input-otp"]`);s.change(r,{target:{value:`12`}}),expect(e).toHaveBeenLastCalledWith(`12`),expect(t).not.toHaveBeenCalled(),s.change(r,{target:{value:`1234`}}),expect(t).toHaveBeenCalledWith(`1234`)}),it(`rejects input that does not match the provided pattern`,()=>{let e=vi.fn(),{container:t}=renderOtp({pattern:i,onChange:e}),n=t.querySelector(`input[data-slot="input-otp"]`);s.change(n,{target:{value:`ab`}}),expect(e).not.toHaveBeenCalled()}),it(`applies the has-disabled opacity class at the container level`,()=>{let{container:e}=renderOtp({disabled:!0}),t=e.querySelector(`[data-input-otp-container]`);expect(t?.className).toContain(`has-disabled:opacity-50`);let n=e.querySelector(`input[data-slot="input-otp"]`);expect(n).toHaveProperty(`disabled`,!0)}),it(`renders a separator with its icon between two groups`,()=>{let{container:e}=c(u(o,{maxLength:6,pushPasswordManagerStrategy:`none`,children:[u(r,{children:[l(n,{index:0}),l(n,{index:1}),l(n,{index:2})]}),l(a,{}),u(r,{children:[l(n,{index:3}),l(n,{index:4}),l(n,{index:5})]})]})),t=e.querySelector(`[data-slot="input-otp-separator"]`);expect(t).not.toBeNull(),expect(t?.querySelector(`svg`)).not.toBeNull()}),it(`wires the generated Field control id onto the underlying input when used inside a Field`,()=>{let{container:i}=c(u(t,{children:[l(e,{children:`One-time code`}),l(o,{maxLength:4,pushPasswordManagerStrategy:`none`,children:l(r,{children:l(n,{index:0})})})]})),a=i.querySelector(`input[data-slot="input-otp"]`),s=i.querySelector(`[data-slot="field-label"]`);expect(a?.getAttribute(`id`)).toBeTruthy(),expect(s?.getAttribute(`for`)).toBe(a?.getAttribute(`id`))})});
|
|
2
2
|
//# sourceMappingURL=input-otp.spec.js.map
|
package/dist/components/input.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"../input-
|
|
1
|
+
import{t as e}from"../input-CJLsPlXh.js";export{e as Input};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{o as e,t}from"../field-DzR-XrO7.js";import{t as n}from"../input-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{o as e,t}from"../field-DzR-XrO7.js";import{t as n}from"../input-CJLsPlXh.js";import{a as r,n as i,r as a}from"../react.esm-dE9nuHcL.js";import{jsx as o,jsxs as s}from"react/jsx-runtime";describe(`Input`,()=>{it(`renders an input with the input data-slot and base classes`,()=>{let{container:e}=a(o(n,{placeholder:`Email`})),t=e.querySelector(`[data-slot="input"]`);expect(t?.tagName).toBe(`INPUT`),expect(t?.className).toContain(`rounded-lg`),expect(t?.getAttribute(`placeholder`)).toBe(`Email`)}),it(`does not assign an id when rendered outside a Field and no id is given`,()=>{let{container:e}=a(o(n,{}));expect(e.querySelector(`[data-slot="input"]`)?.getAttribute(`id`)).toBeNull()}),it(`adopts the Field generated control id when no explicit id is provided`,()=>{a(s(t,{children:[o(e,{children:`Email`}),o(n,{})]}));let i=r.getByLabelText(`Email`);expect(i.getAttribute(`id`)).toBeTruthy()}),it(`keeps an explicit id even when rendered inside a Field`,()=>{let{container:e}=a(o(t,{children:o(n,{id:`explicit-input`})}));expect(e.querySelector(`[data-slot="input"]`)?.getAttribute(`id`)).toBe(`explicit-input`)}),it(`fires onChange with the typed value`,()=>{let e=vi.fn();a(o(n,{onChange:e})),i.change(r.getByRole(`textbox`),{target:{value:`hello`}}),expect(e).toHaveBeenCalledTimes(1),expect(r.getByRole(`textbox`).value).toBe(`hello`)}),it(`removes the native webkit search cancel button and decoration for type="search"`,()=>{let{container:e}=a(o(n,{type:`search`})),t=e.querySelector(`[data-slot="input"]`);expect(t?.className).toContain(`[&::-webkit-search-cancel-button]:appearance-none`),expect(t?.className).toContain(`[&::-webkit-search-decoration]:appearance-none`)}),it(`forwards a ref to the underlying input element`,()=>{let e={current:null};a(o(n,{ref:e})),expect(e.current).toBeInstanceOf(HTMLInputElement)})});
|
|
2
2
|
//# sourceMappingURL=input.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.spec.js","names":[],"sources":["../../src/components/input.spec.tsx"],"sourcesContent":["import { fireEvent, render, screen } from '@testing-library/react'\n\nimport { Field, FieldLabel } from './field'\nimport { Input } from './input'\n\ndescribe('Input', () => {\n it('renders an input with the input data-slot and base classes', () => {\n const { container } = render(<Input placeholder=\"Email\" />)\n\n const input = container.querySelector('[data-slot=\"input\"]')\n\n expect(input?.tagName).toBe('INPUT')\n expect(input?.className).toContain('rounded-lg')\n expect(input?.getAttribute('placeholder')).toBe('Email')\n })\n\n it('does not assign an id when rendered outside a Field and no id is given', () => {\n const { container } = render(<Input />)\n\n expect(container.querySelector('[data-slot=\"input\"]')?.getAttribute('id')).toBeNull()\n })\n\n it('adopts the Field generated control id when no explicit id is provided', () => {\n render(\n <Field>\n <FieldLabel>Email</FieldLabel>\n <Input />\n </Field>\n )\n\n const input = screen.getByLabelText('Email')\n\n expect(input.getAttribute('id')).toBeTruthy()\n })\n\n it('keeps an explicit id even when rendered inside a Field', () => {\n const { container } = render(\n <Field>\n <Input id=\"explicit-input\" />\n </Field>\n )\n\n expect(container.querySelector('[data-slot=\"input\"]')?.getAttribute('id')).toBe('explicit-input')\n })\n\n it('fires onChange with the typed value', () => {\n const handleChange = vi.fn()\n\n render(<Input onChange={handleChange} />)\n\n fireEvent.change(screen.getByRole('textbox'), { target: { value: 'hello' } })\n\n expect(handleChange).toHaveBeenCalledTimes(1)\n expect((screen.getByRole('textbox') as HTMLInputElement).value).toBe('hello')\n })\n\n it('forwards a ref to the underlying input element', () => {\n const ref = { current: null as HTMLInputElement | null }\n\n render(<Input ref={ref} />)\n\n expect(ref.current).toBeInstanceOf(HTMLInputElement)\n })\n})\n"],"mappings":"yOAKA,SAAS,YAAe,CACtB,GAAG,iEAAoE,CACrE,GAAM,CAAE,aAAc,EAAO,EAAC,EAAD,CAAO,YAAY,OAAS,CAAA,CAAC,EAEpD,EAAQ,EAAU,cAAc,qBAAqB,EAE3D,OAAO,GAAO,OAAO,CAAC,CAAC,KAAK,OAAO,EACnC,OAAO,GAAO,SAAS,CAAC,CAAC,UAAU,YAAY,EAC/C,OAAO,GAAO,aAAa,aAAa,CAAC,CAAC,CAAC,KAAK,OAAO,CACzD,CAAC,EAED,GAAG,6EAAgF,CACjF,GAAM,CAAE,aAAc,EAAO,EAAC,EAAD,CAAQ,CAAA,CAAC,EAEtC,OAAO,EAAU,cAAc,qBAAqB,CAAC,EAAE,aAAa,IAAI,CAAC,CAAC,CAAC,SAAS,CACtF,CAAC,EAED,GAAG,4EAA+E,CAChF,EACE,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAA,SAAY,OAAiB,CAAA,EAC7B,EAAC,EAAD,CAAQ,CAAA,CACH,CAAA,CAAA,CACT,EAEA,IAAM,EAAQ,EAAO,eAAe,OAAO,EAE3C,OAAO,EAAM,aAAa,IAAI,CAAC,CAAC,CAAC,WAAW,CAC9C,CAAC,EAED,GAAG,6DAAgE,CACjE,GAAM,CAAE,aAAc,EACpB,EAAC,EAAD,CAAA,SACE,EAAC,EAAD,CAAO,GAAG,gBAAkB,CAAA,CACvB,CAAA,CACT,EAEA,OAAO,EAAU,cAAc,qBAAqB,CAAC,EAAE,aAAa,IAAI,CAAC,CAAC,CAAC,KAAK,gBAAgB,CAClG,CAAC,EAED,GAAG,0CAA6C,CAC9C,IAAM,EAAe,GAAG,GAAG,EAE3B,EAAO,EAAC,EAAD,CAAO,SAAU,CAAe,CAAA,CAAC,EAExC,EAAU,OAAO,EAAO,UAAU,SAAS,EAAG,CAAE,OAAQ,CAAE,MAAO,OAAQ,CAAE,CAAC,EAE5E,OAAO,CAAY,CAAC,CAAC,sBAAsB,CAAC,EAC5C,OAAQ,EAAO,UAAU,SAAS,CAAC,CAAsB,KAAK,CAAC,CAAC,KAAK,OAAO,CAC9E,CAAC,EAED,GAAG,qDAAwD,CACzD,IAAM,EAAM,CAAE,QAAS,IAAgC,EAEvD,EAAO,EAAC,EAAD,CAAY,KAAM,CAAA,CAAC,EAE1B,OAAO,EAAI,OAAO,CAAC,CAAC,eAAe,gBAAgB,CACrD,CAAC,CACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"input.spec.js","names":[],"sources":["../../src/components/input.spec.tsx"],"sourcesContent":["import { fireEvent, render, screen } from '@testing-library/react'\n\nimport { Field, FieldLabel } from './field'\nimport { Input } from './input'\n\ndescribe('Input', () => {\n it('renders an input with the input data-slot and base classes', () => {\n const { container } = render(<Input placeholder=\"Email\" />)\n\n const input = container.querySelector('[data-slot=\"input\"]')\n\n expect(input?.tagName).toBe('INPUT')\n expect(input?.className).toContain('rounded-lg')\n expect(input?.getAttribute('placeholder')).toBe('Email')\n })\n\n it('does not assign an id when rendered outside a Field and no id is given', () => {\n const { container } = render(<Input />)\n\n expect(container.querySelector('[data-slot=\"input\"]')?.getAttribute('id')).toBeNull()\n })\n\n it('adopts the Field generated control id when no explicit id is provided', () => {\n render(\n <Field>\n <FieldLabel>Email</FieldLabel>\n <Input />\n </Field>\n )\n\n const input = screen.getByLabelText('Email')\n\n expect(input.getAttribute('id')).toBeTruthy()\n })\n\n it('keeps an explicit id even when rendered inside a Field', () => {\n const { container } = render(\n <Field>\n <Input id=\"explicit-input\" />\n </Field>\n )\n\n expect(container.querySelector('[data-slot=\"input\"]')?.getAttribute('id')).toBe('explicit-input')\n })\n\n it('fires onChange with the typed value', () => {\n const handleChange = vi.fn()\n\n render(<Input onChange={handleChange} />)\n\n fireEvent.change(screen.getByRole('textbox'), { target: { value: 'hello' } })\n\n expect(handleChange).toHaveBeenCalledTimes(1)\n expect((screen.getByRole('textbox') as HTMLInputElement).value).toBe('hello')\n })\n\n it('removes the native webkit search cancel button and decoration for type=\"search\"', () => {\n const { container } = render(<Input type=\"search\" />)\n\n const input = container.querySelector('[data-slot=\"input\"]')\n\n expect(input?.className).toContain('[&::-webkit-search-cancel-button]:appearance-none')\n expect(input?.className).toContain('[&::-webkit-search-decoration]:appearance-none')\n })\n\n it('forwards a ref to the underlying input element', () => {\n const ref = { current: null as HTMLInputElement | null }\n\n render(<Input ref={ref} />)\n\n expect(ref.current).toBeInstanceOf(HTMLInputElement)\n })\n})\n"],"mappings":"yOAKA,SAAS,YAAe,CACtB,GAAG,iEAAoE,CACrE,GAAM,CAAE,aAAc,EAAO,EAAC,EAAD,CAAO,YAAY,OAAS,CAAA,CAAC,EAEpD,EAAQ,EAAU,cAAc,qBAAqB,EAE3D,OAAO,GAAO,OAAO,CAAC,CAAC,KAAK,OAAO,EACnC,OAAO,GAAO,SAAS,CAAC,CAAC,UAAU,YAAY,EAC/C,OAAO,GAAO,aAAa,aAAa,CAAC,CAAC,CAAC,KAAK,OAAO,CACzD,CAAC,EAED,GAAG,6EAAgF,CACjF,GAAM,CAAE,aAAc,EAAO,EAAC,EAAD,CAAQ,CAAA,CAAC,EAEtC,OAAO,EAAU,cAAc,qBAAqB,CAAC,EAAE,aAAa,IAAI,CAAC,CAAC,CAAC,SAAS,CACtF,CAAC,EAED,GAAG,4EAA+E,CAChF,EACE,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAA,SAAY,OAAiB,CAAA,EAC7B,EAAC,EAAD,CAAQ,CAAA,CACH,CAAA,CAAA,CACT,EAEA,IAAM,EAAQ,EAAO,eAAe,OAAO,EAE3C,OAAO,EAAM,aAAa,IAAI,CAAC,CAAC,CAAC,WAAW,CAC9C,CAAC,EAED,GAAG,6DAAgE,CACjE,GAAM,CAAE,aAAc,EACpB,EAAC,EAAD,CAAA,SACE,EAAC,EAAD,CAAO,GAAG,gBAAkB,CAAA,CACvB,CAAA,CACT,EAEA,OAAO,EAAU,cAAc,qBAAqB,CAAC,EAAE,aAAa,IAAI,CAAC,CAAC,CAAC,KAAK,gBAAgB,CAClG,CAAC,EAED,GAAG,0CAA6C,CAC9C,IAAM,EAAe,GAAG,GAAG,EAE3B,EAAO,EAAC,EAAD,CAAO,SAAU,CAAe,CAAA,CAAC,EAExC,EAAU,OAAO,EAAO,UAAU,SAAS,EAAG,CAAE,OAAQ,CAAE,MAAO,OAAQ,CAAE,CAAC,EAE5E,OAAO,CAAY,CAAC,CAAC,sBAAsB,CAAC,EAC5C,OAAQ,EAAO,UAAU,SAAS,CAAC,CAAsB,KAAK,CAAC,CAAC,KAAK,OAAO,CAC9E,CAAC,EAED,GAAG,sFAAyF,CAC1F,GAAM,CAAE,aAAc,EAAO,EAAC,EAAD,CAAO,KAAK,QAAU,CAAA,CAAC,EAE9C,EAAQ,EAAU,cAAc,qBAAqB,EAE3D,OAAO,GAAO,SAAS,CAAC,CAAC,UAAU,mDAAmD,EACtF,OAAO,GAAO,SAAS,CAAC,CAAC,UAAU,gDAAgD,CACrF,CAAC,EAED,GAAG,qDAAwD,CACzD,IAAM,EAAM,CAAE,QAAS,IAAgC,EAEvD,EAAO,EAAC,EAAD,CAAY,KAAM,CAAA,CAAC,EAE1B,OAAO,EAAI,OAAO,CAAC,CAAC,eAAe,gBAAgB,CACrD,CAAC,CACH,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,t}from"../kbd-BTl3AgkY.js";import{r as n}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,t}from"../kbd-BTl3AgkY.js";import{r as n}from"../react.esm-dE9nuHcL.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";describe(`Kbd`,()=>{it(`renders a kbd element with the kbd data-slot and base classes`,()=>{let{container:e}=n(r(t,{children:`Ctrl`})),i=e.querySelector(`[data-slot="kbd"]`);expect(i?.tagName).toBe(`KBD`),expect(i?.textContent).toBe(`Ctrl`),expect(i?.className).toContain(`bg-muted`)}),it(`merges a custom className onto Kbd`,()=>{let{container:e}=n(r(t,{className:`custom-class`,children:`Ctrl`}));expect(e.querySelector(`[data-slot="kbd"]`)?.className).toContain(`custom-class`)}),it(`renders KbdGroup with the kbd-group data-slot and its children`,()=>{let{container:a}=n(i(e,{children:[r(t,{children:`Ctrl`}),r(t,{children:`K`})]})),o=a.querySelector(`[data-slot="kbd-group"]`);expect(o).not.toBeNull(),expect(o?.className).toContain(`inline-flex`),expect(o?.querySelectorAll(`[data-slot="kbd"]`)).toHaveLength(2)}),it(`merges a custom className onto KbdGroup`,()=>{let{container:t}=n(r(e,{className:`custom-class`}));expect(t.querySelector(`[data-slot="kbd-group"]`)?.className).toContain(`custom-class`)})});
|
|
2
2
|
//# sourceMappingURL=kbd.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../label-BQDEej_c.js";import{a as t,r as n}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../label-BQDEej_c.js";import{a as t,r as n}from"../react.esm-dE9nuHcL.js";import{Fragment as r,jsx as i,jsxs as a}from"react/jsx-runtime";describe(`Label`,()=>{it(`renders a label element with the label data-slot and base classes`,()=>{let{container:t}=n(i(e,{children:`Email`})),r=t.querySelector(`[data-slot="label"]`);expect(r?.tagName).toBe(`LABEL`),expect(r?.className).toContain(`select-none`),expect(r?.textContent).toBe(`Email`)}),it(`links to its control through htmlFor`,()=>{n(a(r,{children:[i(e,{htmlFor:`email-input`,children:`Email`}),i(`input`,{id:`email-input`})]})),expect(t.getByLabelText(`Email`)).not.toBeNull()}),it(`merges a custom className with the base classes`,()=>{let{container:t}=n(i(e,{className:`custom-class`,children:`Email`}));expect(t.querySelector(`[data-slot="label"]`)?.className).toContain(`custom-class`)}),it(`forwards a ref to the underlying label element`,()=>{let t={current:null};n(i(e,{ref:t,children:`Email`})),expect(t.current).toBeInstanceOf(HTMLLabelElement)})});
|
|
2
2
|
//# sourceMappingURL=label.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,r as t,t as n}from"../list-BbCg-ndB.js";import{a as r,r as i}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,r as t,t as n}from"../list-BbCg-ndB.js";import{a as r,r as i}from"../react.esm-dE9nuHcL.js";import{jsx as a,jsxs as o}from"react/jsx-runtime";describe(`List`,()=>{it(`renders a ul with data-slot and default size/spacing attributes`,()=>{let{container:e}=i(a(n,{children:a(t,{children:`First`})})),r=e.querySelector(`[data-slot="list"]`);expect(r?.tagName).toBe(`UL`),expect(r?.getAttribute(`data-type`)).toBe(`unordered`),expect(r?.getAttribute(`data-size`)).toBe(`md`),expect(r?.getAttribute(`data-spacing`)).toBe(`md`)}),it(`renders an ol element when type is ordered`,()=>{let{container:e}=i(a(n,{type:`ordered`,children:a(t,{children:`First`})})),r=e.querySelector(`[data-slot="list"]`);expect(r?.tagName).toBe(`OL`),expect(r?.getAttribute(`data-type`)).toBe(`ordered`)}),it(`applies size and spacing variant classes`,()=>{let{container:e}=i(a(n,{size:`lg`,spacing:`xl`,children:a(t,{children:`Item`})})),r=e.querySelector(`[data-slot="list"]`);expect(r?.className).toContain(`text-lg`),expect(r?.className).toContain(`gap-6`)}),describe(`ListItem`,()=>{it(`numbers items sequentially for an ordered list`,()=>{let{container:e}=i(o(n,{type:`ordered`,children:[a(t,{children:`First`}),a(t,{children:`Second`}),a(t,{children:`Third`})]})),r=Array.from(e.querySelectorAll(`[data-slot="list-item"] > span`)).map(e=>e.textContent);expect(r).toEqual([`1.`,`2.`,`3.`])}),it(`continues numbering through Fragment-wrapped children`,()=>{let{container:e}=i(o(n,{type:`ordered`,children:[a(t,{children:`First`}),a(t,{children:`Second`}),a(t,{children:`Third`})]})),r=Array.from(e.querySelectorAll(`[data-slot="list-item"] > span`)).map(e=>e.textContent);expect(r).toEqual([`1.`,`2.`,`3.`])}),it(`renders a bullet marker for unordered items without an icon`,()=>{let{container:e}=i(a(n,{children:a(t,{children:`Plain item`})})),r=e.querySelector(`[data-slot="list-item"]`);expect(r?.getAttribute(`data-has-icon`)).toBe(`false`),expect(r?.querySelector(`span.rounded-full`)).not.toBeNull()}),it(`renders a provided ListIcon as the marker and excludes it from the content area`,()=>{let{container:r}=i(a(n,{children:o(t,{children:[a(e,{"data-testid":`marker-icon`,children:`*`}),`Starred item`]})})),s=r.querySelector(`[data-slot="list-item"]`);expect(s?.getAttribute(`data-has-icon`)).toBe(`true`);let c=s?.querySelector(`span[aria-hidden="true"]`);expect(c?.querySelector(`[data-testid="marker-icon"]`)).not.toBeNull();let l=s?.querySelector(`.min-w-0`);expect(l?.textContent).toBe(`Starred item`)})}),describe(`ListIcon`,()=>{it(`renders as a span with the expected data-slot by default`,()=>{i(a(n,{children:o(t,{children:[a(e,{children:`*`}),`Item`]})}));let s=r.getByText(`*`);expect(s.tagName).toBe(`SPAN`),expect(s.getAttribute(`data-slot`)).toBe(`list-icon`)}),it(`merges props onto the child element when asChild is used`,()=>{i(a(n,{children:o(t,{children:[a(e,{asChild:!0,"data-testid":`custom-icon`,children:a(`svg`,{})}),`Item`]})}));let s=r.getByTestId(`custom-icon`);expect(s.tagName.toLowerCase()).toBe(`svg`),expect(s.getAttribute(`data-slot`)).toBe(`list-icon`),expect(s.getAttribute(`class`)).toContain(`size-4`)})})});
|
|
2
2
|
//# sourceMappingURL=list.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"../logo-BkwNxZNw.js";import{r as l}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"../logo-BkwNxZNw.js";import{r as l}from"../react.esm-dE9nuHcL.js";import{jsx as u}from"react/jsx-runtime";const d=[{Component:c,slot:`bippi-logo`,supportsVariant:!0},{Component:i,slot:`fibonash-logo`,supportsVariant:!0},{Component:o,slot:`gomax-logo`,supportsVariant:!0},{Component:n,slot:`intelitrack-logo`,supportsVariant:!0},{Component:e,slot:`kovra-logo`,supportsVariant:!0},{Component:a,slot:`lets-logo`,supportsVariant:!1},{Component:s,slot:`max-logo`,supportsVariant:!0},{Component:t,slot:`neutra-logo`,supportsVariant:!0},{Component:r,slot:`rd-logo`,supportsVariant:!0}];describe(`Logo`,()=>{it(`mounts every exported logo component without throwing`,()=>{for(let{Component:e}of d)expect(()=>l(u(e,{}))).not.toThrow()}),it(`renders each logo as an svg element with its expected data-slot`,()=>{for(let{Component:e,slot:t}of d){let{container:n,unmount:r}=l(u(e,{})),i=n.querySelector(`[data-slot="${t}"]`);expect(i).not.toBeNull(),expect(i?.tagName.toLowerCase()).toBe(`svg`),r()}}),it(`applies the mono tone to every logo`,()=>{for(let{Component:e,slot:t}of d){let{container:n,unmount:r}=l(u(e,{tone:`mono`})),i=n.querySelector(`[data-slot="${t}"]`);expect(i?.getAttribute(`data-tone`)).toBe(`mono`),r()}}),it(`applies the icon variant for logos that support a variant prop`,()=>{for(let{Component:e,slot:t,supportsVariant:n}of d){if(!n)continue;let{container:r,unmount:i}=l(u(e,{variant:`icon`})),a=r.querySelector(`[data-slot="${t}"]`);expect(a?.getAttribute(`data-variant`)).toBe(`icon`),i()}}),it(`uses the logo-foreground token instead of a hardcoded hex fill for color tone`,()=>{let a=[{Component:n,slot:`intelitrack-logo`},{Component:t,slot:`neutra-logo`},{Component:e,slot:`kovra-logo`},{Component:i,slot:`fibonash-logo`}];for(let{Component:e,slot:t}of a){let{container:n,unmount:r}=l(u(e,{tone:`color`})),i=n.querySelector(`[data-slot="${t}"]`);expect(i?.innerHTML).toContain(`var(--logo-foreground)`),expect(i?.innerHTML).not.toContain(`1D2436`),r()}let{container:o,unmount:s}=l(u(r,{tone:`color`})),c=o.querySelector(`[data-slot="rd-logo"]`);expect(c?.innerHTML).toContain(`var(--rd-logo-foreground)`),expect(c?.innerHTML).not.toContain(`0A2F2A`),s()})});
|
|
2
2
|
//# sourceMappingURL=logo.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,r as t,t as n}from"../marker-4_EnMIHk.js";import{a as r,r as i}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,r as t,t as n}from"../marker-4_EnMIHk.js";import{a as r,r as i}from"../react.esm-dE9nuHcL.js";import{jsx as a}from"react/jsx-runtime";describe(`Marker`,()=>{it(`renders a div with the marker data-slot and the default variant`,()=>{let{container:e}=i(a(n,{children:`Default marker`})),t=e.querySelector(`[data-slot="marker"]`);expect(t?.tagName).toBe(`DIV`),expect(t?.getAttribute(`data-variant`)).toBe(`default`),expect(t?.className).toContain(`text-muted-foreground`)}),it(`applies the separator variant classes and data-variant attribute`,()=>{let{container:e}=i(a(n,{variant:`separator`,children:`Separator marker`})),t=e.querySelector(`[data-slot="marker"]`);expect(t?.getAttribute(`data-variant`)).toBe(`separator`),expect(t?.className).toContain(`before:mr-1`),expect(t?.className).toContain(`after:ml-1`)}),it(`applies the border variant classes`,()=>{let{container:e}=i(a(n,{variant:`border`,children:`Border marker`})),t=e.querySelector(`[data-slot="marker"]`);expect(t?.getAttribute(`data-variant`)).toBe(`border`),expect(t?.className).toContain(`border-b`)}),it(`renders as the provided child element when asChild is set`,()=>{i(a(n,{asChild:!0,children:a(`a`,{href:`/target`,children:`Link marker`})}));let e=r.getByRole(`link`,{name:`Link marker`});expect(e.tagName).toBe(`A`),expect(e.getAttribute(`data-slot`)).toBe(`marker`)}),it(`renders MarkerIcon as a hidden span with the marker-icon data-slot`,()=>{let{container:e}=i(a(t,{className:`custom-icon`})),n=e.querySelector(`[data-slot="marker-icon"]`);expect(n?.tagName).toBe(`SPAN`),expect(n?.getAttribute(`aria-hidden`)).toBe(`true`),expect(n?.className).toContain(`custom-icon`)}),it(`renders MarkerContent as a span with the marker-content data-slot`,()=>{let{container:t}=i(a(e,{className:`custom-content`,children:`Content`})),n=t.querySelector(`[data-slot="marker-content"]`);expect(n?.tagName).toBe(`SPAN`),expect(n?.textContent).toBe(`Content`),expect(n?.className).toContain(`custom-content`)})});
|
|
2
2
|
//# sourceMappingURL=marker.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"../mask-input-
|
|
1
|
+
import{t as e}from"../mask-input-cCmVKrHj.js";export{e as MaskInput};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../use-mask-DBvFShXA.js";import{t}from"../mask-input-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../use-mask-DBvFShXA.js";import{t}from"../mask-input-cCmVKrHj.js";import{r as n}from"../react.esm-dE9nuHcL.js";import{jsx as r}from"react/jsx-runtime";const i=vi.hoisted(()=>({ref:vi.fn(),useMask:vi.fn()}));vi.mock(`../hooks/use-mask`,()=>({useMask:i.useMask})),describe(`MaskInput`,()=>{beforeEach(()=>{i.useMask.mockReturnValue(i.ref)}),it(`renders an input with the mask-input data-slot`,()=>{let{container:e}=n(r(t,{mask:`___-___`}));expect(e.querySelector(`[data-slot="mask-input"]`)).not.toBeNull()}),it(`wires the mask hook with the mask prop and related options`,()=>{n(r(t,{mask:`(___) ___-____`,replacement:{_:/\d/},showMask:!0,separate:!0})),expect(e).toHaveBeenCalledWith({mask:`(___) ___-____`,replacement:{_:/\d/},showMask:!0,separate:!0,track:void 0,modify:void 0})}),it(`attaches the mask ref returned by the hook to the rendered input element`,()=>{let{container:e}=n(r(t,{mask:`___-___`})),a=e.querySelector(`[data-slot="mask-input"]`);expect(i.ref).toHaveBeenCalledWith(a)}),it(`forwards standard input props such as placeholder and disabled`,()=>{let{container:e}=n(r(t,{mask:`___-___`,placeholder:`Enter code`,disabled:!0})),i=e.querySelector(`[data-slot="mask-input"]`);expect(i.placeholder).toBe(`Enter code`),expect(i.disabled).toBe(!0)}),it(`forwards an external ref alongside the mask ref`,()=>{let e={current:null},{container:i}=n(r(t,{mask:`___-___`,ref:e}));expect(e.current).toBe(i.querySelector(`[data-slot="mask-input"]`))})});
|
|
2
2
|
//# sourceMappingURL=mask-input.spec.js.map
|