diff --git a/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/multi-collection.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/multi-collection.test.ts.snap index a3393c65cbf..27ba5c81e99 100644 --- a/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/multi-collection.test.ts.snap +++ b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/multi-collection.test.ts.snap @@ -1,5 +1,46 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`Does not affect unimplemented collections 1`] = ` +"import {Accordion, Item, ActionBarContainer, ActionBar, ListView, ListBox} from '@adobe/react-spectrum'; +import {SearchAutocomplete} from '@react-spectrum/autocomplete'; +import {StepList} from '@react-spectrum/steplist'; + +
+ + One + Two + Three + + + One + Two + Three + + + + Adobe Photoshop + Adobe Illustrator + Adobe XD + + + One + Two + Three + + + + One + Two + Three + + + One + Two + Three + +
" +`; + exports[`Static - Renames Item to Breadcrumb and adds import 1`] = ` "import { Breadcrumb, diff --git a/packages/dev/codemods/src/s1-to-s2/__tests__/multi-collection.test.ts b/packages/dev/codemods/src/s1-to-s2/__tests__/multi-collection.test.ts index 4efa2e62d12..ea8cceb8261 100644 --- a/packages/dev/codemods/src/s1-to-s2/__tests__/multi-collection.test.ts +++ b/packages/dev/codemods/src/s1-to-s2/__tests__/multi-collection.test.ts @@ -39,3 +39,43 @@ import {Breadcrumbs, Item, Menu, MenuTrigger, SubmenuTrigger, Button, Section, H `); +test('Does not affect unimplemented collections', ` +import {Accordion, Item, ActionBarContainer, ActionBar, ListView, ListBox} from '@adobe/react-spectrum'; +import {SearchAutocomplete} from '@react-spectrum/autocomplete'; +import {StepList} from '@react-spectrum/steplist'; + +
+ + One + Two + Three + + + One + Two + Three + + + + Adobe Photoshop + Adobe Illustrator + Adobe XD + + + One + Two + Three + + + + One + Two + Three + + + One + Two + Three + +
+`); diff --git a/packages/dev/codemods/src/s1-to-s2/src/codemods/transforms.ts b/packages/dev/codemods/src/s1-to-s2/src/codemods/transforms.ts index 1bbb5d3c284..65776883fb8 100644 --- a/packages/dev/codemods/src/s1-to-s2/src/codemods/transforms.ts +++ b/packages/dev/codemods/src/s1-to-s2/src/codemods/transforms.ts @@ -509,7 +509,7 @@ function updateComponentWithinCollection( function commentIfParentCollectionNotDetected( path: NodePath ) { - const collectionItemParents = new Set(['Menu', 'ActionMenu', 'TagGroup', 'Breadcrumbs', 'Picker', 'ComboBox', 'ListBox', 'TabList', 'TabPanels', 'ActionGroup', 'ListBox', 'ListView', 'Collection']); + const collectionItemParents = new Set(['Menu', 'ActionMenu', 'TagGroup', 'Breadcrumbs', 'Picker', 'ComboBox', 'ListBox', 'TabList', 'TabPanels', 'ActionGroup', 'ListBox', 'ListView', 'Collection', 'SearchAutocomplete', 'Accordion', 'ActionBar', 'StepList']); if ( t.isJSXElement(path.node) ) {