@databricks/design-system 2.0.3 → 2.0.4

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/dist/patterns.js CHANGED
@@ -1,4 +1,4 @@
1
- export { D as DocumentationSidebar, F as FIXED_VERTICAL_STEPPER_WIDTH, M as MAX_VERTICAL_WIZARD_CONTENT_WIDTH, W as Wizard, a as WizardControlled, b as WizardModal, c as WizardStepContentWrapper, u as useWizardCurrentStep } from './WizardStepContentWrapper-DsAS2ZAT.js';
1
+ export { D as DocumentationSidebar, F as FIXED_VERTICAL_STEPPER_WIDTH, M as MAX_VERTICAL_WIZARD_CONTENT_WIDTH, W as Wizard, a as WizardControlled, b as WizardModal, c as WizardStepContentWrapper, u as useWizardCurrentStep } from './WizardStepContentWrapper-8bs2FwRi.js';
2
2
  import '@emotion/react/jsx-runtime';
3
3
  import 'lodash/isUndefined';
4
4
  import 'react';
@@ -1,5 +1,5 @@
1
- import { queryHelpers, within, waitFor, screen, fireEvent } from '@testing-library/react';
2
1
  import { computeAccessibleName } from 'dom-accessibility-api';
2
+ import { queryHelpers, within, waitFor, screen, fireEvent } from '@databricks/testing-library';
3
3
  import userEvent from '@testing-library/user-event';
