From ab35c27ebdb317e916b98caa1d521ae7c4e2069a Mon Sep 17 00:00:00 2001 From: GitHub Date: Thu, 21 Nov 2024 14:19:32 +1100 Subject: [PATCH] chore: fix rest of tests from provider requirement --- .../dnd/test/useDroppableCollection.test.js | 2 +- .../landmark/test/useLandmark.test.tsx | 2 +- .../accordion/test/Accordion.test.js | 2 +- .../actionbar/test/ActionBar.test.js | 2 +- .../avatar/test/Avatar.test.js | 2 +- .../@react-spectrum/badge/test/Badge.test.js | 2 +- .../breadcrumbs/test/BreadcrumbItem.test.js | 2 +- .../breadcrumbs/test/Breadcrumbs.test.js | 2 +- .../button/test/ActionButton.test.js | 2 +- .../button/test/Button.test.js | 2 +- .../button/test/ClearButton.test.js | 2 +- .../button/test/ToggleButton.test.js | 2 +- .../buttongroup/test/ButtonGroup.test.js | 2 +- .../calendar/test/Calendar.test.js | 2 +- .../calendar/test/CalendarBase.test.js | 10 +-- .../calendar/test/RangeCalendar.test.js | 2 +- .../@react-spectrum/card/test/Card.test.js | 2 +- .../card/test/CardView.test.js | 86 ++++++++----------- .../checkbox/test/Checkbox.test.js | 2 +- .../checkbox/test/CheckboxGroup.test.js | 2 +- .../color/test/ColorField.test.js | 2 +- .../color/test/ColorSwatchPicker.test.js | 2 +- .../test/ContextualHelp.test.js | 2 +- .../datepicker/test/DateField.test.js | 2 +- .../datepicker/test/DateRangePicker.test.js | 6 +- .../datepicker/test/TimeField.test.js | 2 +- .../dialog/test/AlertDialog.test.js | 2 +- .../dialog/test/Dialog.test.js | 2 +- .../dialog/test/DialogContainer.test.js | 2 +- .../divider/test/Divider.test.js | 2 +- .../dropzone/test/DropZone.test.js | 4 +- .../@react-spectrum/form/test/Form.test.js | 2 +- packages/@react-spectrum/icon/src/Icon.tsx | 12 +-- packages/@react-spectrum/icon/src/UIIcon.tsx | 12 +-- .../@react-spectrum/icon/test/Icon.test.js | 2 +- .../icon/test/Illustration.test.js | 2 +- .../@react-spectrum/icon/test/UIIcon.test.js | 2 +- .../test/IllustratedMessage.test.js | 2 +- .../@react-spectrum/image/test/Image.test.js | 2 +- .../inlinealert/test/InlineAlert.test.js | 2 +- .../@react-spectrum/label/test/Field.test.js | 2 +- .../labeledvalue/test/LabeledValue.test.js | 2 +- .../@react-spectrum/link/test/Link.test.js | 2 +- .../listbox/test/ListBox.test.js | 2 +- .../menu/test/ActionMenu.test.js | 2 +- .../@react-spectrum/menu/test/Menu.test.js | 2 +- .../@react-spectrum/meter/test/Meter.test.js | 2 +- .../numberfield/test/NumberField.test.js | 25 +++--- .../overlays/test/Modal.test.js | 2 +- .../overlays/test/Overlay.test.js | 2 +- .../overlays/test/Popover.test.js | 2 +- .../overlays/test/Tray.test.js | 2 +- .../picker/test/Picker.test.js | 2 +- .../picker/test/TempUtilTest.test.js | 2 +- .../progress/test/ProgressBar.test.js | 2 +- .../progress/test/ProgressCircle.test.js | 2 +- .../provider/test/Provider.test.tsx | 2 +- .../@react-spectrum/radio/test/Radio.test.js | 46 +++++----- .../searchfield/test/SearchField.test.js | 2 +- .../searchwithin/test/SearchWithin.test.js | 2 +- .../slider/test/RangeSlider.test.tsx | 20 ++--- .../slider/test/Slider.test.tsx | 40 +++------ .../statuslight/test/StatusLight.test.js | 2 +- .../steplist/test/StepList.test.tsx | 2 +- .../switch/test/Switch.test.js | 2 +- .../table/test/TestTableUtils.test.js | 2 +- .../@react-spectrum/tabs/test/Tabs.test.js | 2 +- .../textfield/test/TextArea.test.js | 2 +- .../textfield/test/TextField.test.js | 4 +- .../toast/test/ToastContainer.test.js | 2 +- .../tooltip/test/Tooltip.test.js | 2 +- .../tooltip/test/TooltipTrigger.test.js | 2 +- .../tree/test/TreeView.test.tsx | 2 +- .../@react-spectrum/utils/test/Slots.test.js | 2 +- .../@react-spectrum/view/test/View.test.js | 2 +- .../@react-spectrum/well/test/Well.test.js | 2 +- .../ui/scripts/generateIcons.cjs | 7 +- 77 files changed, 172 insertions(+), 230 deletions(-) diff --git a/packages/@react-aria/dnd/test/useDroppableCollection.test.js b/packages/@react-aria/dnd/test/useDroppableCollection.test.js index 528e1e99c55..649263c6bb2 100644 --- a/packages/@react-aria/dnd/test/useDroppableCollection.test.js +++ b/packages/@react-aria/dnd/test/useDroppableCollection.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, pointerMap, render, waitFor, within} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, pointerMap, renderv3 as render, waitFor, within} from '@react-spectrum/test-utils-internal'; import {DataTransfer, DragEvent} from './mocks'; import {Draggable} from './examples'; import {DroppableGridExample} from '../stories/DroppableGrid'; diff --git a/packages/@react-aria/landmark/test/useLandmark.test.tsx b/packages/@react-aria/landmark/test/useLandmark.test.tsx index 34919310dd4..0fe2d9f5271 100644 --- a/packages/@react-aria/landmark/test/useLandmark.test.tsx +++ b/packages/@react-aria/landmark/test/useLandmark.test.tsx @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, pointerMap, render, within} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, pointerMap, renderv3 as render, within} from '@react-spectrum/test-utils-internal'; import {ActionGroup, Item} from '@react-spectrum/actiongroup'; import {Button} from '@react-spectrum/button'; import {Cell, Column, Row, TableBody, TableHeader, TableView} from '@react-spectrum/table'; diff --git a/packages/@react-spectrum/accordion/test/Accordion.test.js b/packages/@react-spectrum/accordion/test/Accordion.test.js index 7f3721c1e0a..7396728b1b4 100644 --- a/packages/@react-spectrum/accordion/test/Accordion.test.js +++ b/packages/@react-spectrum/accordion/test/Accordion.test.js @@ -11,7 +11,7 @@ */ import {Accordion, Disclosure, DisclosurePanel, DisclosureTitle} from '../src'; -import {act, pointerMap, render, within} from '@react-spectrum/test-utils-internal'; +import {act, pointerMap, renderv3 as render, within} from '@react-spectrum/test-utils-internal'; import {Provider} from '@react-spectrum/provider'; import React from 'react'; import {theme} from '@react-spectrum/theme-default'; diff --git a/packages/@react-spectrum/actionbar/test/ActionBar.test.js b/packages/@react-spectrum/actionbar/test/ActionBar.test.js index dccdc80929b..c33aa82b7b5 100644 --- a/packages/@react-spectrum/actionbar/test/ActionBar.test.js +++ b/packages/@react-spectrum/actionbar/test/ActionBar.test.js @@ -12,7 +12,7 @@ jest.mock('@react-aria/live-announcer'); -import {act, fireEvent, pointerMap, render, within} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, pointerMap, renderv3 as render, within} from '@react-spectrum/test-utils-internal'; import {announce} from '@react-aria/live-announcer'; import {Example} from '../stories/Example'; import {getFocusableTreeWalker} from '@react-aria/focus'; diff --git a/packages/@react-spectrum/avatar/test/Avatar.test.js b/packages/@react-spectrum/avatar/test/Avatar.test.js index f42e4a73556..2a11cefac10 100644 --- a/packages/@react-spectrum/avatar/test/Avatar.test.js +++ b/packages/@react-spectrum/avatar/test/Avatar.test.js @@ -1,6 +1,6 @@ import {Avatar} from '../'; import React from 'react'; -import {render, screen} from '@react-spectrum/test-utils-internal'; +import {renderv3 as render, screen} from '@react-spectrum/test-utils-internal'; let isOldReact = parseInt(React.version, 10) < 18; diff --git a/packages/@react-spectrum/badge/test/Badge.test.js b/packages/@react-spectrum/badge/test/Badge.test.js index 35930981543..4eb4050f276 100644 --- a/packages/@react-spectrum/badge/test/Badge.test.js +++ b/packages/@react-spectrum/badge/test/Badge.test.js @@ -13,7 +13,7 @@ import {Badge} from '../'; import CheckmarkCircle from '@spectrum-icons/workflow/CheckmarkCircle'; import React from 'react'; -import {render} from '@react-spectrum/test-utils-internal'; +import {renderv3 as render} from '@react-spectrum/test-utils-internal'; import {Text} from '@react-spectrum/text'; import {within} from '@testing-library/dom'; diff --git a/packages/@react-spectrum/breadcrumbs/test/BreadcrumbItem.test.js b/packages/@react-spectrum/breadcrumbs/test/BreadcrumbItem.test.js index bd44c1f7c58..854bce63593 100644 --- a/packages/@react-spectrum/breadcrumbs/test/BreadcrumbItem.test.js +++ b/packages/@react-spectrum/breadcrumbs/test/BreadcrumbItem.test.js @@ -11,7 +11,7 @@ */ import {BreadcrumbItem} from '../src/BreadcrumbItem'; -import {pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import React from 'react'; import userEvent from '@testing-library/user-event'; diff --git a/packages/@react-spectrum/breadcrumbs/test/Breadcrumbs.test.js b/packages/@react-spectrum/breadcrumbs/test/Breadcrumbs.test.js index 43c50730cae..f9d4e05152e 100644 --- a/packages/@react-spectrum/breadcrumbs/test/Breadcrumbs.test.js +++ b/packages/@react-spectrum/breadcrumbs/test/Breadcrumbs.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, pointerMap, render, within} from '@react-spectrum/test-utils-internal'; +import {act, pointerMap, renderv3 as render, within} from '@react-spectrum/test-utils-internal'; import {Breadcrumbs} from '../'; import {Item} from '@react-stately/collections'; import {Provider} from '@react-spectrum/provider'; diff --git a/packages/@react-spectrum/button/test/ActionButton.test.js b/packages/@react-spectrum/button/test/ActionButton.test.js index 3fd868e73b8..7f8bc06507a 100644 --- a/packages/@react-spectrum/button/test/ActionButton.test.js +++ b/packages/@react-spectrum/button/test/ActionButton.test.js @@ -11,7 +11,7 @@ */ import {ActionButton} from '../'; -import {pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import React from 'react'; import userEvent from '@testing-library/user-event'; diff --git a/packages/@react-spectrum/button/test/Button.test.js b/packages/@react-spectrum/button/test/Button.test.js index 42a5ed6b639..6b60b9289b2 100644 --- a/packages/@react-spectrum/button/test/Button.test.js +++ b/packages/@react-spectrum/button/test/Button.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {act, pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import {ActionButton, Button, ClearButton, LogicButton} from '../'; import {Checkbox, defaultTheme} from '@adobe/react-spectrum'; import {Form} from '@react-spectrum/form'; diff --git a/packages/@react-spectrum/button/test/ClearButton.test.js b/packages/@react-spectrum/button/test/ClearButton.test.js index 81e8fef2e2a..2cbea588cc0 100644 --- a/packages/@react-spectrum/button/test/ClearButton.test.js +++ b/packages/@react-spectrum/button/test/ClearButton.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {act, pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import {ClearButton} from '../'; import React from 'react'; import userEvent from '@testing-library/user-event'; diff --git a/packages/@react-spectrum/button/test/ToggleButton.test.js b/packages/@react-spectrum/button/test/ToggleButton.test.js index 985fad1991e..5c7f9772764 100644 --- a/packages/@react-spectrum/button/test/ToggleButton.test.js +++ b/packages/@react-spectrum/button/test/ToggleButton.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import React from 'react'; import {ToggleButton} from '../'; import userEvent from '@testing-library/user-event'; diff --git a/packages/@react-spectrum/buttongroup/test/ButtonGroup.test.js b/packages/@react-spectrum/buttongroup/test/ButtonGroup.test.js index 43131e96193..73c43567469 100644 --- a/packages/@react-spectrum/buttongroup/test/ButtonGroup.test.js +++ b/packages/@react-spectrum/buttongroup/test/ButtonGroup.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, pointerMap, render, within} from '@react-spectrum/test-utils-internal'; +import {act, pointerMap, renderv3 as render, within} from '@react-spectrum/test-utils-internal'; import {Button} from '@react-spectrum/button'; import {ButtonGroup} from '../'; import {Provider} from '@react-spectrum/provider'; diff --git a/packages/@react-spectrum/calendar/test/Calendar.test.js b/packages/@react-spectrum/calendar/test/Calendar.test.js index cc6fb087623..cb6653f2c43 100644 --- a/packages/@react-spectrum/calendar/test/Calendar.test.js +++ b/packages/@react-spectrum/calendar/test/Calendar.test.js @@ -16,7 +16,7 @@ jest.mock('@react-aria/live-announcer'); import {announce} from '@react-aria/live-announcer'; import {Calendar} from '../'; import {CalendarDate, isWeekend} from '@internationalized/date'; -import {pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import React from 'react'; import {useLocale} from '@react-aria/i18n'; import userEvent from '@testing-library/user-event'; diff --git a/packages/@react-spectrum/calendar/test/CalendarBase.test.js b/packages/@react-spectrum/calendar/test/CalendarBase.test.js index c9420ab497b..edf3b0fb197 100644 --- a/packages/@react-spectrum/calendar/test/CalendarBase.test.js +++ b/packages/@react-spectrum/calendar/test/CalendarBase.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, pointerMap, render, within} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, render as noProviderRender, pointerMap, renderv3 as render, within} from '@react-spectrum/test-utils-internal'; import {Calendar, RangeCalendar} from '../'; import {CalendarDate, GregorianCalendar, today} from '@internationalized/date'; import {Provider} from '@react-spectrum/provider'; @@ -268,10 +268,8 @@ describe('CalendarBase', () => { ${'v3 RangeCalendar'} | ${RangeCalendar} `('$Name should handle minimum dates in a calendar system', ({Calendar}) => { let {getByRole, getAllByRole} = render( - - - - ); + + , undefined, {locale: 'en-US-u-ca-japanese'}); let grid = getByRole('grid'); let headers = within(grid).getAllByRole('columnheader', {hidden: true}); @@ -752,7 +750,7 @@ describe('CalendarBase', () => { ${'v3 RangeCalendar'} | ${RangeCalendar} | ${{defaultValue: {start: new CalendarDate(2019, 6, 5), end: new CalendarDate(2019, 6, 10)}}} `('$Name should mirror arrow key movement in an RTL locale', async ({Calendar, props}) => { // LTR - let {getByRole, getAllByRole, rerender} = render( + let {getByRole, getAllByRole, rerender} = noProviderRender( diff --git a/packages/@react-spectrum/calendar/test/RangeCalendar.test.js b/packages/@react-spectrum/calendar/test/RangeCalendar.test.js index 21ea681e974..122503f698c 100644 --- a/packages/@react-spectrum/calendar/test/RangeCalendar.test.js +++ b/packages/@react-spectrum/calendar/test/RangeCalendar.test.js @@ -11,7 +11,7 @@ */ jest.mock('@react-aria/live-announcer'); -import {act, fireEvent, installPointerEvent, pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, installPointerEvent, pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import {announce} from '@react-aria/live-announcer'; import {CalendarDate, isWeekend} from '@internationalized/date'; import {RangeCalendar} from '../'; diff --git a/packages/@react-spectrum/card/test/Card.test.js b/packages/@react-spectrum/card/test/Card.test.js index 938bfa561cb..ff93a87bf64 100644 --- a/packages/@react-spectrum/card/test/Card.test.js +++ b/packages/@react-spectrum/card/test/Card.test.js @@ -13,7 +13,7 @@ import {Card} from '../src'; import {composeStories} from '@storybook/react'; import * as defaultStories from '../chromatic/Card.stories'; -import {pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import * as quietStories from '../chromatic/QuietCard.stories'; import React from 'react'; import userEvent from '@testing-library/user-event'; diff --git a/packages/@react-spectrum/card/test/CardView.test.js b/packages/@react-spectrum/card/test/CardView.test.js index 9ed6a8df3e9..3bd4570f10e 100644 --- a/packages/@react-spectrum/card/test/CardView.test.js +++ b/packages/@react-spectrum/card/test/CardView.test.js @@ -11,18 +11,15 @@ */ jest.mock('@react-aria/utils/src/scrollIntoView'); -import {act, fireEvent, pointerMap, render, within} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, pointerMap, renderv3 as render, within} from '@react-spectrum/test-utils-internal'; import {Card, CardView, GalleryLayout, GridLayout, WaterfallLayout} from '../'; import {composeStories} from '@storybook/react'; import {Content} from '@react-spectrum/view'; import {Heading, Text} from '@react-spectrum/text'; import {Image} from '@react-spectrum/image'; -import {Provider} from '@react-spectrum/provider'; import React, {useMemo} from 'react'; -import scaleMedium from '@adobe/spectrum-css-temp/vars/spectrum-medium-unique.css'; import {scrollIntoView} from '@react-aria/utils'; import * as stories from '../stories/GridCardView.stories'; -import themeLight from '@adobe/spectrum-css-temp/vars/spectrum-light-unique.css'; import {useCollator} from '@react-aria/i18n'; import userEvent from '@testing-library/user-event'; @@ -31,11 +28,6 @@ let isOldReact = parseInt(React.version, 10) < 18; let {falsyItems} = stories; let {FalsyIds} = composeStories(stories); -let theme = { - light: themeLight, - medium: scaleMedium -}; - let defaultItems = [ {width: 1001, height: 381, src: 'https://i.imgur.com/Z7AzH2c.jpg', title: 'Title 1'}, {width: 640, height: 640, src: 'https://i.imgur.com/DhygPot.jpg', title: 'Title 2'}, @@ -77,33 +69,30 @@ function StaticCardView(props) { let { layout = gridLayout, selectionMode = 'multiple', - locale = 'en-US', ...otherProps } = props; return ( - - - - - Title 1 - PNG - Description - - - - Title 1 - PNG - Description - - - - Title 1 - PNG - Description - - - + + + + Title 1 + PNG + Description + + + + Title 1 + PNG + Description + + + + Title 1 + PNG + Description + + ); } @@ -115,23 +104,20 @@ function DynamicCardView(props) { layout = gridLayout, selectionMode = 'multiple', items = defaultItems, - locale = 'en-US', ...otherProps } = props; return ( - - - {(item) => ( - - - {item.title} - PNG - Description - + + {(item) => ( + + + {item.title} + PNG + Description + )} - - + ); } @@ -225,9 +211,7 @@ describe('CardView', function () { ${'Waterfall layout'} | ${WaterfallLayout} `('$Name CardView supports falsy ids', function ({layout}) { let tree = render( - - - + ); act(() => { jest.runAllTimers(); @@ -394,7 +378,7 @@ describe('CardView', function () { ${'Grid layout'} | ${GridLayout} ${'Gallery layout'} | ${GalleryLayout} `('$Name CardView should move focus via Arrow Left (RTL)', async function ({Name, layout}) { - let tree = render(); + let tree = render(, undefined, {locale: 'ar-AE'}); act(() => { jest.runAllTimers(); }); @@ -460,7 +444,7 @@ describe('CardView', function () { ${'Grid layout'} | ${GridLayout} ${'Gallery layout'} | ${GalleryLayout} `('$Name CardView should move focus via Arrow Right (RTL)', async function ({Name, layout}) { - let tree = render(); + let tree = render(, undefined, {locale: 'ar-AE'}); act(() => { jest.runAllTimers(); }); @@ -842,7 +826,7 @@ describe('CardView', function () { }); it('should move focus via Arrow Left (RTL)', async function () { - let tree = render(); + let tree = render(, undefined, {locale: 'ar-AE'}); act(() => { jest.runAllTimers(); }); @@ -899,7 +883,7 @@ describe('CardView', function () { }); it('should move focus via Arrow Right (RTL)', async function () { - let tree = render(); + let tree = render(, undefined, {locale: 'ar-AE'}); act(() => { jest.runAllTimers(); }); diff --git a/packages/@react-spectrum/checkbox/test/Checkbox.test.js b/packages/@react-spectrum/checkbox/test/Checkbox.test.js index 566a61ab088..85f3491dab9 100644 --- a/packages/@react-spectrum/checkbox/test/Checkbox.test.js +++ b/packages/@react-spectrum/checkbox/test/Checkbox.test.js @@ -14,7 +14,7 @@ import {act} from 'react-dom/test-utils'; import {Button} from '@react-spectrum/button'; import {Checkbox} from '../'; import {Form} from '@react-spectrum/form'; -import {pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import {Provider} from '@react-spectrum/provider'; import React from 'react'; import {theme} from '@react-spectrum/theme-default'; diff --git a/packages/@react-spectrum/checkbox/test/CheckboxGroup.test.js b/packages/@react-spectrum/checkbox/test/CheckboxGroup.test.js index 6c0f4a5eb81..4a950951b21 100644 --- a/packages/@react-spectrum/checkbox/test/CheckboxGroup.test.js +++ b/packages/@react-spectrum/checkbox/test/CheckboxGroup.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, pointerMap, render, within} from '@react-spectrum/test-utils-internal'; +import {act, pointerMap, renderv3 as render, within} from '@react-spectrum/test-utils-internal'; import {Button} from '@react-spectrum/button'; import {Checkbox, CheckboxGroup} from '../'; import {Form} from '@react-spectrum/form'; diff --git a/packages/@react-spectrum/color/test/ColorField.test.js b/packages/@react-spectrum/color/test/ColorField.test.js index a2bcb3f5619..2db9e8306b9 100644 --- a/packages/@react-spectrum/color/test/ColorField.test.js +++ b/packages/@react-spectrum/color/test/ColorField.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import {Button} from '@react-spectrum/button'; import {chain} from '@react-aria/utils'; import {ColorField} from '../'; diff --git a/packages/@react-spectrum/color/test/ColorSwatchPicker.test.js b/packages/@react-spectrum/color/test/ColorSwatchPicker.test.js index afa607c883e..20ea8bcd2bd 100644 --- a/packages/@react-spectrum/color/test/ColorSwatchPicker.test.js +++ b/packages/@react-spectrum/color/test/ColorSwatchPicker.test.js @@ -11,7 +11,7 @@ */ import {ColorSwatch, ColorSwatchPicker, parseColor} from '../src'; -import {pointerMap, render, within} from '@react-spectrum/test-utils-internal'; +import {pointerMap, renderv3 as render, within} from '@react-spectrum/test-utils-internal'; import React from 'react'; import userEvent from '@testing-library/user-event'; diff --git a/packages/@react-spectrum/contextualhelp/test/ContextualHelp.test.js b/packages/@react-spectrum/contextualhelp/test/ContextualHelp.test.js index 659e8f60e04..d2b1584796c 100644 --- a/packages/@react-spectrum/contextualhelp/test/ContextualHelp.test.js +++ b/packages/@react-spectrum/contextualhelp/test/ContextualHelp.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, pointerMap, render, simulateDesktop} from '@react-spectrum/test-utils-internal'; +import {act, pointerMap, renderv3 as render, simulateDesktop} from '@react-spectrum/test-utils-internal'; import {Content, Footer, Header} from '@react-spectrum/view'; import {ContextualHelp} from '../'; import {Link} from '@react-spectrum/link'; diff --git a/packages/@react-spectrum/datepicker/test/DateField.test.js b/packages/@react-spectrum/datepicker/test/DateField.test.js index fcf31ab53e5..473cad1f85b 100644 --- a/packages/@react-spectrum/datepicker/test/DateField.test.js +++ b/packages/@react-spectrum/datepicker/test/DateField.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, pointerMap, render as render_, within} from '@react-spectrum/test-utils-internal'; +import {act, pointerMap, renderv3 as render_, within} from '@react-spectrum/test-utils-internal'; import {Button} from '@react-spectrum/button'; import {CalendarDate, CalendarDateTime, ZonedDateTime} from '@internationalized/date'; import {DateField} from '../'; diff --git a/packages/@react-spectrum/datepicker/test/DateRangePicker.test.js b/packages/@react-spectrum/datepicker/test/DateRangePicker.test.js index 93ad2439f13..9c62e935d0c 100644 --- a/packages/@react-spectrum/datepicker/test/DateRangePicker.test.js +++ b/packages/@react-spectrum/datepicker/test/DateRangePicker.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, getAllByRole as getAllByRoleInContainer, pointerMap, render as render_, waitFor, within} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, getAllByRole as getAllByRoleInContainer, pointerMap, renderv3 as render_, waitFor, within} from '@react-spectrum/test-utils-internal'; import {Button} from '@react-spectrum/button'; import {CalendarDate, CalendarDateTime, getLocalTimeZone, toCalendarDateTime, today} from '@internationalized/date'; import {DateRangePicker} from '../'; @@ -626,9 +626,9 @@ describe('DateRangePicker', function () { } else { let localTime = today(getLocalTimeZone()); expect(onChange).toHaveBeenCalledTimes(1); - + expectPlaceholder(startDate, `${localTime.month}/1/${localTime.year}, 12:00 AM`); - + expectPlaceholder(endDate, `${localTime.month}/2/${localTime.year}, 12:00 AM`); } diff --git a/packages/@react-spectrum/datepicker/test/TimeField.test.js b/packages/@react-spectrum/datepicker/test/TimeField.test.js index b1b0570bf1d..9c72fc31c9b 100644 --- a/packages/@react-spectrum/datepicker/test/TimeField.test.js +++ b/packages/@react-spectrum/datepicker/test/TimeField.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, pointerMap, render as render_, within} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, pointerMap, renderv3 as render_, within} from '@react-spectrum/test-utils-internal'; import {Button} from '@react-spectrum/button'; import {Form} from '@react-spectrum/form'; import {parseZonedDateTime, Time} from '@internationalized/date'; diff --git a/packages/@react-spectrum/dialog/test/AlertDialog.test.js b/packages/@react-spectrum/dialog/test/AlertDialog.test.js index 04033c7eafa..6f22c1de11a 100644 --- a/packages/@react-spectrum/dialog/test/AlertDialog.test.js +++ b/packages/@react-spectrum/dialog/test/AlertDialog.test.js @@ -11,7 +11,7 @@ */ import {AlertDialog} from '../'; -import {pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import {Provider} from '@react-spectrum/provider'; import React from 'react'; import {theme} from '@react-spectrum/theme-default'; diff --git a/packages/@react-spectrum/dialog/test/Dialog.test.js b/packages/@react-spectrum/dialog/test/Dialog.test.js index f225f1fb16b..ecf99c8f882 100644 --- a/packages/@react-spectrum/dialog/test/Dialog.test.js +++ b/packages/@react-spectrum/dialog/test/Dialog.test.js @@ -16,7 +16,7 @@ import {Header} from '@react-spectrum/view'; import {Heading} from '@react-spectrum/text'; import {ModalProvider} from '@react-aria/overlays'; import React from 'react'; -import {render} from '@react-spectrum/test-utils-internal'; +import {renderv3 as render} from '@react-spectrum/test-utils-internal'; describe('Dialog', function () { it('does not auto focus anything inside', function () { diff --git a/packages/@react-spectrum/dialog/test/DialogContainer.test.js b/packages/@react-spectrum/dialog/test/DialogContainer.test.js index 972055d8105..9eb5169a79d 100644 --- a/packages/@react-spectrum/dialog/test/DialogContainer.test.js +++ b/packages/@react-spectrum/dialog/test/DialogContainer.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, pointerMap, render, within} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, pointerMap, renderv3 as render, within} from '@react-spectrum/test-utils-internal'; import {ActionButton, Button} from '@react-spectrum/button'; import {ButtonGroup} from '@react-spectrum/buttongroup'; import {Content, Header} from '@react-spectrum/view'; diff --git a/packages/@react-spectrum/divider/test/Divider.test.js b/packages/@react-spectrum/divider/test/Divider.test.js index 6aa099312a9..0adc466a89c 100644 --- a/packages/@react-spectrum/divider/test/Divider.test.js +++ b/packages/@react-spectrum/divider/test/Divider.test.js @@ -12,7 +12,7 @@ import {Divider} from '../'; import React from 'react'; -import {render} from '@react-spectrum/test-utils-internal'; +import {renderv3 as render} from '@react-spectrum/test-utils-internal'; describe('Divider', function () { it.each` diff --git a/packages/@react-spectrum/dropzone/test/DropZone.test.js b/packages/@react-spectrum/dropzone/test/DropZone.test.js index b4343e0dc6c..7ba8fe94a1f 100644 --- a/packages/@react-spectrum/dropzone/test/DropZone.test.js +++ b/packages/@react-spectrum/dropzone/test/DropZone.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, render} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, renderv3 as render} from '@react-spectrum/test-utils-internal'; import {Button} from '@react-spectrum/button'; import {Content} from '@react-spectrum/view'; import {DataTransfer, DataTransferItem, DragEvent} from '@react-aria/dnd/test/mocks'; @@ -41,7 +41,7 @@ describe('DropZone', () => { let dropzone = tree.getByTestId('bar'); let button = tree.getByTestId('foo'); - expect(dropzone).toBe(tree.container.firstChild); + expect(dropzone).toBe(tree.container.firstChild.firstChild); expect(dropzoneRef.current.UNSAFE_getDOMNode()).toBe(dropzone); expect(dropzone).not.toBe(button); }); diff --git a/packages/@react-spectrum/form/test/Form.test.js b/packages/@react-spectrum/form/test/Form.test.js index 15ba29be69d..b0baa9d2134 100644 --- a/packages/@react-spectrum/form/test/Form.test.js +++ b/packages/@react-spectrum/form/test/Form.test.js @@ -16,7 +16,7 @@ import {Content, Header} from '@react-spectrum/view'; import {ContextualHelp} from '@react-spectrum/contextualhelp'; import {Form} from '../'; import {Item, Picker} from '@react-spectrum/picker'; -import {pointerMap, render, simulateMobile} from '@react-spectrum/test-utils-internal'; +import {pointerMap, renderv3 as render, simulateMobile} from '@react-spectrum/test-utils-internal'; import {Provider} from '@react-spectrum/provider'; import React from 'react'; import {TextField} from '@react-spectrum/textfield'; diff --git a/packages/@react-spectrum/icon/src/Icon.tsx b/packages/@react-spectrum/icon/src/Icon.tsx index 174767bf2dd..88474217bfc 100644 --- a/packages/@react-spectrum/icon/src/Icon.tsx +++ b/packages/@react-spectrum/icon/src/Icon.tsx @@ -13,9 +13,9 @@ import {AriaLabelingProps, DOMProps, IconColorValue, StyleProps} from '@react-types/shared'; import {baseStyleProps, classNames, StyleHandlers, useSlotProps, useStyleProps} from '@react-spectrum/utils'; import {filterDOMProps} from '@react-aria/utils'; -import {ProviderContext, useProvider} from '@react-spectrum/provider'; import React, {ReactElement} from 'react'; import styles from '@adobe/spectrum-css-temp/components/icon/vars.css'; +import {useProvider} from '@react-spectrum/provider'; export interface IconProps extends DOMProps, AriaLabelingProps, StyleProps { /** @@ -70,15 +70,9 @@ export function Icon(props: IconProps) { } = props; let {styleProps} = useStyleProps(otherProps, iconStyleProps); - let provider: undefined | ProviderContext; - try { - // eslint-disable-next-line react-hooks/rules-of-hooks - provider = useProvider(); - } catch { - // ignore - } + let provider = useProvider(); let scale = 'M'; - if (provider != null) { + if (provider !== null) { scale = provider.scale === 'large' ? 'L' : 'M'; } if (!ariaHidden) { diff --git a/packages/@react-spectrum/icon/src/UIIcon.tsx b/packages/@react-spectrum/icon/src/UIIcon.tsx index ef5718e2768..e6d0b59487d 100644 --- a/packages/@react-spectrum/icon/src/UIIcon.tsx +++ b/packages/@react-spectrum/icon/src/UIIcon.tsx @@ -13,9 +13,9 @@ import {AriaLabelingProps, DOMProps, StyleProps} from '@react-types/shared'; import {classNames, useSlotProps, useStyleProps} from '@react-spectrum/utils'; import {filterDOMProps} from '@react-aria/utils'; -import {ProviderContext, useProvider} from '@react-spectrum/provider'; import React, {ReactElement} from 'react'; import styles from '@adobe/spectrum-css-temp/components/icon/vars.css'; +import {useProvider} from '@react-spectrum/provider'; export interface UIIconProps extends DOMProps, AriaLabelingProps, StyleProps { children: ReactElement, @@ -38,15 +38,9 @@ export function UIIcon(props: UIIconProps) { } = props; let {styleProps} = useStyleProps(otherProps); - let provider: undefined | ProviderContext; - try { - // eslint-disable-next-line react-hooks/rules-of-hooks - provider = useProvider(); - } catch { - // ignore - } + let provider = useProvider(); let scale = 'M'; - if (provider != null) { + if (provider !== null) { scale = provider.scale === 'large' ? 'L' : 'M'; } diff --git a/packages/@react-spectrum/icon/test/Icon.test.js b/packages/@react-spectrum/icon/test/Icon.test.js index 93f6d5d1f58..0890d8d480e 100644 --- a/packages/@react-spectrum/icon/test/Icon.test.js +++ b/packages/@react-spectrum/icon/test/Icon.test.js @@ -12,7 +12,7 @@ import {Icon} from '../'; import React from 'react'; -import {render} from '@react-spectrum/test-utils-internal'; +import {renderv3 as render} from '@react-spectrum/test-utils-internal'; let FakeIcon = (props) => ; diff --git a/packages/@react-spectrum/icon/test/Illustration.test.js b/packages/@react-spectrum/icon/test/Illustration.test.js index 85ec1115203..175cd35b0d5 100644 --- a/packages/@react-spectrum/icon/test/Illustration.test.js +++ b/packages/@react-spectrum/icon/test/Illustration.test.js @@ -12,7 +12,7 @@ import {Illustration} from '../'; import React from 'react'; -import {render} from '@react-spectrum/test-utils-internal'; +import {renderv3 as render} from '@react-spectrum/test-utils-internal'; let CustomIllustration = (props) => ; diff --git a/packages/@react-spectrum/icon/test/UIIcon.test.js b/packages/@react-spectrum/icon/test/UIIcon.test.js index c093640f8ce..bc0a6a2a980 100644 --- a/packages/@react-spectrum/icon/test/UIIcon.test.js +++ b/packages/@react-spectrum/icon/test/UIIcon.test.js @@ -11,7 +11,7 @@ */ import React from 'react'; -import {render} from '@react-spectrum/test-utils-internal'; +import {renderv3 as render} from '@react-spectrum/test-utils-internal'; import {UIIcon} from '../'; let FakeIcon = (props) => ; diff --git a/packages/@react-spectrum/illustratedmessage/test/IllustratedMessage.test.js b/packages/@react-spectrum/illustratedmessage/test/IllustratedMessage.test.js index 2794d0aa3f0..f7fb6119def 100644 --- a/packages/@react-spectrum/illustratedmessage/test/IllustratedMessage.test.js +++ b/packages/@react-spectrum/illustratedmessage/test/IllustratedMessage.test.js @@ -14,7 +14,7 @@ import {Content} from '@react-spectrum/view'; import {Heading} from '@react-spectrum/text'; import {IllustratedMessage} from '../'; import React from 'react'; -import {render} from '@react-spectrum/test-utils-internal'; +import {renderv3 as render} from '@react-spectrum/test-utils-internal'; let dataTestId = 'IMsvg1'; diff --git a/packages/@react-spectrum/image/test/Image.test.js b/packages/@react-spectrum/image/test/Image.test.js index 5eaecc14697..bddfe321526 100644 --- a/packages/@react-spectrum/image/test/Image.test.js +++ b/packages/@react-spectrum/image/test/Image.test.js @@ -9,7 +9,7 @@ * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ -import {fireEvent, render, screen} from '@react-spectrum/test-utils-internal'; +import {fireEvent, renderv3 as render, screen} from '@react-spectrum/test-utils-internal'; import {Image} from '../src'; import React from 'react'; diff --git a/packages/@react-spectrum/inlinealert/test/InlineAlert.test.js b/packages/@react-spectrum/inlinealert/test/InlineAlert.test.js index 0bfdff04dab..de3bbb1f0e9 100644 --- a/packages/@react-spectrum/inlinealert/test/InlineAlert.test.js +++ b/packages/@react-spectrum/inlinealert/test/InlineAlert.test.js @@ -13,7 +13,7 @@ import {Content, Header} from '@react-spectrum/view'; import {InlineAlert} from '../'; import React from 'react'; -import {render} from '@react-spectrum/test-utils-internal'; +import {renderv3 as render} from '@react-spectrum/test-utils-internal'; describe('InlineAlert', function () { it('has alert role', function () { diff --git a/packages/@react-spectrum/label/test/Field.test.js b/packages/@react-spectrum/label/test/Field.test.js index b5d5a7ebef0..b8790cbe77d 100644 --- a/packages/@react-spectrum/label/test/Field.test.js +++ b/packages/@react-spectrum/label/test/Field.test.js @@ -12,7 +12,7 @@ import {Content, ContextualHelp, Heading} from '@adobe/react-spectrum'; import {Field} from '../'; -import {pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import React from 'react'; import {useField} from '@react-aria/label'; import userEvent from '@testing-library/user-event'; diff --git a/packages/@react-spectrum/labeledvalue/test/LabeledValue.test.js b/packages/@react-spectrum/labeledvalue/test/LabeledValue.test.js index d12c9a7d7e9..132ea95dc66 100644 --- a/packages/@react-spectrum/labeledvalue/test/LabeledValue.test.js +++ b/packages/@react-spectrum/labeledvalue/test/LabeledValue.test.js @@ -13,7 +13,7 @@ import {CalendarDate, CalendarDateTime, Time, ZonedDateTime} from '@internationalized/date'; import {LabeledValue} from '../src'; import React from 'react'; -import {render, within} from '@react-spectrum/test-utils-internal'; +import {renderv3 as render, within} from '@react-spectrum/test-utils-internal'; describe('LabeledValue', function () { it('renders a label', function () { diff --git a/packages/@react-spectrum/link/test/Link.test.js b/packages/@react-spectrum/link/test/Link.test.js index 5f78f84e123..ad50e03af3a 100644 --- a/packages/@react-spectrum/link/test/Link.test.js +++ b/packages/@react-spectrum/link/test/Link.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {act, pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import {Link} from '../'; import {Provider} from '@react-spectrum/provider'; import React from 'react'; diff --git a/packages/@react-spectrum/listbox/test/ListBox.test.js b/packages/@react-spectrum/listbox/test/ListBox.test.js index 2a7c07ca6bb..0672f23c859 100644 --- a/packages/@react-spectrum/listbox/test/ListBox.test.js +++ b/packages/@react-spectrum/listbox/test/ListBox.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, mockClickDefault, pointerMap, render, within} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, mockClickDefault, pointerMap, renderv3 as render, within} from '@react-spectrum/test-utils-internal'; import Bell from '@spectrum-icons/workflow/Bell'; import {FocusExample} from '../stories/ListBox.stories'; import {Item, ListBox, Section} from '../'; diff --git a/packages/@react-spectrum/menu/test/ActionMenu.test.js b/packages/@react-spectrum/menu/test/ActionMenu.test.js index 9a955392f1e..8056bcce480 100644 --- a/packages/@react-spectrum/menu/test/ActionMenu.test.js +++ b/packages/@react-spectrum/menu/test/ActionMenu.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, pointerMap, render, within} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, pointerMap, renderv3 as render, within} from '@react-spectrum/test-utils-internal'; import {ActionMenu, Item} from '../'; import {Provider} from '@react-spectrum/provider'; import React from 'react'; diff --git a/packages/@react-spectrum/menu/test/Menu.test.js b/packages/@react-spectrum/menu/test/Menu.test.js index ec10ed3d328..6c623c7b532 100644 --- a/packages/@react-spectrum/menu/test/Menu.test.js +++ b/packages/@react-spectrum/menu/test/Menu.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, mockClickDefault, pointerMap, render, within} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, mockClickDefault, pointerMap, renderv3 as render, within} from '@react-spectrum/test-utils-internal'; import Bell from '@spectrum-icons/workflow/Bell'; import {Dialog, DialogTrigger} from '@react-spectrum/dialog'; import {Item, Menu, Section} from '../'; diff --git a/packages/@react-spectrum/meter/test/Meter.test.js b/packages/@react-spectrum/meter/test/Meter.test.js index fb27c246cf0..0688de44447 100644 --- a/packages/@react-spectrum/meter/test/Meter.test.js +++ b/packages/@react-spectrum/meter/test/Meter.test.js @@ -12,7 +12,7 @@ import {Meter} from '../'; import React from 'react'; -import {render} from '@react-spectrum/test-utils-internal'; +import {renderv3 as render} from '@react-spectrum/test-utils-internal'; describe('Meter', function () { it('handles defaults', function () { diff --git a/packages/@react-spectrum/numberfield/test/NumberField.test.js b/packages/@react-spectrum/numberfield/test/NumberField.test.js index b9ff89c22cf..6d8bfc5fdf3 100644 --- a/packages/@react-spectrum/numberfield/test/NumberField.test.js +++ b/packages/@react-spectrum/numberfield/test/NumberField.test.js @@ -11,10 +11,11 @@ */ jest.mock('@react-aria/live-announcer'); -import {act, fireEvent, pointerMap, render, within} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, pointerMap, renderv3 as render, within} from '@react-spectrum/test-utils-internal'; import {announce} from '@react-aria/live-announcer'; import {Button} from '@react-spectrum/button'; import {chain} from '@react-aria/utils'; +import {defaultTheme} from '@adobe/react-spectrum'; import {Form} from '@react-spectrum/form'; import messages from '../../../@react-aria/numberfield/intl/*.json'; import {NumberField} from '../'; @@ -54,7 +55,7 @@ describe('NumberField', function () { function renderNumberField(props = {}, providerProps = {}) { let {locale = 'en-US', scale = 'medium'} = providerProps; - let {container, debug, rerender} = render(); + let {container, debug} = render(, undefined, {theme, scale, locale}); let root = props.label ? container.firstChild.firstChild : undefined; container = within(container).queryByRole('group'); @@ -69,8 +70,7 @@ describe('NumberField', function () { buttons, incrementButton, decrementButton, - debug, - rerender: (props = {}, locale) => rerender() + debug }; } @@ -867,10 +867,11 @@ describe('NumberField', function () { Name ${'NumberField'} `('$Name properly formats value when formatter changes', () => { - let {textField, rerender} = renderNumberField({defaultValue: 10, formatOptions: {style: 'currency', currency: 'EUR'}}); + let {container, rerender} = render(); + let textField = within(container).queryByRole('textbox'); expect(textField).toHaveAttribute('value', '€10.00'); - rerender({defaultValue: 10, formatOptions: {style: 'currency', currency: 'USD'}}); + rerender(); expect(textField).toHaveAttribute('value', '$10.00'); }); @@ -1772,9 +1773,7 @@ describe('NumberField', function () { let {onChange} = props; let [value, setValue] = useState(10); return ( - - - + ); } let {container, getByRole} = render(); @@ -2261,7 +2260,7 @@ describe('NumberField', function () { ); } let resetSpy = jest.fn(); - let {getByText, getByRole} = render(); + let {getByText, getByRole} = render(, undefined, {theme, scale: 'medium', locale: 'en-US'}); let textField = getByRole('textbox'); let resetButton = getByText('Reset'); @@ -2272,13 +2271,15 @@ describe('NumberField', function () { }); it('supports form value', () => { - let {textField, rerender} = renderNumberField({name: 'age', value: 30}); + let {container, rerender} = render(); + container = within(container).queryByRole('group'); + let textField = within(container).queryByRole('textbox'); expect(textField).not.toHaveAttribute('name'); let hiddenInput = document.querySelector('input[type=hidden]'); expect(hiddenInput).toHaveAttribute('name', 'age'); expect(hiddenInput).toHaveValue('30'); - rerender({name: 'age', value: null}); + rerender(); expect(hiddenInput).toHaveValue(''); }); diff --git a/packages/@react-spectrum/overlays/test/Modal.test.js b/packages/@react-spectrum/overlays/test/Modal.test.js index fabd82907b6..e960853066e 100644 --- a/packages/@react-spectrum/overlays/test/Modal.test.js +++ b/packages/@react-spectrum/overlays/test/Modal.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {fireEvent, render, waitFor} from '@react-spectrum/test-utils-internal'; +import {fireEvent, renderv3 as render, waitFor} from '@react-spectrum/test-utils-internal'; import {Modal} from '../'; import {Provider} from '@react-spectrum/provider'; import React from 'react'; diff --git a/packages/@react-spectrum/overlays/test/Overlay.test.js b/packages/@react-spectrum/overlays/test/Overlay.test.js index a7d1f77479c..86d138937a9 100644 --- a/packages/@react-spectrum/overlays/test/Overlay.test.js +++ b/packages/@react-spectrum/overlays/test/Overlay.test.js @@ -13,7 +13,7 @@ import {Overlay} from '../'; import {Provider} from '@react-spectrum/provider'; import React from 'react'; -import {render} from '@react-spectrum/test-utils-internal'; +import {renderv3 as render} from '@react-spectrum/test-utils-internal'; import {theme} from '@react-spectrum/theme-default'; function _ExampleOverlay(props, ref) { diff --git a/packages/@react-spectrum/overlays/test/Popover.test.js b/packages/@react-spectrum/overlays/test/Popover.test.js index 595635f8c0a..c7c0f5bec44 100644 --- a/packages/@react-spectrum/overlays/test/Popover.test.js +++ b/packages/@react-spectrum/overlays/test/Popover.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, pointerMap, render, waitFor} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, pointerMap, renderv3 as render, waitFor} from '@react-spectrum/test-utils-internal'; import {Dialog} from '@react-spectrum/dialog'; import {Popover} from '../'; import {Provider} from '@react-spectrum/provider'; diff --git a/packages/@react-spectrum/overlays/test/Tray.test.js b/packages/@react-spectrum/overlays/test/Tray.test.js index 8ebccb2a347..f339bf053e9 100644 --- a/packages/@react-spectrum/overlays/test/Tray.test.js +++ b/packages/@react-spectrum/overlays/test/Tray.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, render, waitFor} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, renderv3 as render, waitFor} from '@react-spectrum/test-utils-internal'; import {Dialog} from '@react-spectrum/dialog'; import {Provider} from '@react-spectrum/provider'; import React from 'react'; diff --git a/packages/@react-spectrum/picker/test/Picker.test.js b/packages/@react-spectrum/picker/test/Picker.test.js index 24877ec2c0f..dda71105e7e 100644 --- a/packages/@react-spectrum/picker/test/Picker.test.js +++ b/packages/@react-spectrum/picker/test/Picker.test.js @@ -11,7 +11,7 @@ */ jest.mock('@react-aria/utils/src/scrollIntoView'); -import {act, fireEvent, mockClickDefault, pointerMap, render, simulateDesktop, within} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, mockClickDefault, pointerMap, renderv3 as render, simulateDesktop, within} from '@react-spectrum/test-utils-internal'; import AlignCenter from '@spectrum-icons/workflow/AlignCenter'; import AlignLeft from '@spectrum-icons/workflow/AlignLeft'; import AlignRight from '@spectrum-icons/workflow/AlignRight'; diff --git a/packages/@react-spectrum/picker/test/TempUtilTest.test.js b/packages/@react-spectrum/picker/test/TempUtilTest.test.js index 237409e0a8c..1128e0819cd 100644 --- a/packages/@react-spectrum/picker/test/TempUtilTest.test.js +++ b/packages/@react-spectrum/picker/test/TempUtilTest.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, pointerMap, render, screen, simulateDesktop, simulateMobile, waitFor, waitForElementToBeRemoved, within} from '@react-spectrum/test-utils-internal'; +import {act, pointerMap, renderv3 as render, screen, simulateDesktop, simulateMobile, waitFor, waitForElementToBeRemoved, within} from '@react-spectrum/test-utils-internal'; import {Button, Label, ListBox, ListBoxItem, Popover, Select, SelectValue, Text} from 'react-aria-components'; import {Item, Picker} from '../src'; import {Provider} from '@react-spectrum/provider'; diff --git a/packages/@react-spectrum/progress/test/ProgressBar.test.js b/packages/@react-spectrum/progress/test/ProgressBar.test.js index c99f5045e57..ba5205ff1cc 100644 --- a/packages/@react-spectrum/progress/test/ProgressBar.test.js +++ b/packages/@react-spectrum/progress/test/ProgressBar.test.js @@ -12,7 +12,7 @@ import {ProgressBar} from '../'; import React from 'react'; -import {render} from '@react-spectrum/test-utils-internal'; +import {renderv3 as render} from '@react-spectrum/test-utils-internal'; describe('ProgressBar', function () { diff --git a/packages/@react-spectrum/progress/test/ProgressCircle.test.js b/packages/@react-spectrum/progress/test/ProgressCircle.test.js index 2b982bca893..e967b3561c9 100644 --- a/packages/@react-spectrum/progress/test/ProgressCircle.test.js +++ b/packages/@react-spectrum/progress/test/ProgressCircle.test.js @@ -12,7 +12,7 @@ import {ProgressCircle} from '../'; import React from 'react'; -import {render} from '@react-spectrum/test-utils-internal'; +import {renderv3 as render} from '@react-spectrum/test-utils-internal'; describe('ProgressCircle', function () { diff --git a/packages/@react-spectrum/provider/test/Provider.test.tsx b/packages/@react-spectrum/provider/test/Provider.test.tsx index ca5fee8ef3f..adb2d95be99 100644 --- a/packages/@react-spectrum/provider/test/Provider.test.tsx +++ b/packages/@react-spectrum/provider/test/Provider.test.tsx @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import {ActionButton, Button} from '@react-spectrum/button'; import {Checkbox} from '@react-spectrum/checkbox'; import MatchMediaMock from 'jest-matchmedia-mock'; diff --git a/packages/@react-spectrum/radio/test/Radio.test.js b/packages/@react-spectrum/radio/test/Radio.test.js index 29cf6dd5aec..195216f597a 100644 --- a/packages/@react-spectrum/radio/test/Radio.test.js +++ b/packages/@react-spectrum/radio/test/Radio.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {act, pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import {Button} from '@react-spectrum/button'; import {Form} from '@react-spectrum/form'; import {Provider} from '@react-spectrum/provider'; @@ -602,14 +602,12 @@ describe('Radios', function () { ${'(up/down arrows, rtl + vertical) RadioGroup'} | ${{locale: 'ar-AE'}} | ${[{action: tab, result: () => expectedFocus.radio1Focused}, {action: pressArrowDown, result: radioBehavior.forward}, {action: pressArrowUp, result: radioBehavior.backward}, {action: pressArrowUp, result: radioBehavior.backward}]} `('$Name default keyboard navigation with wrapping', async ({props, orders}) => { let {getAllByRole} = render( - - - Dogs - Cats - Dragons - - - ); + + Dogs + Cats + Dragons + + , undefined, {locale: props.locale}); let radios = getAllByRole('radio'); @@ -634,14 +632,12 @@ describe('Radios', function () { ${'rtl 1&2 disabled'} | ${{locale: 'ar-AE'}} | ${[0, 1]} | ${[{action: tab, result: () => [und, und, '0']}, {action: pressArrowRight, result: () => [und, und, '0']}, {action: pressArrowRight, result: () => [und, und, '0']}, {action: pressArrowLeft, result: () => [und, und, '0']}, {action: pressArrowLeft, result: () => [und, und, '0']}]} `('$Name skips disabled radios', async function ({Name, props, disabledKeys, orders}) { let tree = render( - - - Dogs - Cats - Dragons - - - ); + + Dogs + Cats + Dragons + + , undefined, {locale: props.locale}); let radios = tree.getAllByRole('radio'); @@ -659,15 +655,13 @@ describe('Radios', function () { ${'rtl middle two disabled'} | ${{locale: 'de-DE'}} | ${[1, 2]} | ${[{action: tab, result: () => ['0', und, und, '-1']}, {action: pressArrowRight, result: () => ['-1', und, und, '0']}, {action: pressArrowRight, result: () => ['0', und, und, '-1']}, {action: pressArrowLeft, result: () => ['-1', und, und, '0']}, {action: pressArrowLeft, result: () => ['0', und, und, '-1']}]} `('$Name skips multiple disabled radios', async function ({Name, props, disabledKeys, orders}) { let tree = render( - - - Dogs - Cats - Dragons - Unicorns - - - ); + + Dogs + Cats + Dragons + Unicorns + + , undefined, {locale: props.locale}); let radios = tree.getAllByRole('radio'); diff --git a/packages/@react-spectrum/searchfield/test/SearchField.test.js b/packages/@react-spectrum/searchfield/test/SearchField.test.js index 9314b27bd4e..351c061387e 100644 --- a/packages/@react-spectrum/searchfield/test/SearchField.test.js +++ b/packages/@react-spectrum/searchfield/test/SearchField.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, pointerMap, render, within} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, pointerMap, renderv3 as render, within} from '@react-spectrum/test-utils-internal'; import Checkmark from '@spectrum-icons/workflow/Checkmark'; import React from 'react'; import {SearchField} from '../'; diff --git a/packages/@react-spectrum/searchwithin/test/SearchWithin.test.js b/packages/@react-spectrum/searchwithin/test/SearchWithin.test.js index f6d1516fdab..e2c071c86d0 100644 --- a/packages/@react-spectrum/searchwithin/test/SearchWithin.test.js +++ b/packages/@react-spectrum/searchwithin/test/SearchWithin.test.js @@ -9,7 +9,7 @@ * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ -import {act, pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {act, pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import Filter from '@spectrum-icons/workflow/Filter'; import {Item, Picker} from '@react-spectrum/picker'; import {Provider} from '@react-spectrum/provider'; diff --git a/packages/@react-spectrum/slider/test/RangeSlider.test.tsx b/packages/@react-spectrum/slider/test/RangeSlider.test.tsx index 95c7096ba0a..118fc1b9e9f 100644 --- a/packages/@react-spectrum/slider/test/RangeSlider.test.tsx +++ b/packages/@react-spectrum/slider/test/RangeSlider.test.tsx @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {fireEvent, pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {fireEvent, pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import {press, testKeypresses} from './utils'; import {Provider} from '@adobe/react-spectrum'; import {RangeSlider} from '../'; @@ -288,10 +288,8 @@ describe('RangeSlider', function () { ${'(left/right arrows, isDisabled)'} | ${{locale: 'de-DE', isDisabled: true}}| ${[{left: press.ArrowRight, result: 0}, {left: press.ArrowLeft, result: 0}, {right: press.ArrowRight, result: 0}, {right: press.ArrowLeft, result: 0}]} `('$Name moves the slider in the correct direction', function ({props, commands}) { let tree = render( - - - - ); + + , undefined, props); let sliders = tree.getAllByRole('slider') as [HTMLInputElement, HTMLInputElement]; testKeypresses(sliders, commands); }); @@ -302,10 +300,8 @@ describe('RangeSlider', function () { ${'(left/right arrows, rtl)'} | ${{locale: 'ar-AE'}} | ${[{left: press.ArrowRight, result: -10}, {left: press.ArrowLeft, result: +10}, {right: press.ArrowRight, result: -10}, {right: press.ArrowLeft, result: +10}]} `('$Name respects the step size', function ({props, commands}) { let tree = render( - - - - ); + + , undefined, props); let sliders = tree.getAllByRole('slider') as [HTMLInputElement, HTMLInputElement]; testKeypresses(sliders, commands); }); @@ -316,10 +312,8 @@ describe('RangeSlider', function () { ${'(left/right arrows, rtl)'} | ${{locale: 'ar-AE'}} | ${[{left: press.ArrowRight, result: -1}, {left: press.ArrowRight, result: 0}, {right: press.ArrowLeft, result: +1}, {right: press.ArrowLeft, result: 0}]} `('$Name is clamped by min/max', function ({props, commands}) { let tree = render( - - - - ); + + , undefined, props); let sliders = tree.getAllByRole('slider') as [HTMLInputElement, HTMLInputElement]; testKeypresses(sliders, commands); }); diff --git a/packages/@react-spectrum/slider/test/Slider.test.tsx b/packages/@react-spectrum/slider/test/Slider.test.tsx index c5bcba26e04..2615c9bd5a1 100644 --- a/packages/@react-spectrum/slider/test/Slider.test.tsx +++ b/packages/@react-spectrum/slider/test/Slider.test.tsx @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, installMouseEvent, pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, installMouseEvent, pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import {press, testKeypresses} from './utils'; import {Provider} from '@adobe/react-spectrum'; import React, {useCallback, useState} from 'react'; @@ -280,10 +280,8 @@ describe('Slider', function () { ${'(home/end, rtl)'} | ${{locale: 'ar-AE'}} | ${[{left: press.Home, result: -50}, {left: press.End, result: +100}]} `('$Name moves the slider in the correct direction', function ({props, commands}) { let tree = render( - - - - ); + + , undefined, props); let slider = tree.getByRole('slider'); testKeypresses([slider, slider], commands); }); @@ -301,10 +299,8 @@ describe('Slider', function () { ${'(home/end, rtl)'} | ${{locale: 'ar-AE'}} | ${[{left: press.Home, result: -50}, {left: press.End, result: +100}]} `('$Name moves the slider in the correct direction orientation vertical', function ({props, commands}) { let tree = render( - - - - ); + + , undefined, props); let slider = tree.getByRole('slider'); testKeypresses([slider, slider], commands); }); @@ -317,10 +313,8 @@ describe('Slider', function () { ${'(page up/down, rtl)'} | ${{locale: 'ar-AE'}} | ${[{left: press.PageUp, result: +20}, {left: press.PageDown, result: -20}]} `('$Name respects the step size', function ({props, commands}) { let tree = render( - - - - ); + + , undefined, props); let slider = tree.getByRole('slider'); testKeypresses([slider, slider], commands); }); @@ -333,10 +327,8 @@ describe('Slider', function () { ${'(page up/down, rtl)'} | ${{locale: 'ar-AE'}} | ${[{left: press.PageUp, result: +20}, {left: press.PageDown, result: -20}]} `('$Name sets page size to a multiple of step', function ({props, commands}) { let tree = render( - - - - ); + + , undefined, props); // The slider page size should be initially calulated as 230/10 = 23 and then snapped to 20 so it is a multiple of the step let slider = tree.getByRole('slider'); testKeypresses([slider, slider], commands); @@ -350,10 +342,8 @@ describe('Slider', function () { ${'(page up/down, rtl)'} | ${{locale: 'ar-AE'}} | ${[{left: press.PageUp, result: +2}, {left: press.PageDown, result: -2}]} `('$Name sets page size to a multiple of step (scenario: step is less than min)', function ({props, commands}) { let tree = render( - - - - ); + + , undefined, props); // The slider page size should be initially calulated as 25/10 = 2.5, snaps to 2 let slider = tree.getByRole('slider'); testKeypresses([slider, slider], commands); @@ -367,10 +357,8 @@ describe('Slider', function () { ${'(page up/down, rtl)'} | ${{locale: 'ar-AE'}} | ${[{left: press.PageUp, result: +4}, {left: press.PageDown, result: -4}]} `('$Name sets page size to a multiple of step (scenario: step is greater than max)', function ({props, commands}) { let tree = render( - - - - ); + + , undefined, props); // The slider page size should be initially calulated as 35/10 = 3.5, snaps to 4 let slider = tree.getByRole('slider'); testKeypresses([slider, slider], commands); @@ -385,7 +373,7 @@ describe('Slider', function () { - ); + , undefined, props); let slider = tree.getByRole('slider'); testKeypresses([slider, slider], commands); }); diff --git a/packages/@react-spectrum/statuslight/test/StatusLight.test.js b/packages/@react-spectrum/statuslight/test/StatusLight.test.js index 27158afe158..505096b9181 100644 --- a/packages/@react-spectrum/statuslight/test/StatusLight.test.js +++ b/packages/@react-spectrum/statuslight/test/StatusLight.test.js @@ -11,7 +11,7 @@ */ import React from 'react'; -import {render} from '@react-spectrum/test-utils-internal'; +import {renderv3 as render} from '@react-spectrum/test-utils-internal'; import {StatusLight} from '../'; diff --git a/packages/@react-spectrum/steplist/test/StepList.test.tsx b/packages/@react-spectrum/steplist/test/StepList.test.tsx index 29ec602ee77..d65a7057fe7 100644 --- a/packages/@react-spectrum/steplist/test/StepList.test.tsx +++ b/packages/@react-spectrum/steplist/test/StepList.test.tsx @@ -13,7 +13,7 @@ import {act} from '@testing-library/react'; import {DOMRefValue} from '@react-types/shared'; import {Item} from '@react-stately/collections'; -import {pointerMap, render, within} from '@react-spectrum/test-utils-internal'; +import {pointerMap, renderv3 as render, within} from '@react-spectrum/test-utils-internal'; import {Provider} from '@react-spectrum/provider'; import React from 'react'; import {StepList} from '../'; diff --git a/packages/@react-spectrum/switch/test/Switch.test.js b/packages/@react-spectrum/switch/test/Switch.test.js index ba5b0c05cd8..3efecbdfd65 100644 --- a/packages/@react-spectrum/switch/test/Switch.test.js +++ b/packages/@react-spectrum/switch/test/Switch.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import React from 'react'; import {Switch} from '../'; import userEvent from '@testing-library/user-event'; diff --git a/packages/@react-spectrum/table/test/TestTableUtils.test.js b/packages/@react-spectrum/table/test/TestTableUtils.test.js index 287f02c8d2c..3d2c50731de 100644 --- a/packages/@react-spectrum/table/test/TestTableUtils.test.js +++ b/packages/@react-spectrum/table/test/TestTableUtils.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, render, screen} from '@react-spectrum/test-utils-internal'; +import {act, renderv3 as render, screen} from '@react-spectrum/test-utils-internal'; import {Cell, Column, Row, TableBody, TableHeader, TableView} from '../'; import {Provider} from '@react-spectrum/provider'; import React, {useState} from 'react'; diff --git a/packages/@react-spectrum/tabs/test/Tabs.test.js b/packages/@react-spectrum/tabs/test/Tabs.test.js index 7a411b22046..0e17dfaa3e5 100644 --- a/packages/@react-spectrum/tabs/test/Tabs.test.js +++ b/packages/@react-spectrum/tabs/test/Tabs.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, createEvent, fireEvent, mockImplementation, pointerMap, render, waitFor, within} from '@react-spectrum/test-utils-internal'; +import {act, createEvent, fireEvent, mockImplementation, pointerMap, renderv3 as render, waitFor, within} from '@react-spectrum/test-utils-internal'; import {Item, TabList, TabPanels, Tabs} from '../src'; import {Links as LinksExample} from '../stories/Tabs.stories'; import {Provider} from '@react-spectrum/provider'; diff --git a/packages/@react-spectrum/textfield/test/TextArea.test.js b/packages/@react-spectrum/textfield/test/TextArea.test.js index 3c783e7b712..c7acc824848 100644 --- a/packages/@react-spectrum/textfield/test/TextArea.test.js +++ b/packages/@react-spectrum/textfield/test/TextArea.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import React from 'react'; import {TextArea} from '../'; import userEvent from '@testing-library/user-event'; diff --git a/packages/@react-spectrum/textfield/test/TextField.test.js b/packages/@react-spectrum/textfield/test/TextField.test.js index e5cdead0993..2f4fcd5a31b 100644 --- a/packages/@react-spectrum/textfield/test/TextField.test.js +++ b/packages/@react-spectrum/textfield/test/TextField.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, pointerMap, render, waitFor} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, pointerMap, renderv3 as render, waitFor} from '@react-spectrum/test-utils-internal'; import {Button} from '@react-spectrum/button'; import Checkmark from '@spectrum-icons/workflow/Checkmark'; import {Form} from '@react-spectrum/form'; @@ -53,7 +53,7 @@ describe('Shared TextField behavior', () => { ${'v3 SearchField'} | ${SearchField} | ${{UNSAFE_className: 'custom-class-name', 'aria-label': 'mandatory label'}} `('$Name supports appending custom classnames onto the root element', ({Component, props}) => { let tree = renderComponent(Component, props); - expect(tree.container.querySelector('body>div> .custom-class-name')).toBeTruthy(); + expect(tree.container.querySelector('.custom-class-name')).toBeTruthy(); }); it.each` diff --git a/packages/@react-spectrum/toast/test/ToastContainer.test.js b/packages/@react-spectrum/toast/test/ToastContainer.test.js index ca3d7144a4d..8861ed5e545 100644 --- a/packages/@react-spectrum/toast/test/ToastContainer.test.js +++ b/packages/@react-spectrum/toast/test/ToastContainer.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, pointerMap, render, within} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, pointerMap, renderv3 as render, within} from '@react-spectrum/test-utils-internal'; import {Button} from '@react-spectrum/button'; import {clearToastQueue, ToastContainer, ToastQueue} from '../src/ToastContainer'; import {defaultTheme} from '@adobe/react-spectrum'; diff --git a/packages/@react-spectrum/tooltip/test/Tooltip.test.js b/packages/@react-spectrum/tooltip/test/Tooltip.test.js index a85d16ce8e5..aa4ec53bce6 100644 --- a/packages/@react-spectrum/tooltip/test/Tooltip.test.js +++ b/packages/@react-spectrum/tooltip/test/Tooltip.test.js @@ -11,7 +11,7 @@ */ import React from 'react'; -import {render} from '@react-spectrum/test-utils-internal'; +import {renderv3 as render} from '@react-spectrum/test-utils-internal'; import {Tooltip} from '../'; describe('Tooltip', function () { diff --git a/packages/@react-spectrum/tooltip/test/TooltipTrigger.test.js b/packages/@react-spectrum/tooltip/test/TooltipTrigger.test.js index c6be0220a08..087fc33e13d 100644 --- a/packages/@react-spectrum/tooltip/test/TooltipTrigger.test.js +++ b/packages/@react-spectrum/tooltip/test/TooltipTrigger.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import {ActionButton} from '@react-spectrum/button'; import {Provider} from '@react-spectrum/provider'; import React from 'react'; diff --git a/packages/@react-spectrum/tree/test/TreeView.test.tsx b/packages/@react-spectrum/tree/test/TreeView.test.tsx index 7f518f060a5..a72fcf41b24 100644 --- a/packages/@react-spectrum/tree/test/TreeView.test.tsx +++ b/packages/@react-spectrum/tree/test/TreeView.test.tsx @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {act, fireEvent, mockClickDefault, pointerMap, render as renderComponent, within} from '@react-spectrum/test-utils-internal'; +import {act, fireEvent, mockClickDefault, pointerMap, renderv3 as renderComponent, within} from '@react-spectrum/test-utils-internal'; import {ActionGroup, Item} from '@react-spectrum/actiongroup'; import {Content} from '@react-spectrum/view'; import Delete from '@spectrum-icons/workflow/Delete'; diff --git a/packages/@react-spectrum/utils/test/Slots.test.js b/packages/@react-spectrum/utils/test/Slots.test.js index 6a310118adc..ae2bf54dfe0 100644 --- a/packages/@react-spectrum/utils/test/Slots.test.js +++ b/packages/@react-spectrum/utils/test/Slots.test.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {pointerMap, render} from '@react-spectrum/test-utils-internal'; +import {pointerMap, renderv3 as render} from '@react-spectrum/test-utils-internal'; import React, {useRef} from 'react'; import {SlotProvider, useSlotProps} from '../'; import {useId, useSlotId} from '@react-aria/utils'; diff --git a/packages/@react-spectrum/view/test/View.test.js b/packages/@react-spectrum/view/test/View.test.js index 09d311435a3..aab58b4547c 100644 --- a/packages/@react-spectrum/view/test/View.test.js +++ b/packages/@react-spectrum/view/test/View.test.js @@ -11,7 +11,7 @@ */ import React from 'react'; -import {render} from '@react-spectrum/test-utils-internal'; +import {renderv3 as render} from '@react-spectrum/test-utils-internal'; import {View} from '../'; describe('View', function () { diff --git a/packages/@react-spectrum/well/test/Well.test.js b/packages/@react-spectrum/well/test/Well.test.js index c60b45a598d..bed8ac7bae0 100644 --- a/packages/@react-spectrum/well/test/Well.test.js +++ b/packages/@react-spectrum/well/test/Well.test.js @@ -11,7 +11,7 @@ */ import React, {useRef} from 'react'; -import {render} from '@react-spectrum/test-utils-internal'; +import {renderv3 as render} from '@react-spectrum/test-utils-internal'; import {Well} from '../'; let refExists = (ComponentToCheck, children, props) => { diff --git a/packages/@spectrum-icons/ui/scripts/generateIcons.cjs b/packages/@spectrum-icons/ui/scripts/generateIcons.cjs index 6d7822853af..d04442469a0 100644 --- a/packages/@spectrum-icons/ui/scripts/generateIcons.cjs +++ b/packages/@spectrum-icons/ui/scripts/generateIcons.cjs @@ -46,12 +46,7 @@ ${jsx} ExpressIcon.displayName = IconComponent.displayName; export default function ${iconName}(props: UIIconPropsWithoutChildren) { - let provider; - try { - provider = useProvider(); - } catch { - // ignore - } + let provider = useProvider(); return {provider?.theme?.global?.express ? : }; } `