From cf9ffd98dae96e9c9e1b4f0933970ef7fe33da70 Mon Sep 17 00:00:00 2001 From: dakahn Date: Mon, 2 Aug 2021 10:49:48 -0500 Subject: [PATCH 1/2] test(carbon-react): add public API snapshot testing --- packages/carbon-react/__tests__/index-test.js | 209 ++++++++++++++++++ packages/carbon-react/src/index.js | 18 +- 2 files changed, 220 insertions(+), 7 deletions(-) create mode 100644 packages/carbon-react/__tests__/index-test.js diff --git a/packages/carbon-react/__tests__/index-test.js b/packages/carbon-react/__tests__/index-test.js new file mode 100644 index 000000000000..bbf053ddc420 --- /dev/null +++ b/packages/carbon-react/__tests__/index-test.js @@ -0,0 +1,209 @@ +/** + * Copyright IBM Corp. 2016, 2018 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + */ + +import * as Carbon from '../src/index'; + +describe('Carbon Components React', () => { + it('can be imported using the correct path', () => { + expect(typeof Carbon).toBe('object'); + }); + + it('should export components', () => { + expect(Object.keys(Carbon).sort()).toMatchInlineSnapshot(` +Array [ + "Accordion", + "AccordionItem", + "AccordionSkeleton", + "AspectRatio", + "Breadcrumb", + "BreadcrumbItem", + "BreadcrumbSkeleton", + "Button", + "ButtonSet", + "ButtonSkeleton", + "Checkbox", + "CheckboxSkeleton", + "ClickableTile", + "CodeSnippet", + "CodeSnippetSkeleton", + "Column", + "ComboBox", + "ComposedModal", + "Content", + "ContentSwitcher", + "Copy", + "CopyButton", + "DangerButton", + "DataTable", + "DataTableSkeleton", + "DatePicker", + "DatePickerInput", + "DatePickerSkeleton", + "Dropdown", + "DropdownSkeleton", + "ErrorBoundary", + "ErrorBoundaryContext", + "ExpandableSearch", + "ExpandableTile", + "FileUploader", + "FileUploaderButton", + "FileUploaderDropContainer", + "FileUploaderItem", + "FileUploaderSkeleton", + "Filename", + "FluidForm", + "Form", + "FormGroup", + "FormItem", + "FormLabel", + "Grid", + "Header", + "HeaderContainer", + "HeaderGlobalAction", + "HeaderGlobalBar", + "HeaderMenu", + "HeaderMenuButton", + "HeaderMenuItem", + "HeaderName", + "HeaderNavigation", + "HeaderPanel", + "HeaderSideNavItems", + "IconSkeleton", + "InlineLoading", + "InlineNotification", + "Link", + "ListItem", + "Loading", + "Modal", + "ModalBody", + "ModalFooter", + "ModalHeader", + "MultiSelect", + "NotificationActionButton", + "NotificationButton", + "NotificationTextDetails", + "NumberInput", + "NumberInputSkeleton", + "OrderedList", + "OverflowMenu", + "OverflowMenuItem", + "Pagination", + "PaginationNav", + "PaginationSkeleton", + "PasswordInput", + "PrimaryButton", + "ProgressIndicator", + "ProgressIndicatorSkeleton", + "ProgressStep", + "RadioButton", + "RadioButtonGroup", + "RadioButtonSkeleton", + "RadioTile", + "Row", + "Search", + "SearchFilterButton", + "SearchLayoutButton", + "SearchSkeleton", + "SecondaryButton", + "Select", + "SelectItem", + "SelectItemGroup", + "SelectSkeleton", + "SelectableTile", + "SideNav", + "SideNavDetails", + "SideNavDivider", + "SideNavFooter", + "SideNavHeader", + "SideNavIcon", + "SideNavItem", + "SideNavItems", + "SideNavLink", + "SideNavLinkText", + "SideNavMenu", + "SideNavMenuItem", + "SideNavSwitcher", + "SkeletonPlaceholder", + "SkeletonText", + "SkipToContent", + "Slider", + "SliderSkeleton", + "StructuredListBody", + "StructuredListCell", + "StructuredListHead", + "StructuredListInput", + "StructuredListRow", + "StructuredListSkeleton", + "StructuredListWrapper", + "Switch", + "Switcher", + "SwitcherDivider", + "SwitcherItem", + "Tab", + "TabContent", + "Table", + "TableActionList", + "TableBatchAction", + "TableBatchActions", + "TableBody", + "TableCell", + "TableContainer", + "TableExpandHeader", + "TableExpandRow", + "TableExpandedRow", + "TableHead", + "TableHeader", + "TableRow", + "TableSelectAll", + "TableSelectRow", + "TableToolbar", + "TableToolbarAction", + "TableToolbarContent", + "TableToolbarMenu", + "TableToolbarSearch", + "Tabs", + "TabsSkeleton", + "Tag", + "TagSkeleton", + "TextArea", + "TextAreaSkeleton", + "TextInput", + "TextInputSkeleton", + "Theme", + "Tile", + "TileAboveTheFoldContent", + "TileBelowTheFoldContent", + "TileGroup", + "TimePicker", + "TimePickerSelect", + "ToastNotification", + "Toggle", + "ToggleSkeleton", + "ToggleSmall", + "ToggleSmallSkeleton", + "Toolbar", + "ToolbarDivider", + "ToolbarItem", + "ToolbarOption", + "ToolbarSearch", + "ToolbarTitle", + "Tooltip", + "TooltipDefinition", + "TooltipIcon", + "UnorderedList", + "unstable_Heading", + "unstable_PageSelector", + "unstable_Pagination", + "unstable_ProgressBar", + "unstable_Section", + "unstable_TreeNode", + "unstable_TreeView", + "useTheme", +] +`); + }); +}); diff --git a/packages/carbon-react/src/index.js b/packages/carbon-react/src/index.js index 26620ec00e79..956aa0c8a253 100644 --- a/packages/carbon-react/src/index.js +++ b/packages/carbon-react/src/index.js @@ -86,6 +86,7 @@ export { RadioButton, RadioButtonGroup, Search, + ExpandableSearch, SearchFilterButton, SearchLayoutButton, SecondaryButton, @@ -106,6 +107,7 @@ export { Tag, TextArea, TextInput, + PasswordInput, Tile, ClickableTile, SelectableTile, @@ -184,17 +186,11 @@ export { SideNavMenuItem, SideNavSwitcher, // Experimental + unstable_ProgressBar, unstable_PageSelector, unstable_Pagination, unstable_TreeView, unstable_TreeNode, - unstable_ContextMenu, - unstable_ContextMenuDivider, - unstable_ContextMenuGroup, - unstable_ContextMenuItem, - unstable_ContextMenuRadioGroup, - unstable_ContextMenuSelectableItem, - unstable_useContextMenu, unstable_Heading, unstable_Section, } from 'carbon-components-react'; @@ -206,3 +202,11 @@ export { } from './components/Grid'; export { Theme, useTheme } from './components/Theme'; + +// unstable_ContextMenu, +// unstable_ContextMenuDivider, +// unstable_ContextMenuGroup, +// unstable_ContextMenuItem, +// unstable_ContextMenuRadioGroup, +// unstable_ContextMenuSelectableItem, +// unstable_useContextMenu, From cd42dd289ad829501e955371c36096401c5d389a Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Mon, 2 Aug 2021 12:41:22 -0400 Subject: [PATCH 2/2] fix(snapshot): add context-menu --- packages/carbon-react/__tests__/index-test.js | 7 +++++++ packages/carbon-react/src/index.js | 15 +++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/carbon-react/__tests__/index-test.js b/packages/carbon-react/__tests__/index-test.js index bbf053ddc420..254287574339 100644 --- a/packages/carbon-react/__tests__/index-test.js +++ b/packages/carbon-react/__tests__/index-test.js @@ -195,6 +195,12 @@ Array [ "TooltipDefinition", "TooltipIcon", "UnorderedList", + "unstable_ContextMenu", + "unstable_ContextMenuDivider", + "unstable_ContextMenuGroup", + "unstable_ContextMenuItem", + "unstable_ContextMenuRadioGroup", + "unstable_ContextMenuSelectableItem", "unstable_Heading", "unstable_PageSelector", "unstable_Pagination", @@ -202,6 +208,7 @@ Array [ "unstable_Section", "unstable_TreeNode", "unstable_TreeView", + "unstable_useContextMenu", "useTheme", ] `); diff --git a/packages/carbon-react/src/index.js b/packages/carbon-react/src/index.js index 956aa0c8a253..1ffd376eae00 100644 --- a/packages/carbon-react/src/index.js +++ b/packages/carbon-react/src/index.js @@ -191,6 +191,13 @@ export { unstable_Pagination, unstable_TreeView, unstable_TreeNode, + unstable_ContextMenu, + unstable_ContextMenuDivider, + unstable_ContextMenuGroup, + unstable_ContextMenuItem, + unstable_ContextMenuRadioGroup, + unstable_ContextMenuSelectableItem, + unstable_useContextMenu, unstable_Heading, unstable_Section, } from 'carbon-components-react'; @@ -202,11 +209,3 @@ export { } from './components/Grid'; export { Theme, useTheme } from './components/Theme'; - -// unstable_ContextMenu, -// unstable_ContextMenuDivider, -// unstable_ContextMenuGroup, -// unstable_ContextMenuItem, -// unstable_ContextMenuRadioGroup, -// unstable_ContextMenuSelectableItem, -// unstable_useContextMenu,