4
4
  import { expect } from '@jest/globals';
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"rtl.js","sources":["../../src/test-utils/rtl/select.ts","../../src/test-utils/common.ts","../../src/test-utils/rtl/selectEvent.ts","../../src/test-utils/rtl/simpleSelect.utils.ts","../../src/test-utils/rtl/accordion.ts","../../src/test-utils/rtl/switch.ts","../../src/test-utils/rtl/table.ts","../../src/test-utils/rtl/openDropdownMenu.ts"],"sourcesContent":["import { queryHelpers, within } from '@testing-library/react';\nimport { computeAccessibleName } from 'dom-accessibility-api';\n\nfunction normalizeText(text: string): string {\n return text.replace(/\\s+/g, ' ').trim();\n}\n\n/**\n * Extracts the display label from a combobox — equivalent to the selected\n * option's label.\n */\nexport function getDisplayLabel(combobox: HTMLElement): string {\n return normalizeText(combobox.textContent ?? '');\n}\n\n/**\n * Finds the associated listbox for a combobox.\n *\n * @usage\n *\n * ```tsx\n * const combobox = screen.getByRole('combobox', { name: '…' });\n * await userEvent.click(combobox);\n * const listbox = select.getListbox(combobox);\n * await userEvent.click(within(listbox).getByRole('option', { name: '…' }));\n * ```\n */\nexport function getListbox(combobox: HTMLElement): HTMLElement {\n const id = combobox.getAttribute('aria-controls');\n if (!id) {\n throw queryHelpers.getElementError(\n \"This doesn't appear to be a combobox. Make sure you're querying the right element: `ByRole('combobox', { name: '…' })`\",\n combobox,\n );\n }\n const listbox = combobox.ownerDocument.getElementById(id);\n if (!listbox) {\n throw queryHelpers.getElementError(\n \"Can't find the listbox. Are you sure the select has been opened? `await userEvent.click(combobox)`\",\n combobox.ownerDocument.body,\n );\n }\n return listbox;\n}\n\n/**\n * Returns all options associated with a combobox (requires the select to have\n * been opened).\n */\nexport function getOptions(combobox: HTMLElement): HTMLElement[] {\n const listbox = getListbox(combobox);\n return within(listbox).getAllByRole('option');\n}\n\n/**\n * Returns the accessible name for each option in a combobox.\n */\nexport function getOptionNames(combobox: HTMLElement): string[] {\n const options = getOptions(combobox);\n return options.map((option) => computeAccessibleName(option));\n}\n","const duBoisClassPrefix = 'du-bois-light';\n\n/**\n * Used with the `selectEvent` utils for both Enzyme and RTL.\n */\nexport const selectClasses = {\n clear: `${duBoisClassPrefix}-select-clear`,\n item: `${duBoisClassPrefix}-select-selection-item`,\n list: 'rc-virtual-list',\n open: `${duBoisClassPrefix}-select-open`,\n option: `${duBoisClassPrefix}-select-item-option-content`,\n removeItem: `${duBoisClassPrefix}-select-selection-item-remove`,\n selector: `${duBoisClassPrefix}-select-selector`,\n};\n\nexport interface GetTableRowByCellTextOptions {\n columnHeaderName?: string | RegExp;\n}\n\nexport interface RowIdentifier {\n /** Text in a cell that uniquely identifies a row. */\n cellText: string;\n /** Name of the column to use when searching for `cellText`. */\n columnHeaderName?: string | RegExp;\n}\n\nexport interface TableRows<T> {\n bodyRows: T[];\n headerRow: T;\n}\n\n/**\n * @param columns List of column names\n * @param rows List of rows, where each row is a list of cell texts\n * @returns Markdown formatted string representing the data\n *\n * @example\n * // returns the string:\n * // | Name | Fruit |\n * // | --- | --- |\n * // | Alice | Apple |\n * // | Brady | Banana |\n * createMarkdownTable(['Name', 'Age'], [['Alice', 'Apple'], ['Brady', 'Banana']])\n */\nexport function createMarkdownTable(columns: string[], rows: string[][]): string {\n const headerRow = `| ${columns.join(' | ')} |`;\n const separatorRow = `| ${columns.fill('---').join(' | ')} |`;\n const dataRows = `${rows.map((row) => `| ${row.join(' | ')} |`).join('\\n')}`;\n const markdownTable = `${headerRow}\\n${separatorRow}\\n${dataRows}`;\n return markdownTable;\n}\n","import { queryHelpers, waitFor, within } from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\n\nimport { selectClasses } from '../common';\n\n/**\n * Allows the helpers in this module to be used when the select element is\n * queried _semantically_ (as if it were a native <select> element) - i.e.\n * `ByRole('combobox', { name: '...' })`, rather than by test ID.\n *\n * Also checks if <DesignSystemProvider> was used, because many of the helpers\n * in this module query by class name starting with \"du-bois-\", which requires\n * the provider.\n */\nfunction getRootElement(element: HTMLElement): HTMLElement {\n if (element.getAttribute('role') === 'combobox') {\n element = element.closest(`.${selectClasses.selector}`)!.parentElement!;\n }\n if (element.classList.contains('ant-select')) {\n throw new Error('Component must be wrapped by <DesignSystemProvider>');\n }\n return element;\n}\n\nfunction getOptionsList(select: HTMLElement): HTMLElement {\n const body = select.ownerDocument.body;\n const input = within(select).getByRole('combobox');\n const listId = input.getAttribute('aria-owns') || input.getAttribute('aria-controls');\n if (!listId) {\n throw queryHelpers.getElementError('Options input does not control an options list', body);\n }\n\n const listbox = select.ownerDocument.getElementById(listId);\n if (!listbox?.parentElement) {\n throw queryHelpers.getElementError('Options listbox does not have a parent', body);\n }\n\n const optionsList = listbox.parentElement.querySelector<HTMLElement>(`.${selectClasses.list}`);\n if (!optionsList) {\n throw queryHelpers.getElementError('Options list not found', body);\n }\n\n return optionsList;\n}\n\n/**\n * Opens the dropdown menu for the <Select/> by clicking. Will throw an error if\n * the menu is already opened or if the menu is unable to be opened.\n */\nexport async function openMenu(select: HTMLElement): Promise<void> {\n select = getRootElement(select);\n if (select.classList.contains(selectClasses.open)) {\n throw queryHelpers.getElementError('Select is already open', select);\n }\n const selector = select.querySelector(`.${selectClasses.selector}`);\n if (!selector) {\n throw queryHelpers.getElementError('Selector not found', select);\n }\n await userEvent.click(selector, { pointerEventsCheck: 0 });\n await waitFor(() => {\n if (!select.classList.contains(selectClasses.open)) {\n throw queryHelpers.getElementError('Select did not open', select);\n }\n });\n}\n\n/**\n * Closes the dropdown menu for the <Select/> by clicking. Will throw an error if\n * the menu is already closed or if the menu is unable to be closed.\n */\nexport async function closeMenu(select: HTMLElement): Promise<void> {\n select = getRootElement(select);\n if (!select.classList.contains(selectClasses.open)) {\n throw queryHelpers.getElementError('Select is already closed', select);\n }\n const selector = select.querySelector(`.${selectClasses.selector}`);\n if (!selector) {\n throw queryHelpers.getElementError('Selector not found', select);\n }\n await userEvent.click(selector, { pointerEventsCheck: 0 });\n await waitFor(() => {\n if (select.classList.contains(selectClasses.open)) {\n throw queryHelpers.getElementError('Select did not close', select);\n }\n });\n}\n\n/**\n * Returns a string concatenating the labels for all selected options.\n */\nexport function getLabelText(select: HTMLElement): string {\n select = getRootElement(select);\n const selector = select.querySelector(`.${selectClasses.selector}`);\n if (!selector) {\n throw queryHelpers.getElementError('Selector not found', select);\n }\n // Trim the text to avoid weird whitespace issues non-label elements being added.\n // For example, the input mirror is an empty span with some whitespace that is\n // nested under the selector but does not show up in the label text.\n return selector.textContent?.trim() ?? '';\n}\n\n/**\n * Removes the `option` by clicking its \"X\" button. Can only be used with a <Select/>\n * component with `mode=\"multiple\"`. The provided strings must match the option label\n * exactly.\n */\nexport async function removeMultiSelectOption(select: HTMLElement, option: string): Promise<void> {\n select = getRootElement(select);\n const selector = select.querySelector<HTMLElement>(`.${selectClasses.selector}`);\n if (!selector) {\n throw queryHelpers.getElementError('Selector not found', select);\n }\n const optionItem = within(selector).getByText(option).closest(`.${selectClasses.item}`);\n if (optionItem === null) {\n throw queryHelpers.getElementError(`Option \"${option}\" not found`, select);\n }\n const removeItem = optionItem.querySelector(`.${selectClasses.removeItem}`);\n if (removeItem === null) {\n throw queryHelpers.getElementError(`Remove button for option \"${option}\" not found`, optionItem as HTMLElement);\n }\n await userEvent.click(removeItem);\n}\n\n/**\n * Selects options from the dropdown menu for a <Select/> component with `mode=\"multiple\"`.\n * The provided strings must match the option labels exactly. There is a known\n * limitation for lists that are extremely long because AntD virtualizes the\n * options so not all may options may be rendered in the DOM. If this is causing\n * you issues, please let #help-frontend know.\n */\nexport async function multiSelect(select: HTMLElement, options: (string | RegExp)[]): Promise<void> {\n select = getRootElement(select);\n await openMenu(select);\n const optionsList = getOptionsList(select);\n for (let i = 0; i < options.length; i++) {\n const option = options[i];\n const optionItem = within(optionsList).getByText(option);\n await userEvent.click(optionItem, { pointerEventsCheck: 0 });\n }\n // Close the menu to indicate that selection has finished\n await closeMenu(select);\n}\n\n/**\n * Selects options from the dropdown menu for a <Select/> component without a\n * mode. The provided string must match an option label exactly. There is a known\n * limitation for lists that are extremely long because AntD virtualizes the\n * options so not all may options may be rendered in the DOM. If this is causing\n * you issues, please let #help-frontend know.\n */\nexport async function singleSelect(select: HTMLElement, option: string | RegExp): Promise<void> {\n select = getRootElement(select);\n await openMenu(select);\n const optionsList = getOptionsList(select);\n const optionItem = within(optionsList).getByText(option);\n await userEvent.click(optionItem, { pointerEventsCheck: 0 });\n // Menu automatically closes for a single <Select/> (no mode=\"multiple\")\n}\n\n/**\n * Clicks on the \"Clear\" button. In order for this function to work properly,\n * the `allowClear` prop must be set to `true`.\n */\nexport async function clearAll(select: HTMLElement): Promise<void> {\n select = getRootElement(select);\n const clearBtn = select.querySelector(`.${selectClasses.clear}`);\n if (!clearBtn) {\n throw queryHelpers.getElementError('Select not clearable', select);\n }\n await userEvent.click(clearBtn);\n}\n\n/**\n * Opens the dropdown menu, finds all of the options in the dropdown, closes\n * the menu, and returns a list of the text of each option in order.\n */\nexport async function getAllOptions(select: HTMLElement): Promise<string[]> {\n select = getRootElement(select);\n await openMenu(select);\n const optionsList = getOptionsList(select);\n const options: string[] = [];\n optionsList.querySelectorAll(`.${selectClasses.option}`).forEach((option) => {\n if (option.textContent === null) {\n throw queryHelpers.getElementError('Option had no text content', option as HTMLElement);\n }\n options.push(option.textContent);\n });\n await closeMenu(select);\n return options;\n}\n\n/**\n * Creates a new option for a Select with `mode=\"tags\"` by typing it into the input,\n * clicking on the option in the options list, and then closing the menu.\n */\nexport async function createNewOption(select: HTMLElement, option: string): Promise<void> {\n select = getRootElement(select);\n const selectInput = within(select).getByRole<HTMLInputElement>('combobox');\n // eslint-disable-next-line @databricks/no-userevent-type\n await userEvent.type(selectInput, option);\n const optionsList = getOptionsList(select);\n const optionItem = within(optionsList).getByText(option);\n await userEvent.click(optionItem);\n await closeMenu(select);\n}\n","import { expect } from '@jest/globals';\nimport { fireEvent, screen } from '@testing-library/react';\n\n// Helpers to get the selected option from the trigger\nconst getSelectedOptionLabelFromTrigger = (name?: string | RegExp): string | null => {\n return screen.getByRole('combobox', { name }).textContent;\n};\n\nconst getSelectedOptionValueFromTrigger = (name?: string | RegExp): string | null => {\n return screen.getByRole('combobox', { name }).getAttribute('value');\n};\n\nconst getSelectedOptionFromTrigger = (name?: string | RegExp): { label: string | null; value: string | null } => {\n const label = getSelectedOptionLabelFromTrigger(name);\n const value = getSelectedOptionValueFromTrigger(name);\n return { label, value };\n};\n\nconst expectSelectedOptionFromTriggerToBe = (label: string | RegExp, name?: string | RegExp): void => {\n expect(getSelectedOptionLabelFromTrigger(name)).toBe(label);\n};\n\nconst toggleSelect = (name?: string | RegExp): void => {\n fireEvent.click(screen.getByRole('combobox', { name }));\n};\n\nconst expectSelectToBeOpen = (): void => {\n expect(screen.queryAllByRole('option')).not.toHaveLength(0);\n};\n\nconst expectSelectToBeClosed = (): void => {\n expect(screen.queryAllByRole('option')).toHaveLength(0);\n};\n\n// Generic helpers for when the select is open\nconst getOptionsLength = (): number => {\n return screen.getAllByRole('option').length;\n};\n\nconst getAllOptions = (): (string | null)[] => {\n return screen.getAllByRole('option').flatMap((option) => option.textContent);\n};\n\nconst expectOptionsLengthToBe = (length: number): void => {\n expect(getOptionsLength()).toBe(length);\n};\n\nconst getUnselectedOption = (label: string | RegExp): HTMLElement => {\n return screen.getByRole('option', { name: label, selected: false });\n};\n\nconst getSelectedOption = (label: string | RegExp): HTMLElement => {\n return screen.getByRole('option', { name: label, selected: false });\n};\n\nconst getOption = (label: string | RegExp): HTMLElement => {\n return screen.getByRole('option', { name: label });\n};\n\nconst selectOption = (label: string | RegExp): void => {\n fireEvent.click(screen.getByRole('option', { name: label }));\n};\n\nconst expectSelectedOptionToBe = (label: string | RegExp): void => {\n const options = screen.getAllByRole('option');\n const selectedOption = options.find((option) => option.getAttribute('aria-selected') === 'true');\n expect(selectedOption).toHaveTextContent(label);\n};\n\nexport const simpleSelectTestUtils: {\n getSelectedOptionLabelFromTrigger: typeof getSelectedOptionLabelFromTrigger;\n getSelectedOptionValueFromTrigger: typeof getSelectedOptionValueFromTrigger;\n getSelectedOptionFromTrigger: typeof getSelectedOptionFromTrigger;\n expectSelectedOptionFromTriggerToBe: typeof expectSelectedOptionFromTriggerToBe;\n toggleSelect: typeof toggleSelect;\n expectSelectToBeOpen: typeof expectSelectToBeOpen;\n expectSelectToBeClosed: typeof expectSelectToBeClosed;\n getOptionsLength: typeof getOptionsLength;\n getAllOptions: typeof getAllOptions;\n expectOptionsLengthToBe: typeof expectOptionsLengthToBe;\n getUnselectedOption: typeof getUnselectedOption;\n getSelectedOption: typeof getSelectedOption;\n getOption: typeof getOption;\n selectOption: typeof selectOption;\n expectSelectedOptionToBe: typeof expectSelectedOptionToBe;\n} = {\n getSelectedOptionLabelFromTrigger,\n getSelectedOptionValueFromTrigger,\n getSelectedOptionFromTrigger,\n expectSelectedOptionFromTriggerToBe,\n toggleSelect,\n expectSelectToBeOpen,\n expectSelectToBeClosed,\n getOptionsLength,\n getAllOptions,\n expectOptionsLengthToBe,\n getUnselectedOption,\n getSelectedOption,\n getOption,\n selectOption,\n expectSelectedOptionToBe,\n};\n","import { screen, within } from '@testing-library/react';\nimport type { UserEvent } from '@testing-library/user-event';\n\n/**\n * Variant of the Accordion component under test.\n *\n * The AntD implementation renders the trigger as `role=\"tab\"` in single-display mode\n * and `role=\"button\"` in multiple-display mode. The Radix implementation always\n * renders a native `<button>` and a `role=\"region\"` panel per the WAI-ARIA APG\n * accordion pattern (https://www.w3.org/WAI/ARIA/apg/patterns/accordion/).\n *\n * Tests that need to run identically against both variants pass the variant in;\n * Radix-only tests can pass `'radix'` and ignore `displayMode`.\n */\nexport type AccordionVariant = 'antd' | 'radix';\n\nexport type AccordionDisplayMode = 'single' | 'multiple';\n\nexport interface AccordionQueryOptions {\n variant: AccordionVariant;\n /** Only affects AntD trigger role lookup. Defaults to `'multiple'`. */\n displayMode?: AccordionDisplayMode;\n /** Scope queries to a subtree instead of the document. */\n container?: HTMLElement;\n}\n\nconst getTriggerRole = ({ variant, displayMode = 'multiple' }: AccordionQueryOptions): 'tab' | 'button' =>\n variant === 'antd' && displayMode === 'single' ? 'tab' : 'button';\n\nconst getScope = (container: HTMLElement | undefined) => (container ? within(container) : screen);\n\n/**\n * Find an accordion trigger by its accessible name. Throws if missing.\n */\nexport const getAccordionTrigger = (name: RegExp | string, options: AccordionQueryOptions): HTMLElement =>\n getScope(options.container).getByRole(getTriggerRole(options), { name });\n\n/**\n * Like {@link getAccordionTrigger} but returns `null` when not found, mirroring RTL's `queryByRole`.\n */\nexport const queryAccordionTrigger = (name: RegExp | string, options: AccordionQueryOptions): HTMLElement | null =>\n getScope(options.container).queryByRole(getTriggerRole(options), { name });\n\n/**\n * Find the panel/region associated with a trigger by accessible name.\n *\n * Radix wires `aria-labelledby` from the panel back to the trigger, so this works.\n * AntD does not assign `role=\"region\"`, so this only works for the Radix variant —\n * tests asserting on panel content under AntD must query the content directly.\n */\nexport const getAccordionRegion = (name: RegExp | string, options: { container?: HTMLElement } = {}): HTMLElement =>\n getScope(options.container).getByRole('region', { name });\n\nexport const queryAccordionRegion = (\n name: RegExp | string,\n options: { container?: HTMLElement } = {},\n): HTMLElement | null => getScope(options.container).queryByRole('region', { name });\n\nexport const isAccordionPanelExpanded = (name: RegExp | string, options: AccordionQueryOptions): boolean =>\n getAccordionTrigger(name, options).getAttribute('aria-expanded') === 'true';\n\n/**\n * Expand a panel by clicking its trigger if not already expanded. No-op if already open.\n * Returns the trigger element so callers can chain assertions.\n */\nexport const expandAccordionPanel = async (\n user: UserEvent,\n name: RegExp | string,\n options: AccordionQueryOptions,\n): Promise<HTMLElement> => {\n const trigger = getAccordionTrigger(name, options);\n if (trigger.getAttribute('aria-expanded') !== 'true') {\n await user.click(trigger);\n }\n return trigger;\n};\n\n/**\n * Collapse a panel by clicking its trigger if currently expanded. No-op if already closed.\n * Returns the trigger element so callers can chain assertions.\n */\nexport const collapseAccordionPanel = async (\n user: UserEvent,\n name: RegExp | string,\n options: AccordionQueryOptions,\n): Promise<HTMLElement> => {\n const trigger = getAccordionTrigger(name, options);\n if (trigger.getAttribute('aria-expanded') === 'true') {\n await user.click(trigger);\n }\n return trigger;\n};\n","/**\n * Reads the checked state of a Du Bois Switch regardless of the rendering engine.\n *\n * The AntD implementation renders the toggle as a `<button role=\"switch\" aria-checked>`, so the\n * checked state lives in the `aria-checked` attribute. The native implementation renders an\n * `<input type=\"checkbox\" role=\"switch\">`, where the checked state is the element's `checked`\n * property and ARIA maps it implicitly (there is no `aria-checked` attribute). This helper reads\n * whichever representation is present so a test asserts identically against both engines.\n *\n * TODO(DUBOIS-471): transitional — delete once `databricks.fe.designsystem.useNativeSwitch` is at\n * 100% and `AntDSwitchInternal` is gone, at which point tests can use `toBeChecked()` directly.\n * https://databricks.atlassian.net/browse/DUBOIS-471\n */\nexport function isSwitchChecked(toggle: Element): boolean {\n return toggle.getAttribute('aria-checked') === 'true' || (toggle as HTMLInputElement).checked === true;\n}\n","import { queryHelpers, within } from '@testing-library/react';\n\nimport type { GetTableRowByCellTextOptions, RowIdentifier, TableRows } from '../common';\nimport { createMarkdownTable } from '../common';\n\nfunction getColumnHeaderIndex(tableElement: HTMLElement, columnHeaderName: string | RegExp): number {\n const columnHeader = within(tableElement).getByRole('columnheader', { name: columnHeaderName });\n const columnHeaderIndex = Array.from(columnHeader.parentElement?.children ?? []).indexOf(columnHeader);\n return columnHeaderIndex;\n}\n\n/**\n * Returns the table row that contains the specified `cellText`. The `cellText`\n * must be in the column with name `columnHeaderName` if it is specified. Otherwise,\n * the `cellText` must be in the first column. Throws an error if either multiple\n * rows or no rows can be found that match the given options. Also throws an error\n * if the column with name `columnHeaderName` cannot be found.\n *\n * @param tableElement The HTMLElement representing the table to query in. This is likely\n * a `<div role=\"table\">` element, so it can be queried by `screen.getByRole('table')`.\n * @param cellText The cell text that uniquely identifies the row.\n * @param columnHeaderName The name of the column to search the text for. If not provided,\n * the first column will be used.\n */\nexport function getTableRowByCellText(\n tableElement: HTMLElement,\n cellText: string,\n { columnHeaderName }: GetTableRowByCellTextOptions = {},\n): HTMLElement {\n const columnHeaderIndex = columnHeaderName === undefined ? 0 : getColumnHeaderIndex(tableElement, columnHeaderName);\n\n const matchingRows = within(tableElement)\n .getAllByRole('row')\n // Skip first row (table header)\n .slice(1)\n .filter((row) => {\n const cells = within(row).getAllByRole('cell');\n const cell = cells[columnHeaderIndex];\n const cellContainsText = within(cell).queryByText(cellText) !== null;\n return cellContainsText;\n });\n\n if (matchingRows.length === 0) {\n throw queryHelpers.getElementError(\n `Unable to find a table row with text \"${cellText}\" in the column \"${columnHeaderName}\"`,\n tableElement,\n );\n }\n\n if (matchingRows.length > 1) {\n throw queryHelpers.getElementError(\n `Found multiple table rows with text \"${cellText}\" in the column \"${columnHeaderName}\"`,\n tableElement,\n );\n }\n\n return matchingRows[0];\n}\n\n/**\n * Converts a Du Bois table to a markdown table string. This means that each cell\n * is separated by a pipe (including the edges), the header row is on its own line\n * at the top, each data row is on its own line below, and the header row is separated\n * by a row of dashes from the data rows. This is useful for checking table contents\n * in tests.\n *\n * @param tableElement The HTMLElement representing the table to query in. This is likely\n * a `<div role=\"table\">` element, so it can be queried by `screen.getByRole('table')`.\n *\n * @example\n * The HTML table:\n * ```jsx\n * <Table>\n * <TableRow isHeader>\n * <TableHeader>Name</TableHeader>\n * <TableHeader>Fruit</TableHeader>\n * </TableRow>\n * <TableRow>\n * <TableCell>Alice</TableCell>\n * <TableCell>Apple</TableCell>\n * </TableRow>\n * <TableRow>\n * <TableCell>Brady</TableCell>\n * <TableCell>Banana</TableCell>\n * </TableRow>\n * </Table>\n * ```\n *\n * The Markdown table:\n * ```md\n * | Name | Fruit |\n * | --- | --- |\n * | Alice | Apple |\n * | Brady | Banana |\n * ```\n */\nexport function toMarkdownTable(tableElement: HTMLElement): string {\n const { bodyRows, headerRow } = getTableRows(tableElement);\n const columns = within(headerRow)\n .getAllByRole('columnheader')\n .map((column) => column.textContent ?? '');\n const rows = bodyRows.map((row) =>\n within(row)\n .getAllByRole('cell')\n .map((cell) => cell.textContent ?? ''),\n );\n return createMarkdownTable(columns, rows);\n}\n\n/**\n * Returns the header row and all body rows (non-header rows) in order. Assumes that the\n * `tableElement` has a single header row (as the first row) and the rest of the rows are\n * body rows.\n *\n * @param tableElement The HTMLElement representing the table to query in. This is likely\n * a `<div role=\"table\">` element, so it can be queried by `screen.getByRole('table')`.\n */\nexport function getTableRows(tableElement: HTMLElement): TableRows<HTMLElement> {\n const [firstRow, ...restRows] = within(tableElement).getAllByRole('row');\n return {\n bodyRows: restRows,\n headerRow: firstRow,\n };\n}\n\n/**\n * Returns the table cell in the specified table row corresponding to the given\n * `columnHeaderName`. This is useful for checking that a row has a particular value\n * for a given column, especially when there are duplicate values in the column.\n *\n * @example\n * The HTML table:\n * ```jsx\n * <Table>\n * <TableRow isHeader>\n * <TableHeader>Name</TableHeader>\n * <TableHeader>Age</TableHeader>\n * </TableRow>\n * <TableRow>\n * <TableCell>Alex</TableCell>\n * <TableCell>25</TableCell>\n * </TableRow>\n * <TableRow>\n * <TableCell>Brenda</TableCell>\n * <TableCell>39</TableCell>\n * </TableRow>\n * <TableRow>\n * <TableCell>Carlos</TableCell>\n * <TableCell>39</TableCell>\n * </TableRow>\n * </Table>\n * ```\n *\n * ```js\n * const table = screen.getByRole('table');\n * const result = getTableCellInRow(table, { cellText: 'Carlos' }, 'Age');\n * expect(result.textContent).toEqual('39');\n * ```\n */\nexport function getTableCellInRow(\n tableElement: HTMLElement,\n row: RowIdentifier,\n columnHeaderName: string | RegExp,\n): HTMLElement {\n const tableRowElement = getTableRowByCellText(tableElement, row.cellText, { columnHeaderName: row.columnHeaderName });\n const columnHeaderIndex = getColumnHeaderIndex(tableElement, columnHeaderName);\n const cells = within(tableRowElement).getAllByRole('cell');\n const cell = cells[columnHeaderIndex];\n return cell;\n}\n","import userEvent from '@testing-library/user-event';\n\n/**\n * Opens the dropdown menu by clicking on the dropdown button.\n *\n * @param dropdownButton - The Dropdown Trigger button that opens the menu when clicked.\n */\nexport const openDropdownMenu = async (dropdownButton: HTMLElement): Promise<void> => {\n // eslint-disable-next-line @databricks/no-userevent-type\n await userEvent.type(dropdownButton, '{arrowdown}');\n};\n"],"names":["normalizeText","text","replace","trim","getDisplayLabel","combobox","textContent","getListbox","id","getAttribute","queryHelpers","getElementError","listbox","ownerDocument","getElementById","body","getOptions","within","getAllByRole","getOptionNames","options","map","option","computeAccessibleName","duBoisClassPrefix","selectClasses","clear","item","list","open","removeItem","selector","createMarkdownTable","columns","rows","headerRow","join","separatorRow","fill","dataRows","row","markdownTable","getRootElement","element","closest","parentElement","classList","contains","Error","getOptionsList","select","input","getByRole","listId","optionsList","querySelector","openMenu","userEvent","click","pointerEventsCheck","waitFor","closeMenu","getLabelText","removeMultiSelectOption","optionItem","getByText","multiSelect","i","length","singleSelect","clearAll","clearBtn","getAllOptions","querySelectorAll","forEach","push","createNewOption","selectInput","type","getSelectedOptionLabelFromTrigger","name","screen","getSelectedOptionValueFromTrigger","getSelectedOptionFromTrigger","label","value","expectSelectedOptionFromTriggerToBe","expect","toBe","toggleSelect","fireEvent","expectSelectToBeOpen","queryAllByRole","not","toHaveLength","expectSelectToBeClosed","getOptionsLength","flatMap","expectOptionsLengthToBe","getUnselectedOption","selected","getSelectedOption","getOption","selectOption","expectSelectedOptionToBe","selectedOption","find","toHaveTextContent","simpleSelectTestUtils","getTriggerRole","variant","displayMode","getScope","container","getAccordionTrigger","queryAccordionTrigger","queryByRole","getAccordionRegion","queryAccordionRegion","isAccordionPanelExpanded","expandAccordionPanel","user","trigger","collapseAccordionPanel","isSwitchChecked","toggle","checked","getColumnHeaderIndex","tableElement","columnHeaderName","columnHeader","columnHeaderIndex","Array","from","children","indexOf","getTableRowByCellText","cellText","undefined","matchingRows","slice","filter","cells","cell","cellContainsText","queryByText","toMarkdownTable","bodyRows","getTableRows","column","firstRow","restRows","getTableCellInRow","tableRowElement","openDropdownMenu","dropdownButton"],"mappings":";;;;;AAGA,SAASA,cAAcC,IAAY,EAAA;AACjC,IAAA,OAAOA,IAAAA,CAAKC,OAAO,CAAC,MAAA,EAAQ,KAAKC,IAAI,EAAA;AACvC;AAEA;;;IAIO,SAASC,eAAAA,CAAgBC,QAAqB,EAAA;IACnD,OAAOL,aAAAA,CAAcK,QAAAA,CAASC,WAAW,IAAI,EAAA,CAAA;AAC/C;AAEA;;;;;;;;;;;IAYO,SAASC,UAAAA,CAAWF,QAAqB,EAAA;IAC9C,MAAMG,EAAAA,GAAKH,QAAAA,CAASI,YAAY,CAAC,eAAA,CAAA;AACjC,IAAA,IAAI,CAACD,EAAAA,EAAI;QACP,MAAME,YAAAA,CAAaC,eAAe,CAChC,wHAAA,EACAN,QAAAA,CAAAA;AAEJ,IAAA;AACA,IAAA,MAAMO,OAAAA,GAAUP,QAAAA,CAASQ,aAAa,CAACC,cAAc,CAAC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A,CACJtB,YAAY,CAAC,QACbG,GAAG,CAAC,CAAC0H,IAAAA,GAASA,IAAAA,CAAKzI,WAAW,IAAI,EAAA,CAAA,CAAA;AAEvC,IAAA,OAAO0B,oBAAoBC,OAAAA,EAASC,IAAAA,CAAAA;AACtC;AAEA;;;;;;;IAQO,SAASkH,YAAAA,CAAapB,YAAyB,EAAA;IACpD,MAAM,CAACsB,UAAU,GAAGC,QAAAA,CAAS,GAAGtI,MAAAA,CAAO+G,YAAAA,CAAAA,CAAc9G,YAAY,CAAC,KAAA,CAAA;IAClE,OAAO;QACLiI,QAAAA,EAAUI,QAAAA;QACVpH,SAAAA,EAAWmH;AACb,KAAA;AACF;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCC,IACM,SAASE,iBAAAA,CACdxB,YAAyB,EACzBxF,GAAkB,EAClByF,gBAAiC,EAAA;AAEjC,IAAA,MAAMwB,eAAAA,GAAkBjB,qBAAAA,CAAsBR,YAAAA,EAAcxF,GAAAA,CAAIiG,QAAQ,EAAE;AAAER,QAAAA,gBAAAA,EAAkBzF,IAAIyF;AAAiB,KAAA,CAAA;IACnH,MAAME,iBAAAA,GAAoBJ,qBAAqBC,YAAAA,EAAcC,gBAAAA,CAAAA;AAC7D,IAAA,MAAMa,KAAAA,GAAQ7H,MAAAA,CAAOwI,eAAAA,CAAAA,CAAiBvI,YAAY,CAAC,MAAA,CAAA;IACnD,MAAM6H,IAAAA,GAAOD,KAAK,CAACX,iBAAAA,CAAkB;IACrC,OAAOY,IAAAA;AACT;;ACvKA;;;;IAKO,MAAMW,gBAAAA,GAAmB,OAAOC,cAAAA,GAAAA;;IAErC,MAAMlG,SAAAA,CAAUqB,IAAI,CAAC6E,cAAAA,EAAgB,aAAA,CAAA;AACvC;;;;"}
1
+ {"version":3,"file":"rtl.js","sources":["../../src/test-utils/rtl/select.ts","../../src/test-utils/common.ts","../../src/test-utils/rtl/selectEvent.ts","../../src/test-utils/rtl/simpleSelect.utils.ts","../../src/test-utils/rtl/accordion.ts","../../src/test-utils/rtl/switch.ts","../../src/test-utils/rtl/table.ts","../../src/test-utils/rtl/openDropdownMenu.ts"],"sourcesContent":["import { computeAccessibleName } from 'dom-accessibility-api';\n\nimport { queryHelpers, within } from '@databricks/testing-library';\n\nfunction normalizeText(text: string): string {\n return text.replace(/\\s+/g, ' ').trim();\n}\n\n/**\n * Extracts the display label from a combobox — equivalent to the selected\n * option's label.\n */\nexport function getDisplayLabel(combobox: HTMLElement): string {\n return normalizeText(combobox.textContent ?? '');\n}\n\n/**\n * Finds the associated listbox for a combobox.\n *\n * @usage\n *\n * ```tsx\n * const combobox = screen.getByRole('combobox', { name: '…' });\n * await userEvent.click(combobox);\n * const listbox = select.getListbox(combobox);\n * await userEvent.click(within(listbox).getByRole('option', { name: '…' }));\n * ```\n */\nexport function getListbox(combobox: HTMLElement): HTMLElement {\n const id = combobox.getAttribute('aria-controls');\n if (!id) {\n throw queryHelpers.getElementError(\n \"This doesn't appear to be a combobox. Make sure you're querying the right element: `ByRole('combobox', { name: '…' })`\",\n combobox,\n );\n }\n const listbox = combobox.ownerDocument.getElementById(id);\n if (!listbox) {\n throw queryHelpers.getElementError(\n \"Can't find the listbox. Are you sure the select has been opened? `await userEvent.click(combobox)`\",\n combobox.ownerDocument.body,\n );\n }\n return listbox;\n}\n\n/**\n * Returns all options associated with a combobox (requires the select to have\n * been opened).\n */\nexport function getOptions(combobox: HTMLElement): HTMLElement[] {\n const listbox = getListbox(combobox);\n return within(listbox).getAllByRole('option');\n}\n\n/**\n * Returns the accessible name for each option in a combobox.\n */\nexport function getOptionNames(combobox: HTMLElement): string[] {\n const options = getOptions(combobox);\n return options.map((option) => computeAccessibleName(option));\n}\n","const duBoisClassPrefix = 'du-bois-light';\n\n/**\n * Used with the `selectEvent` utils for both Enzyme and RTL.\n */\nexport const selectClasses = {\n clear: `${duBoisClassPrefix}-select-clear`,\n item: `${duBoisClassPrefix}-select-selection-item`,\n list: 'rc-virtual-list',\n open: `${duBoisClassPrefix}-select-open`,\n option: `${duBoisClassPrefix}-select-item-option-content`,\n removeItem: `${duBoisClassPrefix}-select-selection-item-remove`,\n selector: `${duBoisClassPrefix}-select-selector`,\n};\n\nexport interface GetTableRowByCellTextOptions {\n columnHeaderName?: string | RegExp;\n}\n\nexport interface RowIdentifier {\n /** Text in a cell that uniquely identifies a row. */\n cellText: string;\n /** Name of the column to use when searching for `cellText`. */\n columnHeaderName?: string | RegExp;\n}\n\nexport interface TableRows<T> {\n bodyRows: T[];\n headerRow: T;\n}\n\n/**\n * @param columns List of column names\n * @param rows List of rows, where each row is a list of cell texts\n * @returns Markdown formatted string representing the data\n *\n * @example\n * // returns the string:\n * // | Name | Fruit |\n * // | --- | --- |\n * // | Alice | Apple |\n * // | Brady | Banana |\n * createMarkdownTable(['Name', 'Age'], [['Alice', 'Apple'], ['Brady', 'Banana']])\n */\nexport function createMarkdownTable(columns: string[], rows: string[][]): string {\n const headerRow = `| ${columns.join(' | ')} |`;\n const separatorRow = `| ${columns.fill('---').join(' | ')} |`;\n const dataRows = `${rows.map((row) => `| ${row.join(' | ')} |`).join('\\n')}`;\n const markdownTable = `${headerRow}\\n${separatorRow}\\n${dataRows}`;\n return markdownTable;\n}\n","import userEvent from '@testing-library/user-event';\n\nimport { queryHelpers, waitFor, within } from '@databricks/testing-library';\n\nimport { selectClasses } from '../common';\n\n/**\n * Allows the helpers in this module to be used when the select element is\n * queried _semantically_ (as if it were a native <select> element) - i.e.\n * `ByRole('combobox', { name: '...' })`, rather than by test ID.\n *\n * Also checks if <DesignSystemProvider> was used, because many of the helpers\n * in this module query by class name starting with \"du-bois-\", which requires\n * the provider.\n */\nfunction getRootElement(element: HTMLElement): HTMLElement {\n if (element.getAttribute('role') === 'combobox') {\n element = element.closest(`.${selectClasses.selector}`)!.parentElement!;\n }\n if (element.classList.contains('ant-select')) {\n throw new Error('Component must be wrapped by <DesignSystemProvider>');\n }\n return element;\n}\n\nfunction getOptionsList(select: HTMLElement): HTMLElement {\n const body = select.ownerDocument.body;\n const input = within(select).getByRole('combobox');\n const listId = input.getAttribute('aria-owns') || input.getAttribute('aria-controls');\n if (!listId) {\n throw queryHelpers.getElementError('Options input does not control an options list', body);\n }\n\n const listbox = select.ownerDocument.getElementById(listId);\n if (!listbox?.parentElement) {\n throw queryHelpers.getElementError('Options listbox does not have a parent', body);\n }\n\n const optionsList = listbox.parentElement.querySelector<HTMLElement>(`.${selectClasses.list}`);\n if (!optionsList) {\n throw queryHelpers.getElementError('Options list not found', body);\n }\n\n return optionsList;\n}\n\n/**\n * Opens the dropdown menu for the <Select/> by clicking. Will throw an error if\n * the menu is already opened or if the menu is unable to be opened.\n */\nexport async function openMenu(select: HTMLElement): Promise<void> {\n select = getRootElement(select);\n if (select.classList.contains(selectClasses.open)) {\n throw queryHelpers.getElementError('Select is already open', select);\n }\n const selector = select.querySelector(`.${selectClasses.selector}`);\n if (!selector) {\n throw queryHelpers.getElementError('Selector not found', select);\n }\n await userEvent.click(selector, { pointerEventsCheck: 0 });\n await waitFor(() => {\n if (!select.classList.contains(selectClasses.open)) {\n throw queryHelpers.getElementError('Select did not open', select);\n }\n });\n}\n\n/**\n * Closes the dropdown menu for the <Select/> by clicking. Will throw an error if\n * the menu is already closed or if the menu is unable to be closed.\n */\nexport async function closeMenu(select: HTMLElement): Promise<void> {\n select = getRootElement(select);\n if (!select.classList.contains(selectClasses.open)) {\n throw queryHelpers.getElementError('Select is already closed', select);\n }\n const selector = select.querySelector(`.${selectClasses.selector}`);\n if (!selector) {\n throw queryHelpers.getElementError('Selector not found', select);\n }\n await userEvent.click(selector, { pointerEventsCheck: 0 });\n await waitFor(() => {\n if (select.classList.contains(selectClasses.open)) {\n throw queryHelpers.getElementError('Select did not close', select);\n }\n });\n}\n\n/**\n * Returns a string concatenating the labels for all selected options.\n */\nexport function getLabelText(select: HTMLElement): string {\n select = getRootElement(select);\n const selector = select.querySelector(`.${selectClasses.selector}`);\n if (!selector) {\n throw queryHelpers.getElementError('Selector not found', select);\n }\n // Trim the text to avoid weird whitespace issues non-label elements being added.\n // For example, the input mirror is an empty span with some whitespace that is\n // nested under the selector but does not show up in the label text.\n return selector.textContent?.trim() ?? '';\n}\n\n/**\n * Removes the `option` by clicking its \"X\" button. Can only be used with a <Select/>\n * component with `mode=\"multiple\"`. The provided strings must match the option label\n * exactly.\n */\nexport async function removeMultiSelectOption(select: HTMLElement, option: string): Promise<void> {\n select = getRootElement(select);\n const selector = select.querySelector<HTMLElement>(`.${selectClasses.selector}`);\n if (!selector) {\n throw queryHelpers.getElementError('Selector not found', select);\n }\n const optionItem = within(selector).getByText(option).closest(`.${selectClasses.item}`);\n if (optionItem === null) {\n throw queryHelpers.getElementError(`Option \"${option}\" not found`, select);\n }\n const removeItem = optionItem.querySelector(`.${selectClasses.removeItem}`);\n if (removeItem === null) {\n throw queryHelpers.getElementError(`Remove button for option \"${option}\" not found`, optionItem as HTMLElement);\n }\n await userEvent.click(removeItem);\n}\n\n/**\n * Selects options from the dropdown menu for a <Select/> component with `mode=\"multiple\"`.\n * The provided strings must match the option labels exactly. There is a known\n * limitation for lists that are extremely long because AntD virtualizes the\n * options so not all may options may be rendered in the DOM. If this is causing\n * you issues, please let #help-frontend know.\n */\nexport async function multiSelect(select: HTMLElement, options: (string | RegExp)[]): Promise<void> {\n select = getRootElement(select);\n await openMenu(select);\n const optionsList = getOptionsList(select);\n for (let i = 0; i < options.length; i++) {\n const option = options[i];\n const optionItem = within(optionsList).getByText(option);\n await userEvent.click(optionItem, { pointerEventsCheck: 0 });\n }\n // Close the menu to indicate that selection has finished\n await closeMenu(select);\n}\n\n/**\n * Selects options from the dropdown menu for a <Select/> component without a\n * mode. The provided string must match an option label exactly. There is a known\n * limitation for lists that are extremely long because AntD virtualizes the\n * options so not all may options may be rendered in the DOM. If this is causing\n * you issues, please let #help-frontend know.\n */\nexport async function singleSelect(select: HTMLElement, option: string | RegExp): Promise<void> {\n select = getRootElement(select);\n await openMenu(select);\n const optionsList = getOptionsList(select);\n const optionItem = within(optionsList).getByText(option);\n await userEvent.click(optionItem, { pointerEventsCheck: 0 });\n // Menu automatically closes for a single <Select/> (no mode=\"multiple\")\n}\n\n/**\n * Clicks on the \"Clear\" button. In order for this function to work properly,\n * the `allowClear` prop must be set to `true`.\n */\nexport async function clearAll(select: HTMLElement): Promise<void> {\n select = getRootElement(select);\n const clearBtn = select.querySelector(`.${selectClasses.clear}`);\n if (!clearBtn) {\n throw queryHelpers.getElementError('Select not clearable', select);\n }\n await userEvent.click(clearBtn);\n}\n\n/**\n * Opens the dropdown menu, finds all of the options in the dropdown, closes\n * the menu, and returns a list of the text of each option in order.\n */\nexport async function getAllOptions(select: HTMLElement): Promise<string[]> {\n select = getRootElement(select);\n await openMenu(select);\n const optionsList = getOptionsList(select);\n const options: string[] = [];\n optionsList.querySelectorAll(`.${selectClasses.option}`).forEach((option) => {\n if (option.textContent === null) {\n throw queryHelpers.getElementError('Option had no text content', option as HTMLElement);\n }\n options.push(option.textContent);\n });\n await closeMenu(select);\n return options;\n}\n\n/**\n * Creates a new option for a Select with `mode=\"tags\"` by typing it into the input,\n * clicking on the option in the options list, and then closing the menu.\n */\nexport async function createNewOption(select: HTMLElement, option: string): Promise<void> {\n select = getRootElement(select);\n const selectInput = within(select).getByRole<HTMLInputElement>('combobox');\n // eslint-disable-next-line @databricks/no-userevent-type\n await userEvent.type(selectInput, option);\n const optionsList = getOptionsList(select);\n const optionItem = within(optionsList).getByText(option);\n await userEvent.click(optionItem);\n await closeMenu(select);\n}\n","import { expect } from '@jest/globals';\n\nimport { fireEvent, screen } from '@databricks/testing-library';\n\n// Helpers to get the selected option from the trigger\nconst getSelectedOptionLabelFromTrigger = (name?: string | RegExp): string | null => {\n return screen.getByRole('combobox', { name }).textContent;\n};\n\nconst getSelectedOptionValueFromTrigger = (name?: string | RegExp): string | null => {\n return screen.getByRole('combobox', { name }).getAttribute('value');\n};\n\nconst getSelectedOptionFromTrigger = (name?: string | RegExp): { label: string | null; value: string | null } => {\n const label = getSelectedOptionLabelFromTrigger(name);\n const value = getSelectedOptionValueFromTrigger(name);\n return { label, value };\n};\n\nconst expectSelectedOptionFromTriggerToBe = (label: string | RegExp, name?: string | RegExp): void => {\n expect(getSelectedOptionLabelFromTrigger(name)).toBe(label);\n};\n\nconst toggleSelect = (name?: string | RegExp): void => {\n fireEvent.click(screen.getByRole('combobox', { name }));\n};\n\nconst expectSelectToBeOpen = (): void => {\n expect(screen.queryAllByRole('option')).not.toHaveLength(0);\n};\n\nconst expectSelectToBeClosed = (): void => {\n expect(screen.queryAllByRole('option')).toHaveLength(0);\n};\n\n// Generic helpers for when the select is open\nconst getOptionsLength = (): number => {\n return screen.getAllByRole('option').length;\n};\n\nconst getAllOptions = (): (string | null)[] => {\n return screen.getAllByRole('option').flatMap((option) => option.textContent);\n};\n\nconst expectOptionsLengthToBe = (length: number): void => {\n expect(getOptionsLength()).toBe(length);\n};\n\nconst getUnselectedOption = (label: string | RegExp): HTMLElement => {\n return screen.getByRole('option', { name: label, selected: false });\n};\n\nconst getSelectedOption = (label: string | RegExp): HTMLElement => {\n return screen.getByRole('option', { name: label, selected: false });\n};\n\nconst getOption = (label: string | RegExp): HTMLElement => {\n return screen.getByRole('option', { name: label });\n};\n\nconst selectOption = (label: string | RegExp): void => {\n fireEvent.click(screen.getByRole('option', { name: label }));\n};\n\nconst expectSelectedOptionToBe = (label: string | RegExp): void => {\n const options = screen.getAllByRole('option');\n const selectedOption = options.find((option) => option.getAttribute('aria-selected') === 'true');\n expect(selectedOption).toHaveTextContent(label);\n};\n\nexport const simpleSelectTestUtils: {\n getSelectedOptionLabelFromTrigger: typeof getSelectedOptionLabelFromTrigger;\n getSelectedOptionValueFromTrigger: typeof getSelectedOptionValueFromTrigger;\n getSelectedOptionFromTrigger: typeof getSelectedOptionFromTrigger;\n expectSelectedOptionFromTriggerToBe: typeof expectSelectedOptionFromTriggerToBe;\n toggleSelect: typeof toggleSelect;\n expectSelectToBeOpen: typeof expectSelectToBeOpen;\n expectSelectToBeClosed: typeof expectSelectToBeClosed;\n getOptionsLength: typeof getOptionsLength;\n getAllOptions: typeof getAllOptions;\n expectOptionsLengthToBe: typeof expectOptionsLengthToBe;\n getUnselectedOption: typeof getUnselectedOption;\n getSelectedOption: typeof getSelectedOption;\n getOption: typeof getOption;\n selectOption: typeof selectOption;\n expectSelectedOptionToBe: typeof expectSelectedOptionToBe;\n} = {\n getSelectedOptionLabelFromTrigger,\n getSelectedOptionValueFromTrigger,\n getSelectedOptionFromTrigger,\n expectSelectedOptionFromTriggerToBe,\n toggleSelect,\n expectSelectToBeOpen,\n expectSelectToBeClosed,\n getOptionsLength,\n getAllOptions,\n expectOptionsLengthToBe,\n getUnselectedOption,\n getSelectedOption,\n getOption,\n selectOption,\n expectSelectedOptionToBe,\n};\n","import type { UserEvent } from '@testing-library/user-event';\n\nimport { screen, within } from '@databricks/testing-library';\n\n/**\n * Variant of the Accordion component under test.\n *\n * The AntD implementation renders the trigger as `role=\"tab\"` in single-display mode\n * and `role=\"button\"` in multiple-display mode. The Radix implementation always\n * renders a native `<button>` and a `role=\"region\"` panel per the WAI-ARIA APG\n * accordion pattern (https://www.w3.org/WAI/ARIA/apg/patterns/accordion/).\n *\n * Tests that need to run identically against both variants pass the variant in;\n * Radix-only tests can pass `'radix'` and ignore `displayMode`.\n */\nexport type AccordionVariant = 'antd' | 'radix';\n\nexport type AccordionDisplayMode = 'single' | 'multiple';\n\nexport interface AccordionQueryOptions {\n variant: AccordionVariant;\n /** Only affects AntD trigger role lookup. Defaults to `'multiple'`. */\n displayMode?: AccordionDisplayMode;\n /** Scope queries to a subtree instead of the document. */\n container?: HTMLElement;\n}\n\nconst getTriggerRole = ({ variant, displayMode = 'multiple' }: AccordionQueryOptions): 'tab' | 'button' =>\n variant === 'antd' && displayMode === 'single' ? 'tab' : 'button';\n\nconst getScope = (container: HTMLElement | undefined) => (container ? within(container) : screen);\n\n/**\n * Find an accordion trigger by its accessible name. Throws if missing.\n */\nexport const getAccordionTrigger = (name: RegExp | string, options: AccordionQueryOptions): HTMLElement =>\n getScope(options.container).getByRole(getTriggerRole(options), { name });\n\n/**\n * Like {@link getAccordionTrigger} but returns `null` when not found, mirroring RTL's `queryByRole`.\n */\nexport const queryAccordionTrigger = (name: RegExp | string, options: AccordionQueryOptions): HTMLElement | null =>\n getScope(options.container).queryByRole(getTriggerRole(options), { name });\n\n/**\n * Find the panel/region associated with a trigger by accessible name.\n *\n * Radix wires `aria-labelledby` from the panel back to the trigger, so this works.\n * AntD does not assign `role=\"region\"`, so this only works for the Radix variant —\n * tests asserting on panel content under AntD must query the content directly.\n */\nexport const getAccordionRegion = (name: RegExp | string, options: { container?: HTMLElement } = {}): HTMLElement =>\n getScope(options.container).getByRole('region', { name });\n\nexport const queryAccordionRegion = (\n name: RegExp | string,\n options: { container?: HTMLElement } = {},\n): HTMLElement | null => getScope(options.container).queryByRole('region', { name });\n\nexport const isAccordionPanelExpanded = (name: RegExp | string, options: AccordionQueryOptions): boolean =>\n getAccordionTrigger(name, options).getAttribute('aria-expanded') === 'true';\n\n/**\n * Expand a panel by clicking its trigger if not already expanded. No-op if already open.\n * Returns the trigger element so callers can chain assertions.\n */\nexport const expandAccordionPanel = async (\n user: UserEvent,\n name: RegExp | string,\n options: AccordionQueryOptions,\n): Promise<HTMLElement> => {\n const trigger = getAccordionTrigger(name, options);\n if (trigger.getAttribute('aria-expanded') !== 'true') {\n await user.click(trigger);\n }\n return trigger;\n};\n\n/**\n * Collapse a panel by clicking its trigger if currently expanded. No-op if already closed.\n * Returns the trigger element so callers can chain assertions.\n */\nexport const collapseAccordionPanel = async (\n user: UserEvent,\n name: RegExp | string,\n options: AccordionQueryOptions,\n): Promise<HTMLElement> => {\n const trigger = getAccordionTrigger(name, options);\n if (trigger.getAttribute('aria-expanded') === 'true') {\n await user.click(trigger);\n }\n return trigger;\n};\n","/**\n * Reads the checked state of a Du Bois Switch regardless of the rendering engine.\n *\n * The AntD implementation renders the toggle as a `<button role=\"switch\" aria-checked>`, so the\n * checked state lives in the `aria-checked` attribute. The native implementation renders an\n * `<input type=\"checkbox\" role=\"switch\">`, where the checked state is the element's `checked`\n * property and ARIA maps it implicitly (there is no `aria-checked` attribute). This helper reads\n * whichever representation is present so a test asserts identically against both engines.\n *\n * TODO(DUBOIS-471): transitional — delete once `databricks.fe.designsystem.useNativeSwitch` is at\n * 100% and `AntDSwitchInternal` is gone, at which point tests can use `toBeChecked()` directly.\n * https://databricks.atlassian.net/browse/DUBOIS-471\n */\nexport function isSwitchChecked(toggle: Element): boolean {\n return toggle.getAttribute('aria-checked') === 'true' || (toggle as HTMLInputElement).checked === true;\n}\n","import { queryHelpers, within } from '@databricks/testing-library';\n\nimport type { GetTableRowByCellTextOptions, RowIdentifier, TableRows } from '../common';\nimport { createMarkdownTable } from '../common';\n\nfunction getColumnHeaderIndex(tableElement: HTMLElement, columnHeaderName: string | RegExp): number {\n const columnHeader = within(tableElement).getByRole('columnheader', { name: columnHeaderName });\n const columnHeaderIndex = Array.from(columnHeader.parentElement?.children ?? []).indexOf(columnHeader);\n return columnHeaderIndex;\n}\n\n/**\n * Returns the table row that contains the specified `cellText`. The `cellText`\n * must be in the column with name `columnHeaderName` if it is specified. Otherwise,\n * the `cellText` must be in the first column. Throws an error if either multiple\n * rows or no rows can be found that match the given options. Also throws an error\n * if the column with name `columnHeaderName` cannot be found.\n *\n * @param tableElement The HTMLElement representing the table to query in. This is likely\n * a `<div role=\"table\">` element, so it can be queried by `screen.getByRole('table')`.\n * @param cellText The cell text that uniquely identifies the row.\n * @param columnHeaderName The name of the column to search the text for. If not provided,\n * the first column will be used.\n */\nexport function getTableRowByCellText(\n tableElement: HTMLElement,\n cellText: string,\n { columnHeaderName }: GetTableRowByCellTextOptions = {},\n): HTMLElement {\n const columnHeaderIndex = columnHeaderName === undefined ? 0 : getColumnHeaderIndex(tableElement, columnHeaderName);\n\n const matchingRows = within(tableElement)\n .getAllByRole('row')\n // Skip first row (table header)\n .slice(1)\n .filter((row) => {\n const cells = within(row).getAllByRole('cell');\n const cell = cells[columnHeaderIndex];\n const cellContainsText = within(cell).queryByText(cellText) !== null;\n return cellContainsText;\n });\n\n if (matchingRows.length === 0) {\n throw queryHelpers.getElementError(\n `Unable to find a table row with text \"${cellText}\" in the column \"${columnHeaderName}\"`,\n tableElement,\n );\n }\n\n if (matchingRows.length > 1) {\n throw queryHelpers.getElementError(\n `Found multiple table rows with text \"${cellText}\" in the column \"${columnHeaderName}\"`,\n tableElement,\n );\n }\n\n return matchingRows[0];\n}\n\n/**\n * Converts a Du Bois table to a markdown table string. This means that each cell\n * is separated by a pipe (including the edges), the header row is on its own line\n * at the top, each data row is on its own line below, and the header row is separated\n * by a row of dashes from the data rows. This is useful for checking table contents\n * in tests.\n *\n * @param tableElement The HTMLElement representing the table to query in. This is likely\n * a `<div role=\"table\">` element, so it can be queried by `screen.getByRole('table')`.\n *\n * @example\n * The HTML table:\n * ```jsx\n * <Table>\n * <TableRow isHeader>\n * <TableHeader>Name</TableHeader>\n * <TableHeader>Fruit</TableHeader>\n * </TableRow>\n * <TableRow>\n * <TableCell>Alice</TableCell>\n * <TableCell>Apple</TableCell>\n * </TableRow>\n * <TableRow>\n * <TableCell>Brady</TableCell>\n * <TableCell>Banana</TableCell>\n * </TableRow>\n * </Table>\n * ```\n *\n * The Markdown table:\n * ```md\n * | Name | Fruit |\n * | --- | --- |\n * | Alice | Apple |\n * | Brady | Banana |\n * ```\n */\nexport function toMarkdownTable(tableElement: HTMLElement): string {\n const { bodyRows, headerRow } = getTableRows(tableElement);\n const columns = within(headerRow)\n .getAllByRole('columnheader')\n .map((column) => column.textContent ?? '');\n const rows = bodyRows.map((row) =>\n within(row)\n .getAllByRole('cell')\n .map((cell) => cell.textContent ?? ''),\n );\n return createMarkdownTable(columns, rows);\n}\n\n/**\n * Returns the header row and all body rows (non-header rows) in order. Assumes that the\n * `tableElement` has a single header row (as the first row) and the rest of the rows are\n * body rows.\n *\n * @param tableElement The HTMLElement representing the table to query in. This is likely\n * a `<div role=\"table\">` element, so it can be queried by `screen.getByRole('table')`.\n */\nexport function getTableRows(tableElement: HTMLElement): TableRows<HTMLElement> {\n const [firstRow, ...restRows] = within(tableElement).getAllByRole('row');\n return {\n bodyRows: restRows,\n headerRow: firstRow,\n };\n}\n\n/**\n * Returns the table cell in the specified table row corresponding to the given\n * `columnHeaderName`. This is useful for checking that a row has a particular value\n * for a given column, especially when there are duplicate values in the column.\n *\n * @example\n * The HTML table:\n * ```jsx\n * <Table>\n * <TableRow isHeader>\n * <TableHeader>Name</TableHeader>\n * <TableHeader>Age</TableHeader>\n * </TableRow>\n * <TableRow>\n * <TableCell>Alex</TableCell>\n * <TableCell>25</TableCell>\n * </TableRow>\n * <TableRow>\n * <TableCell>Brenda</TableCell>\n * <TableCell>39</TableCell>\n * </TableRow>\n * <TableRow>\n * <TableCell>Carlos</TableCell>\n * <TableCell>39</TableCell>\n * </TableRow>\n * </Table>\n * ```\n *\n * ```js\n * const table = screen.getByRole('table');\n * const result = getTableCellInRow(table, { cellText: 'Carlos' }, 'Age');\n * expect(result.textContent).toEqual('39');\n * ```\n */\nexport function getTableCellInRow(\n tableElement: HTMLElement,\n row: RowIdentifier,\n columnHeaderName: string | RegExp,\n): HTMLElement {\n const tableRowElement = getTableRowByCellText(tableElement, row.cellText, { columnHeaderName: row.columnHeaderName });\n const columnHeaderIndex = getColumnHeaderIndex(tableElement, columnHeaderName);\n const cells = within(tableRowElement).getAllByRole('cell');\n const cell = cells[columnHeaderIndex];\n return cell;\n}\n","import userEvent from '@testing-library/user-event';\n\n/**\n * Opens the dropdown menu by clicking on the dropdown button.\n *\n * @param dropdownButton - The Dropdown Trigger button that opens the menu when clicked.\n */\nexport const openDropdownMenu = async (dropdownButton: HTMLElement): Promise<void> => {\n // eslint-disable-next-line @databricks/no-userevent-type\n await userEvent.type(dropdownButton, '{arrowdown}');\n};\n"],"names":["normalizeText","text","replace","trim","getDisplayLabel","combobox","textContent","getListbox","id","getAttribute","queryHelpers","getElementError","listbox","ownerDocument","getElementById","body","getOptions","within","getAllByRole","getOptionNames","options","map","option","computeAccessibleName","duBoisClassPrefix","selectClasses","clear","item","list","open","removeItem","selector","createMarkdownTable","columns","rows","headerRow","join","separatorRow","fill","dataRows","row","markdownTable","getRootElement","element","closest","parentElement","classList","contains","Error","getOptionsList","select","input","getByRole","listId","optionsList","querySelector","openMenu","userEvent","click","pointerEventsCheck","waitFor","closeMenu","getLabelText","removeMultiSelectOption","optionItem","getByText","multiSelect","i","length","singleSelect","clearAll","clearBtn","getAllOptions","querySelectorAll","forEach","push","createNewOption","selectInput","type","getSelectedOptionLabelFromTrigger","name","screen","getSelectedOptionValueFromTrigger","getSelectedOptionFromTrigger","label","value","expectSelectedOptionFromTriggerToBe","expect","toBe","toggleSelect","fireEvent","expectSelectToBeOpen","queryAllByRole","not","toHaveLength","expectSelectToBeClosed","getOptionsLength","flatMap","expectOptionsLengthToBe","getUnselectedOption","selected","getSelectedOption","getOption","selectOption","expectSelectedOptionToBe","selectedOption","find","toHaveTextContent","simpleSelectTestUtils","getTriggerRole","variant","displayMode","getScope","container","getAccordionTrigger","queryAccordionTrigger","queryByRole","getAccordionRegion","queryAccordionRegion","isAccordionPanelExpanded","expandAccordionPanel","user","trigger","collapseAccordionPanel","isSwitchChecked","toggle","checked","getColumnHeaderIndex","tableElement","columnHeaderName","columnHeader","columnHeaderIndex","Array","from","children","indexOf","getTableRowByCellText","cellText","undefined","matchingRows","slice","filter","cells","cell","cellContainsText","queryByText","toMarkdownTable","bodyRows","getTableRows","column","firstRow","restRows","getTableCellInRow","tableRowElement","openDropdownMenu","dropdownButton"],"mappings":";;;;;AAIA,SAASA,cAAcC,IAAY,EAAA;AACjC,IAAA,OAAOA,IAAAA,CAAKC,OAAO,CAAC,MAAA,EAAQ,KAAKC,IAAI,EAAA;AACvC;AAEA;;;IAIO,SAASC,eAAAA,CAAgBC,QAAqB,EAAA;IACnD,OAAOL,aAAAA,CAAcK,QAAAA,CAASC,WAAW,IAAI,EAAA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CAACX,iBAAAA,CAAkB;IACrC,OAAOY,IAAAA;AACT;;ACvKA;;;;IAKO,MAAMW,gBAAAA,GAAmB,OAAOC,cAAAA,GAAAA;;IAErC,MAAMlG,SAAAA,CAAUqB,IAAI,CAAC6E,cAAAA,EAAgB,aAAA,CAAA;AACvC;;;;"}
@@ -3,7 +3,7 @@ import type { ButtonProps } from "../Button";
3
3
  import { DesignSystemEventProviderAnalyticsEventTypes } from "../DesignSystemEventProvider";
4
4
  import type { AnalyticsEventProps, DangerouslySetAntdProps, HTMLDataAttributes } from "../types";
5
5
  export type AlertType = NonNullable<AntDAlertProps["type"]>;
6
- export interface AlertProps extends Omit<AntDAlertProps, "closeText" | "showIcon" | "type" | "icon">, HTMLDataAttributes, DangerouslySetAntdProps<AntDAlertProps>, AnalyticsEventProps<DesignSystemEventProviderAnalyticsEventTypes.OnView> {
6
+ export interface AlertProps extends Omit<AntDAlertProps, "closeText" | "showIcon" | "type" | "icon">, HTMLDataAttributes, DangerouslySetAntdProps<Partial<Pick<AntDAlertProps, "showIcon" | "icon" | "message" | "description" | "type">>>, AnalyticsEventProps<DesignSystemEventProviderAnalyticsEventTypes.OnView> {
7
7
  type: AlertType;
8
8
  closeIconLabel?: string;
9
9
  /**
@@ -52,12 +52,9 @@ export interface DesignSystemProviderProps {
52
52
  spacing?: Partial<Theme["spacing"]>;
53
53
  };
54
54
  /**
55
- * Internal. When true, suppresses the `display: contents` token-scope wrapper this provider
56
- * otherwise renders around its children. Set by `ApplyDesignSystemContextOverrides`: it only
57
- * overrides context props and cannot change the token scope (no `isDarkMode`/`semanticColors`),
58
- * so the scope is already established by an ancestor provider (in-tree) or re-applied on the
59
- * portal root (Modal/Drawer/DropdownMenu each carry the scope class themselves). A second wrapper
60
- * there would only add a redundant DOM node that breaks consumers' direct-child selectors.
55
+ * Internal. Suppress the `DesignTokenScopeImpl` this provider renders around its children. Defaulted to
56
+ * true by `ApplyDesignSystemContextOverrides` (it inherits an ancestor's scope, so a second wrapper
57
+ * would be a redundant DOM node); pass `false` when this subtree establishes a NEW scope.
61
58
  */
62
59
  disableTokenScopeWrapper?: boolean;
63
60
  }
@@ -101,6 +98,31 @@ export declare const DesignSystemThemeProvider: React.FC<React.PropsWithChildren
101
98
  * while DOM inheritance does not.
102
99
  */
103
100
  export declare function useDesignTokenOverrideStyles(): React.CSSProperties | undefined;
101
+ export interface DesignTokenScopeProps {
102
+ children: React.ReactNode;
103
+ /** Raw `--db-*` design-token overrides for this subtree, merged on top of any ambient overrides. */
104
+ overrideTokens?: DesignTokenOverrides;
105
+ /** Semantic color overrides (camelCase), merged on top of any ambient semantic colors. */
106
+ semanticColors?: Partial<Record<ValidSemanticColors, string>>;
107
+ /** Force the scope's light/dark mode; defaults to the ambient theme. */
108
+ isDarkMode?: boolean;
109
+ }
110
+ /**
111
+ * Applies design-token overrides to a component or page subtree, reaching BOTH in-tree components and
112
+ * portaled surfaces (Modal, Drawer, DropdownMenu, Popover, Notification, …). This is the primitive to
113
+ * reach for whenever you retheme a slice under the design-token system.
114
+ *
115
+ * It layers over the ambient scope rather than replacing it: `isDarkMode` falls back to the ambient
116
+ * theme, and `semanticColors` / `overrideTokens` merge on top of any ambient overrides. The in-tree
117
+ * half is stamped on a `display: contents` DOM element (`DesignTokenScopeImpl`); the portal half is
118
+ * fed through `DesignSystemThemeContext` (via `DesignSystemThemeProvider`), which portaled surfaces
119
+ * re-stamp on their own portal root via `useDesignTokenOverrideStyles()` — context crosses React
120
+ * portals while DOM inheritance does not.
121
+ *
122
+ * For a subtree that still mixes legacy AntD-path (emotion JS theme) components mid-migration, use
123
+ * `DesignTokenScopeWithEmotionTheme`, which additionally drives the emotion theme.
124
+ */
125
+ export declare const DesignTokenScope: ({ children, overrideTokens, semanticColors, isDarkMode }: DesignTokenScopeProps) => JSX.Element;
104
126
  export declare const DesignSystemProvider: React.FC<React.PropsWithChildren<DesignSystemProviderProps>>;
105
127
  export declare const ApplyDesignSystemContextOverrides: React.FC<React.PropsWithChildren<DesignSystemProviderProps>>;
106
128
  export declare const ApplyDesignSystemFlags: React.FC<React.PropsWithChildren<{
@@ -0,0 +1,23 @@
1
+ import type { PropsWithChildren } from "react";
2
+ import type { Theme } from "../../theme";
3
+ export interface DesignTokenScopeWithEmotionThemeProps {
4
+ theme: Theme;
5
+ }
6
+ /**
7
+ * Migration-only bridge: relevant only while a subtree still mixes the two theming systems. It layers
8
+ * a full emotion `Theme` on top of `DesignTokenScope` so the override stays consistent across both
9
+ * delivery paths that would otherwise diverge:
10
+ * 1. Emotion JS theme — what legacy AntD-path components read; crosses React portals via context.
11
+ * 2. Design tokens (in-tree + portaled) — `DesignTokenScope` stamps the theme's colors as native
12
+ * `--db-color-*` variables on its DOM scope and feeds `DesignSystemThemeContext`, so both in-tree
13
+ * and portaled native (token-based) components inherit them.
14
+ *
15
+ * A bare emotion `ThemeProvider` only drives path 1, so an overridden theme's colors would land on
16
+ * AntD components but leave native ones on the ambient scope's standard tokens. Once everything is on
17
+ * the design-token system this wrapper collapses to a plain `DesignTokenScope` and can be removed.
18
+ *
19
+ * @deprecated Migration-only bridge; do not use in new code. Prefer a plain `DesignTokenScope` — this
20
+ * wrapper exists solely to keep emotion-theme and design-token overrides consistent while a subtree
21
+ * still mixes the two theming systems.
22
+ */
23
+ export declare function DesignTokenScopeWithEmotionTheme({ theme, children }: PropsWithChildren<DesignTokenScopeWithEmotionThemeProps>): JSX.Element;
@@ -1 +1,2 @@
1
1
  export * from "./DesignSystemProvider";
2
+ export * from "./DesignTokenScopeWithEmotionTheme";
@@ -0,0 +1,11 @@
1
+ export declare const BUTTON_VARIANT_CLASS_TOKENS: {
2
+ readonly primary: readonly ["du-bois-light-btn-primary", "du-bois-dark-btn-primary", "ant-btn-primary", "ds-btn-primary"];
3
+ readonly dangerous: readonly ["du-bois-light-btn-dangerous", "du-bois-dark-btn-dangerous", "ant-btn-dangerous", "ds-btn-danger"];
4
+ readonly block: readonly ["du-bois-light-btn-block", "du-bois-dark-btn-block", "ant-btn-block", "ds-btn-block"];
5
+ readonly link: readonly ["du-bois-light-btn-link", "du-bois-dark-btn-link", "ant-btn-link", "ds-btn-link"];
6
+ };
7
+ export type ButtonVariant = keyof typeof BUTTON_VARIANT_CLASS_TOKENS;
8
+ export declare const isPrimaryButton: (button: Element) => boolean;
9
+ export declare const isDangerousButton: (button: Element) => boolean;
10
+ export declare const isBlockButton: (button: Element) => boolean;
11
+ export declare const isLinkButton: (button: Element) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databricks/design-system",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "DuBois Design System",
5
5
  "keywords": [],
6
6
  "license": "ISC",
@@ -26,6 +26,11 @@
26
26
  "import": "./dist/patterns.js",
27
27
  "require": "./dist/patterns.js"
28
28
  },
29
+ "./test-utils/rtl/buttonVariants": {
30
+ "types": "./dist-types/test-utils/rtl/buttonVariants.d.ts",
31
+ "import": "./dist/test-utils/rtl/buttonVariants.js",
32
+ "require": "./dist/test-utils/rtl/buttonVariants.js"
33
+ },
29
34
  "./test-utils/*": {
30
35
  "types": "./dist-types/test-utils/*/index.d.ts",
31
36
  "import": "./dist/test-utils/*",
@@ -132,6 +137,7 @@
132
137
  },
133
138
  "dependencies": {
134
139
  "@ant-design/icons": "^4.7.0",
140
+ "@databricks/testing-library": "1.0.0",
135
141
  "@emotion/unitless": "^0.8.1",
136
142
  "@floating-ui/dom": "^1.6.12",
137
143
  "@floating-ui/react": "^0.26.25",