From 72f8b2a5ed8db6f54b6e16c96ab3f8e7ff2185e0 Mon Sep 17 00:00:00 2001 From: Nandor_Czegledi Date: Fri, 30 May 2025 08:42:58 +0200 Subject: [PATCH] refactor(many): rename tests folders and clean up old theme tests, check dependencies --- .github/workflows/pr-validation.yml | 18 +- .github/workflows/release.yml | 2 +- eslint.config.mjs | 4 +- package-lock.json | 11 - package.json | 2 - .../InstUISettingProvider.test.tsx | 0 .../InstUISettingsProvider.test.tsx | 0 .../getComponentThemeOverride.test.ts | 0 .../useStyle.test.tsx | 0 .../useTheme.test.tsx | 0 .../withStyle.test.tsx | 0 .../getShorthandPropValue.test.ts | 0 .../makeThemeVars.test.ts | 0 .../mirrorShorthand.test.ts | 0 .../ThemeRegistry.test.ts | 0 .../AccessibleContent.test.tsx | 0 .../PresentationContent.test.tsx | 0 .../ScreenReaderContent.test.tsx | 0 .../FocusRegionManager.test.tsx | 0 .../ScreenReaderFocusRegion.test.tsx | 0 .../hasVisibleChildren.test.tsx | 0 .../scopeTab.test.tsx | 0 .../Alert.test.tsx | 0 .../src/Alert/__tests__/theme.test.ts | 50 -- packages/ui-avatar/package.json | 1 - .../src/Avatar/__new-tests__/Avatar.test.tsx | 291 ------- .../src/Avatar/__tests__/Avatar.test.tsx | 323 ++++---- .../src/Avatar/__tests__/theme.test.ts | 147 ---- packages/ui-avatar/tsconfig.build.json | 3 - .../Badge.test.tsx | 0 .../src/Badge/__tests__/theme.test.ts | 65 -- .../Billboard.test.tsx | 0 .../src/Billboard/__tests__/theme.test.ts | 57 -- .../BreadcrumbLink.test.tsx | 0 .../Breadcrumb.test.tsx | 0 .../BaseButton.test.tsx | 0 .../src/BaseButton/__tests__/theme.test.ts | 245 ------ .../Button.test.tsx | 0 .../CloseButton.test.tsx | 0 .../CondensedButton.test.tsx | 0 .../IconButton.test.tsx | 0 .../ToggleButton.test.tsx | 0 .../Byline.test.tsx | 0 .../{__new-tests__ => __tests__}/Day.test.tsx | 0 .../src/Calendar/Day/__tests__/theme.test.ts | 83 -- .../Calendar.test.tsx | 0 .../src/Calendar/__tests__/theme.test.ts | 47 -- .../CheckboxFacade.test.tsx | 0 .../CheckboxFacade/__tests__/theme.test.ts | 51 -- .../ToggleFacade.test.tsx | 0 .../ToggleFacade/__tests__/theme.test.ts | 63 -- .../Checkbox.test.tsx | 0 .../CheckboxGroup.test.tsx | 0 .../CodeEditor/__tests__/CodeEditor.test.tsx | 56 -- .../ui-codemods/__testfixtures__/.prettierrc | 5 - .../defaultToDefault.config.js | 64 -- .../__testfixtures__/defaultToNamed.config.js | 93 --- .../maintainComments.config.js | 86 -- .../maintainImportTypes.config.js | 50 -- .../__testfixtures__/namedToDefault.config.js | 79 -- .../__testfixtures__/namedToNamed.config.js | 102 --- .../__testfixtures__/noSpecifiers.config.js | 53 -- .../__testfixtures__/props.config.js | 87 --- .../updateImports/defaultToDefault.input.js | 8 - .../updateImports/defaultToDefault.output.js | 7 - .../updateImports/defaultToNamed.input.js | 14 - .../updateImports/defaultToNamed.output.js | 10 - .../updateImports/maintainComments.input.js | 29 - .../updateImports/maintainComments.output.js | 26 - .../maintainImportTypes.input.js | 3 - .../maintainImportTypes.output.js | 3 - .../updateImports/namedToDefault.input.js | 9 - .../updateImports/namedToDefault.output.js | 8 - .../updateImports/namedToNamed.input.js | 12 - .../updateImports/namedToNamed.output.js | 9 - .../updateImports/noSpecifiers.input.js | 4 - .../updateImports/noSpecifiers.output.js | 4 - .../updateImports/testCases.txt | 0 .../updatePropNames/elements.input.js | 3 - .../updatePropNames/elements.output.js | 3 - .../updatePropNames/updateValues.input.js | 12 - .../updatePropNames/updateValues.output.js | 20 - .../updateV10Breaking/colors.input.js | 40 - .../updateV10Breaking/colors.output.js | 40 - .../updateV10Breaking/colors2.input.tsx | 716 ----------------- .../updateV10Breaking/colors2.output.tsx | 734 ------------------ .../updateV7Props/buttonClose.input.js | 18 - .../updateV7Props/buttonClose.output.js | 14 - .../updateV7Props/buttonIconCircle.input.js | 26 - .../updateV7Props/buttonIconCircle.output.js | 37 - .../updateV7Props/buttonLink.input.js | 11 - .../updateV7Props/buttonLink.output.js | 13 - .../updateV7Props/buttonMisc.input.js | 12 - .../updateV7Props/buttonMisc.output.js | 12 - .../updateV7Props/buttonWithText.input.js | 12 - .../updateV7Props/buttonWithText.output.js | 12 - .../updateV7Props/focusableView.input.js | 14 - .../updateV7Props/focusableView.output.js | 16 - .../updateV7Props/heading.input.js | 13 - .../updateV7Props/heading.output.js | 18 - .../updateV7Props/helpers.input.js | 20 - .../updateV7Props/helpers.output.js | 20 - .../updateV7Props/list.input.js | 18 - .../updateV7Props/list.output.js | 20 - .../updateV7Props/pill.input.js | 11 - .../updateV7Props/pill.output.js | 11 - .../updateV7Props/popover.input.js | 25 - .../updateV7Props/popover.output.js | 24 - .../updateV7Props/tabs.input.js | 15 - .../updateV7Props/tabs.output.js | 15 - .../v7ComponentDeprecations.input.js | 23 - .../v7ComponentDeprecations.output.js | 23 - .../updateV8Breaking/applyTheme.input.js | 12 - .../updateV8Breaking/applyTheme.output.js | 14 - .../updateV8Breaking/themeProp.input.js | 13 - .../updateV8Breaking/themeProp.output.js | 13 - .../themeStaticVariable.input.js | 21 - .../themeStaticVariable.output.js | 24 - .../updateV8Breaking/tsFile.input.tsx | 22 - .../updateV8Breaking/tsFile.output.tsx | 24 - .../updateV8ReactDOM/reactDOMRender.input.js | 24 - .../updateV8ReactDOM/reactDOMRender.output.js | 40 - .../updateV8ReactDOM/reactDOMRender2.input.js | 24 - .../reactDOMRender2.output.js | 40 - .../__tests__/updateImports.test.js | 52 -- .../__tests__/updatePropNames.test.js | 41 - .../__tests__/updateV10Breaking.test.js | 45 -- .../__tests__/updateV7Props.test.js | 52 -- .../__tests__/updateV8Breaking.test.js | 45 -- .../__tests__/updateV8ReactDOM.test.js | 38 - packages/ui-codemods/vitest.config.ts | 36 - .../ColorContrast.test.tsx | 0 .../ColorIndicator.test.tsx | 0 .../ColorMixer.test.tsx | 0 .../ColorPicker.test.tsx | 0 .../ColorPreset.test.tsx | 0 packages/ui-color-utils/package.json | 1 - packages/ui-color-utils/tsconfig.build.json | 4 - .../DateInput.test.tsx | 0 .../DateInput2.test.tsx | 0 .../DateTimeInput.test.tsx | 0 .../Dialog.test.tsx | 0 .../addEventListener.test.tsx | 0 .../addInputModeListener.test.tsx | 0 .../addPositionChangeListener.test.tsx | 0 .../findTabbable.test.tsx | 0 .../getClassList.test.tsx | 0 .../getFontSize.test.tsx | 0 .../getOffsetParents.test.tsx | 0 .../getScrollParents.test.tsx | 0 .../isCustomElement.test.tsx | 0 .../isVisible.test.tsx | 0 .../requestAnimationFrame.test.tsx | 0 .../transformSelection.test.tsx | 0 .../DrawerContent.test.tsx | 0 .../DrawerTray.test.tsx | 0 .../DrawerLayout.test.tsx | 0 .../DrilldownGroup.test.tsx | 0 .../DrilldownOption.test.tsx | 0 .../DrilldownPage.test.tsx | 0 .../DrilldownSeparator.test.tsx | 0 .../Drilldown.test.tsx | 0 .../src/Drilldown/__tests__/theme.test.ts | 59 -- .../Editable.test.tsx | 0 .../InPlaceEdit.test.tsx | 0 .../Expandable.test.tsx | 0 .../FileDrop.test.tsx | 0 .../src/FileDrop/__tests__/theme.test.ts | 69 -- .../accepts.test.tsx | 0 .../getEventFiles.test.tsx | 0 .../FlexItem.test.tsx | 0 .../Flex.test.tsx | 0 .../__new-tests__/Focusable.test.tsx | 485 ------------ .../Focusable/__tests__/Focusable.test.tsx | 398 +++++----- .../FormField.test.tsx | 0 .../FormFieldGroup.test.tsx | 0 .../FormFieldLabel.test.tsx | 0 .../FormFieldLayout.test.tsx | 0 .../FormFieldMessage.test.tsx | 0 .../FormFieldMessages.test.tsx | 0 .../Grid.test.tsx | 0 .../Grid.test.tsx | 0 .../Heading.test.tsx | 0 .../ApplyLocale.test.tsx | 0 .../DateTime.test.tsx | 0 .../I18nPropTypes.test.tsx | 0 .../Locale.test.tsx | 0 .../textDirectionContextConsumer.test.tsx | 0 .../{__new-tests__ => __tests__}/Img.test.tsx | 0 .../Link.test.tsx | 0 .../InlineListItem.test.tsx | 0 .../InlineList.test.tsx | 0 .../ListItem.test.tsx | 0 .../List.test.tsx | 0 .../MenuItem.test.tsx | 0 .../src/Menu/MenuItem/__tests__/theme.test.ts | 70 -- .../MenuItemGroup.test.tsx | 0 .../MenuItemGroup/__tests__/theme.test.ts | 47 -- .../Menu.test.tsx | 0 .../Metric.test.tsx | 0 .../MetricGroup.test.tsx | 0 .../ModalBody.test.tsx | 0 .../ModalFooter.test.tsx | 0 .../ModalHeader.test.tsx | 0 .../Modal.test.tsx | 0 .../Transition.test.tsx | 0 .../Item.test.tsx | 0 .../src/AppNav/Item/__tests__/theme.test.ts | 63 -- .../AppNav.test.tsx | 0 .../NumberInput.test.tsx | 0 .../Item.test.tsx | 0 .../src/Options/Item/__tests__/theme.test.ts | 89 --- .../Options.test.tsx | 0 .../src/Options/__tests__/theme.test.ts | 51 -- .../Mask.test.tsx | 0 .../Overlay.test.tsx | 0 .../Page.test.tsx | 0 .../Pages.test.tsx | 0 .../src/Pages/__tests__/theme.test.ts | 46 -- .../PaginationArrowButton.test.tsx | 0 .../PaginationButton.test.tsx | 0 .../PaginationPageInput.test.tsx | 0 .../Pagination.test.tsx | 0 packages/ui-pill/package.json | 2 - packages/ui-pill/src/Pill/PillLocator.ts | 40 - .../Pill.test.tsx | 0 .../ui-pill/src/Pill/__tests__/theme.test.ts | 108 --- packages/ui-pill/src/Pill/locator.ts | 28 - packages/ui-pill/tsconfig.build.json | 2 - packages/ui-popover/package.json | 2 - .../ui-popover/src/Popover/PopoverLocator.ts | 41 - .../src/Popover/PopoverTriggerLocator.ts | 27 - .../Popover.test.tsx | 0 packages/ui-popover/src/Popover/locator.ts | 29 - packages/ui-popover/tsconfig.build.json | 2 - .../Portal.test.tsx | 0 packages/ui-position/package.json | 1 - .../src/Position/PositionContentLocator.ts | 30 - .../src/Position/PositionLocator.ts | 55 -- .../src/Position/PositionTargetLocator.ts | 30 - .../Position.test.tsx | 0 packages/ui-position/src/Position/locator.ts | 34 - .../mirrorHorizontalPlacement.test.tsx | 0 .../mirrorPlacement.test.tsx | 0 packages/ui-position/tsconfig.build.json | 3 - .../ProgressBar.test.tsx | 0 .../src/ProgressBar/__tests__/theme.test.ts | 100 --- .../ProgressCircle.test.tsx | 0 .../ProgressCircle/__tests__/theme.test.ts | 105 --- .../children.test.tsx | 0 .../childrenOrValue.test.tsx | 0 .../controllable.test.tsx | 0 .../makeRequirable.test.tsx | 0 .../{__new-tests__ => __tests__}/xor.test.tsx | 0 .../RadioInput.test.tsx | 0 .../src/RadioInput/__tests__/theme.test.ts | 81 -- .../RadioInputGroup.test.tsx | 0 .../RangeInput.test.tsx | 0 .../Rating.test.tsx | 0 .../RatingIcon.test.tsx | 0 .../DeterministicIdContext.test.tsx | 0 .../callRenderProp.test.tsx | 0 .../deprecated.test.tsx | 0 .../experimental.test.tsx | 0 .../getInteraction.test.tsx | 0 .../hack.test.tsx | 0 .../omitProps.test.tsx | 0 .../passthroughProps.test.tsx | 0 .../pickProps.test.tsx | 0 .../safeCloneElement.test.tsx | 0 .../Responsive.test.tsx | 0 .../Select.test.tsx | 0 .../src/Select/__tests__/theme.test.ts | 47 -- .../Selectable.test.tsx | 0 .../NavigationItem.test.tsx | 0 .../SideNavBarItem/__tests__/theme.test.ts | 51 -- .../SideNavBar.test.tsx | 0 .../src/SideNavBar/__tests__/theme.test.ts | 51 -- .../SimpleSelect.test.tsx | 0 .../SourceCodeEditor.test.tsx | 0 .../Spinner.test.tsx | 0 .../src/Spinner/__tests__/theme.test.ts | 63 -- .../InlineSVG.test.tsx | 0 .../SVGIcon.test.tsx | 0 .../Table.test.tsx | 0 .../src/Table/__tests__/theme.test.ts | 47 -- .../Panel.test.tsx | 0 .../src/Tabs/Panel/__tests__/theme.test.ts | 51 -- .../{__new-tests__ => __tests__}/Tab.test.tsx | 0 .../src/Tabs/Tab/__tests__/theme.test.ts | 61 -- .../Tabs.test.tsx | 0 .../{__new-tests__ => __tests__}/Tag.test.tsx | 0 .../ui-tag/src/Tag/__tests__/theme.test.ts | 70 -- .../assertions.test.tsx | 0 .../generateComponentExamples.test.tsx | 2 +- .../generatePropCombinations.test.ts | 0 .../locator.test.tsx | 3 + .../queries.test.tsx | 0 .../reactComponentWrapper.test.tsx | 0 .../testable.test.tsx | 0 .../TextArea.test.tsx | 0 .../src/TextArea/__tests__/theme.test.ts | 62 -- .../TextInput.test.tsx | 0 .../src/TextInput/__tests__/theme.test.ts | 62 -- .../Text.test.tsx | 0 .../themes.test.tsx | 0 .../TimeSelect.test.tsx | 0 .../ToggleDetails.test.tsx | 0 .../ToggleGroup.test.tsx | 0 packages/ui-tooltip/package.json | 2 - .../ui-tooltip/src/Tooltip/TooltipLocator.ts | 43 - .../Tooltip.test.tsx | 0 packages/ui-tooltip/src/Tooltip/locator.ts | 30 - packages/ui-tooltip/tsconfig.build.json | 2 - packages/ui-top-nav-bar/package.json | 1 - .../TopNavBarActionItems.test.tsx | 0 .../TopNavBarBrand/TopNavBarBrandLocator.ts | 41 - .../__examples__/TopNavBarBrand.examples.tsx | 54 -- .../__tests__/TopNavBarBrand.test.tsx | 191 ----- .../TopNavBarBreadcrumb.test.tsx | 0 .../TopNavBarItem.test.tsx | 0 .../TopNavBarDesktopLayout.test.tsx | 0 .../TopNavBarSmallViewportLayout.test.tsx | 0 .../TopNavBarLayout.test.tsx | 0 .../TopNavBarMenuItems.test.tsx | 0 .../TopNavBarUser.test.tsx | 0 .../TopNavBar.test.tsx | 0 packages/ui-top-nav-bar/tsconfig.build.json | 1 - .../Tray.test.tsx | 0 .../TreeButton.test.tsx | 0 .../TreeCollection.test.tsx | 0 .../TreeNode.test.tsx | 0 .../TreeBrowser.test.tsx | 0 packages/ui-truncate-list/package.json | 1 - .../TruncateList.test.tsx | 0 packages/ui-truncate-list/tsconfig.build.json | 1 - .../TruncateText.test.tsx | 0 .../cleanData.test.tsx | 0 .../cleanString.test.tsx | 0 .../measureText.test.tsx | 0 .../camelize.test.tsx | 0 .../cloneArray.test.tsx | 0 .../createChainedFunction.test.tsx | 0 .../generateId.test.tsx | 0 .../hash.test.tsx | 0 .../mergeDeep.test.tsx | 0 .../{__new-tests__ => __tests__}/ms.test.tsx | 0 .../parseUnit.test.tsx | 0 .../pascalize.test.tsx | 0 .../{__new-tests__ => __tests__}/px.test.tsx | 0 .../within.test.tsx | 0 .../ContextView.test.tsx | 0 .../View.test.tsx | 0 .../ui-view/src/View/__tests__/theme.test.ts | 153 ---- .../{__new-tests__ => __tests__}/uid.test.tsx | 0 vitest.config.mts | 2 +- 356 files changed, 350 insertions(+), 7729 deletions(-) rename packages/emotion/src/InstUISettingsProvider/{__tests__ => __old-tests__}/InstUISettingProvider.test.tsx (100%) rename packages/emotion/src/InstUISettingsProvider/{__new-tests__ => __tests__}/InstUISettingsProvider.test.tsx (100%) rename packages/emotion/src/{__tests__ => __old-tests__}/getComponentThemeOverride.test.ts (100%) rename packages/emotion/src/{__tests__ => __old-tests__}/useStyle.test.tsx (100%) rename packages/emotion/src/{__tests__ => __old-tests__}/useTheme.test.tsx (100%) rename packages/emotion/src/{__tests__ => __old-tests__}/withStyle.test.tsx (100%) rename packages/emotion/src/styleUtils/{__tests__ => __old-tests__}/getShorthandPropValue.test.ts (100%) rename packages/emotion/src/styleUtils/{__tests__ => __old-tests__}/makeThemeVars.test.ts (100%) rename packages/emotion/src/styleUtils/{__tests__ => __old-tests__}/mirrorShorthand.test.ts (100%) rename packages/theme-registry/src/{__tests__ => __old-tests__}/ThemeRegistry.test.ts (100%) rename packages/ui-a11y-content/src/AccessibleContent/{__new-tests__ => __tests__}/AccessibleContent.test.tsx (100%) rename packages/ui-a11y-content/src/PresentationContent/{__new-tests__ => __tests__}/PresentationContent.test.tsx (100%) rename packages/ui-a11y-content/src/ScreenReaderContent/{__new-tests__ => __tests__}/ScreenReaderContent.test.tsx (100%) rename packages/ui-a11y-utils/src/{__new-tests__ => __tests__}/FocusRegionManager.test.tsx (100%) rename packages/ui-a11y-utils/src/{__new-tests__ => __tests__}/ScreenReaderFocusRegion.test.tsx (100%) rename packages/ui-a11y-utils/src/{__new-tests__ => __tests__}/hasVisibleChildren.test.tsx (100%) rename packages/ui-a11y-utils/src/{__new-tests__ => __tests__}/scopeTab.test.tsx (100%) rename packages/ui-alerts/src/Alert/{__new-tests__ => __tests__}/Alert.test.tsx (100%) delete mode 100644 packages/ui-alerts/src/Alert/__tests__/theme.test.ts delete mode 100644 packages/ui-avatar/src/Avatar/__new-tests__/Avatar.test.tsx delete mode 100644 packages/ui-avatar/src/Avatar/__tests__/theme.test.ts rename packages/ui-badge/src/Badge/{__new-tests__ => __tests__}/Badge.test.tsx (100%) delete mode 100644 packages/ui-badge/src/Badge/__tests__/theme.test.ts rename packages/ui-billboard/src/Billboard/{__new-tests__ => __tests__}/Billboard.test.tsx (100%) delete mode 100644 packages/ui-billboard/src/Billboard/__tests__/theme.test.ts rename packages/ui-breadcrumb/src/Breadcrumb/BreadcrumbLink/{__new-tests__ => __tests__}/BreadcrumbLink.test.tsx (100%) rename packages/ui-breadcrumb/src/Breadcrumb/{__new-tests__ => __tests__}/Breadcrumb.test.tsx (100%) rename packages/ui-buttons/src/BaseButton/{__new-tests__ => __tests__}/BaseButton.test.tsx (100%) delete mode 100644 packages/ui-buttons/src/BaseButton/__tests__/theme.test.ts rename packages/ui-buttons/src/Button/{__new-tests__ => __tests__}/Button.test.tsx (100%) rename packages/ui-buttons/src/CloseButton/{__new-tests__ => __tests__}/CloseButton.test.tsx (100%) rename packages/ui-buttons/src/CondensedButton/{__new-tests__ => __tests__}/CondensedButton.test.tsx (100%) rename packages/ui-buttons/src/IconButton/{__new-tests__ => __tests__}/IconButton.test.tsx (100%) rename packages/ui-buttons/src/ToggleButton/{__new-tests__ => __tests__}/ToggleButton.test.tsx (100%) rename packages/ui-byline/src/Byline/{__new-tests__ => __tests__}/Byline.test.tsx (100%) rename packages/ui-calendar/src/Calendar/Day/{__new-tests__ => __tests__}/Day.test.tsx (100%) delete mode 100644 packages/ui-calendar/src/Calendar/Day/__tests__/theme.test.ts rename packages/ui-calendar/src/Calendar/{__new-tests__ => __tests__}/Calendar.test.tsx (100%) delete mode 100644 packages/ui-calendar/src/Calendar/__tests__/theme.test.ts rename packages/ui-checkbox/src/Checkbox/CheckboxFacade/{__new-tests__ => __tests__}/CheckboxFacade.test.tsx (100%) delete mode 100644 packages/ui-checkbox/src/Checkbox/CheckboxFacade/__tests__/theme.test.ts rename packages/ui-checkbox/src/Checkbox/ToggleFacade/{__new-tests__ => __tests__}/ToggleFacade.test.tsx (100%) delete mode 100644 packages/ui-checkbox/src/Checkbox/ToggleFacade/__tests__/theme.test.ts rename packages/ui-checkbox/src/Checkbox/{__new-tests__ => __tests__}/Checkbox.test.tsx (100%) rename packages/ui-checkbox/src/CheckboxGroup/{__new-tests__ => __tests__}/CheckboxGroup.test.tsx (100%) delete mode 100644 packages/ui-code-editor/src/CodeEditor/__tests__/CodeEditor.test.tsx delete mode 100644 packages/ui-codemods/__testfixtures__/.prettierrc delete mode 100644 packages/ui-codemods/__testfixtures__/defaultToDefault.config.js delete mode 100644 packages/ui-codemods/__testfixtures__/defaultToNamed.config.js delete mode 100644 packages/ui-codemods/__testfixtures__/maintainComments.config.js delete mode 100644 packages/ui-codemods/__testfixtures__/maintainImportTypes.config.js delete mode 100644 packages/ui-codemods/__testfixtures__/namedToDefault.config.js delete mode 100644 packages/ui-codemods/__testfixtures__/namedToNamed.config.js delete mode 100644 packages/ui-codemods/__testfixtures__/noSpecifiers.config.js delete mode 100644 packages/ui-codemods/__testfixtures__/props.config.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateImports/defaultToDefault.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateImports/defaultToDefault.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateImports/defaultToNamed.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateImports/defaultToNamed.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateImports/maintainComments.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateImports/maintainComments.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateImports/maintainImportTypes.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateImports/maintainImportTypes.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateImports/namedToDefault.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateImports/namedToDefault.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateImports/namedToNamed.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateImports/namedToNamed.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateImports/noSpecifiers.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateImports/noSpecifiers.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateImports/testCases.txt delete mode 100644 packages/ui-codemods/__testfixtures__/updatePropNames/elements.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updatePropNames/elements.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updatePropNames/updateValues.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updatePropNames/updateValues.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV10Breaking/colors.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV10Breaking/colors.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV10Breaking/colors2.input.tsx delete mode 100644 packages/ui-codemods/__testfixtures__/updateV10Breaking/colors2.output.tsx delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/buttonClose.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/buttonClose.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/buttonIconCircle.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/buttonIconCircle.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/buttonLink.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/buttonLink.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/buttonMisc.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/buttonMisc.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/buttonWithText.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/buttonWithText.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/focusableView.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/focusableView.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/heading.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/heading.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/helpers.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/helpers.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/list.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/list.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/pill.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/pill.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/popover.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/popover.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/tabs.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/tabs.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/v7ComponentDeprecations.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV7Props/v7ComponentDeprecations.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV8Breaking/applyTheme.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV8Breaking/applyTheme.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV8Breaking/themeProp.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV8Breaking/themeProp.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV8Breaking/themeStaticVariable.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV8Breaking/themeStaticVariable.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV8Breaking/tsFile.input.tsx delete mode 100644 packages/ui-codemods/__testfixtures__/updateV8Breaking/tsFile.output.tsx delete mode 100644 packages/ui-codemods/__testfixtures__/updateV8ReactDOM/reactDOMRender.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV8ReactDOM/reactDOMRender.output.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV8ReactDOM/reactDOMRender2.input.js delete mode 100644 packages/ui-codemods/__testfixtures__/updateV8ReactDOM/reactDOMRender2.output.js delete mode 100644 packages/ui-codemods/__tests__/updateImports.test.js delete mode 100644 packages/ui-codemods/__tests__/updatePropNames.test.js delete mode 100644 packages/ui-codemods/__tests__/updateV10Breaking.test.js delete mode 100644 packages/ui-codemods/__tests__/updateV7Props.test.js delete mode 100644 packages/ui-codemods/__tests__/updateV8Breaking.test.js delete mode 100644 packages/ui-codemods/__tests__/updateV8ReactDOM.test.js delete mode 100644 packages/ui-codemods/vitest.config.ts rename packages/ui-color-picker/src/ColorContrast/{__new-tests__ => __tests__}/ColorContrast.test.tsx (100%) rename packages/ui-color-picker/src/ColorIndicator/{__new-tests__ => __tests__}/ColorIndicator.test.tsx (100%) rename packages/ui-color-picker/src/ColorMixer/{__new-tests__ => __tests__}/ColorMixer.test.tsx (100%) rename packages/ui-color-picker/src/ColorPicker/{__new-tests__ => __tests__}/ColorPicker.test.tsx (100%) rename packages/ui-color-picker/src/ColorPreset/{__new-tests__ => __tests__}/ColorPreset.test.tsx (100%) rename packages/ui-date-input/src/DateInput/{__new-tests__ => __tests__}/DateInput.test.tsx (100%) rename packages/ui-date-input/src/DateInput2/{__new-tests__ => __tests__}/DateInput2.test.tsx (100%) rename packages/ui-date-time-input/src/DateTimeInput/{__new-tests__ => __tests__}/DateTimeInput.test.tsx (100%) rename packages/ui-dialog/src/Dialog/{__new-tests__ => __tests__}/Dialog.test.tsx (100%) rename packages/ui-dom-utils/src/{__new-tests__ => __tests__}/addEventListener.test.tsx (100%) rename packages/ui-dom-utils/src/{__new-tests__ => __tests__}/addInputModeListener.test.tsx (100%) rename packages/ui-dom-utils/src/{__new-tests__ => __tests__}/addPositionChangeListener.test.tsx (100%) rename packages/ui-dom-utils/src/{__new-tests__ => __tests__}/findTabbable.test.tsx (100%) rename packages/ui-dom-utils/src/{__new-tests__ => __tests__}/getClassList.test.tsx (100%) rename packages/ui-dom-utils/src/{__new-tests__ => __tests__}/getFontSize.test.tsx (100%) rename packages/ui-dom-utils/src/{__new-tests__ => __tests__}/getOffsetParents.test.tsx (100%) rename packages/ui-dom-utils/src/{__new-tests__ => __tests__}/getScrollParents.test.tsx (100%) rename packages/ui-dom-utils/src/{__new-tests__ => __tests__}/isCustomElement.test.tsx (100%) rename packages/ui-dom-utils/src/{__new-tests__ => __tests__}/isVisible.test.tsx (100%) rename packages/ui-dom-utils/src/{__new-tests__ => __tests__}/requestAnimationFrame.test.tsx (100%) rename packages/ui-dom-utils/src/{__new-tests__ => __tests__}/transformSelection.test.tsx (100%) rename packages/ui-drawer-layout/src/DrawerLayout/DrawerContent/{__new-tests__ => __tests__}/DrawerContent.test.tsx (100%) rename packages/ui-drawer-layout/src/DrawerLayout/DrawerTray/{__new-tests__ => __tests__}/DrawerTray.test.tsx (100%) rename packages/ui-drawer-layout/src/DrawerLayout/{__new-tests__ => __tests__}/DrawerLayout.test.tsx (100%) rename packages/ui-drilldown/src/Drilldown/DrilldownGroup/{__new-tests__ => __tests__}/DrilldownGroup.test.tsx (100%) rename packages/ui-drilldown/src/Drilldown/DrilldownOption/{__new-tests__ => __tests__}/DrilldownOption.test.tsx (100%) rename packages/ui-drilldown/src/Drilldown/DrilldownPage/{__new-tests__ => __tests__}/DrilldownPage.test.tsx (100%) rename packages/ui-drilldown/src/Drilldown/DrilldownSeparator/{__new-tests__ => __tests__}/DrilldownSeparator.test.tsx (100%) rename packages/ui-drilldown/src/Drilldown/{__new-tests__ => __tests__}/Drilldown.test.tsx (100%) delete mode 100644 packages/ui-drilldown/src/Drilldown/__tests__/theme.test.ts rename packages/ui-editable/src/Editable/{__new-tests__ => __tests__}/Editable.test.tsx (100%) rename packages/ui-editable/src/InPlaceEdit/{__new-tests__ => __tests__}/InPlaceEdit.test.tsx (100%) rename packages/ui-expandable/src/Expandable/{__new-tests__ => __tests__}/Expandable.test.tsx (100%) rename packages/ui-file-drop/src/FileDrop/{__new-tests__ => __tests__}/FileDrop.test.tsx (100%) delete mode 100644 packages/ui-file-drop/src/FileDrop/__tests__/theme.test.ts rename packages/ui-file-drop/src/FileDrop/utils/{__new-tests__ => __tests__}/accepts.test.tsx (100%) rename packages/ui-file-drop/src/FileDrop/utils/{__new-tests__ => __tests__}/getEventFiles.test.tsx (100%) rename packages/ui-flex/src/Flex/Item/{__new-tests__ => __tests__}/FlexItem.test.tsx (100%) rename packages/ui-flex/src/Flex/{__new-tests__ => __tests__}/Flex.test.tsx (100%) delete mode 100644 packages/ui-focusable/src/Focusable/__new-tests__/Focusable.test.tsx rename packages/ui-form-field/src/FormField/{__new-tests__ => __tests__}/FormField.test.tsx (100%) rename packages/ui-form-field/src/FormFieldGroup/{__new-tests__ => __tests__}/FormFieldGroup.test.tsx (100%) rename packages/ui-form-field/src/FormFieldLabel/{__new-tests__ => __tests__}/FormFieldLabel.test.tsx (100%) rename packages/ui-form-field/src/FormFieldLayout/{__new-tests__ => __tests__}/FormFieldLayout.test.tsx (100%) rename packages/ui-form-field/src/FormFieldMessage/{__new-tests__ => __tests__}/FormFieldMessage.test.tsx (100%) rename packages/ui-form-field/src/FormFieldMessages/{__new-tests__ => __tests__}/FormFieldMessages.test.tsx (100%) rename packages/ui-grid/src/Grid/{__new-tests__ => __tests__}/Grid.test.tsx (100%) rename packages/ui-grid/src/GridCol/{__new-tests__ => __tests__}/Grid.test.tsx (100%) rename packages/ui-heading/src/Heading/{__new-tests__ => __tests__}/Heading.test.tsx (100%) rename packages/ui-i18n/src/ApplyLocale/{__new-tests__ => __tests__}/ApplyLocale.test.tsx (100%) rename packages/ui-i18n/src/{__new-tests__ => __tests__}/DateTime.test.tsx (100%) rename packages/ui-i18n/src/{__new-tests__ => __tests__}/I18nPropTypes.test.tsx (100%) rename packages/ui-i18n/src/{__new-tests__ => __tests__}/Locale.test.tsx (100%) rename packages/ui-i18n/src/{__new-tests__ => __tests__}/textDirectionContextConsumer.test.tsx (100%) rename packages/ui-img/src/Img/{__new-tests__ => __tests__}/Img.test.tsx (100%) rename packages/ui-link/src/Link/{__new-tests__ => __tests__}/Link.test.tsx (100%) rename packages/ui-list/src/InlineList/InlineListItem/{__new-tests__ => __tests__}/InlineListItem.test.tsx (100%) rename packages/ui-list/src/InlineList/{__new-tests__ => __tests__}/InlineList.test.tsx (100%) rename packages/ui-list/src/List/ListItem/{__new-tests__ => __tests__}/ListItem.test.tsx (100%) rename packages/ui-list/src/List/{__new-tests__ => __tests__}/List.test.tsx (100%) rename packages/ui-menu/src/Menu/MenuItem/{__new-tests__ => __tests__}/MenuItem.test.tsx (100%) delete mode 100644 packages/ui-menu/src/Menu/MenuItem/__tests__/theme.test.ts rename packages/ui-menu/src/Menu/MenuItemGroup/{__new-tests__ => __tests__}/MenuItemGroup.test.tsx (100%) delete mode 100644 packages/ui-menu/src/Menu/MenuItemGroup/__tests__/theme.test.ts rename packages/ui-menu/src/Menu/{__new-tests__ => __tests__}/Menu.test.tsx (100%) rename packages/ui-metric/src/Metric/{__new-tests__ => __tests__}/Metric.test.tsx (100%) rename packages/ui-metric/src/MetricGroup/{__new-tests__ => __tests__}/MetricGroup.test.tsx (100%) rename packages/ui-modal/src/Modal/ModalBody/{__new-tests__ => __tests__}/ModalBody.test.tsx (100%) rename packages/ui-modal/src/Modal/ModalFooter/{__new-tests__ => __tests__}/ModalFooter.test.tsx (100%) rename packages/ui-modal/src/Modal/ModalHeader/{__new-tests__ => __tests__}/ModalHeader.test.tsx (100%) rename packages/ui-modal/src/Modal/{__new-tests__ => __tests__}/Modal.test.tsx (100%) rename packages/ui-motion/src/Transition/{__new-tests__ => __tests__}/Transition.test.tsx (100%) rename packages/ui-navigation/src/AppNav/Item/{__new-tests__ => __tests__}/Item.test.tsx (100%) delete mode 100644 packages/ui-navigation/src/AppNav/Item/__tests__/theme.test.ts rename packages/ui-navigation/src/AppNav/{__new-tests__ => __tests__}/AppNav.test.tsx (100%) rename packages/ui-number-input/src/NumberInput/{__new-tests__ => __tests__}/NumberInput.test.tsx (100%) rename packages/ui-options/src/Options/Item/{__new-tests__ => __tests__}/Item.test.tsx (100%) delete mode 100644 packages/ui-options/src/Options/Item/__tests__/theme.test.ts rename packages/ui-options/src/Options/{__new-tests__ => __tests__}/Options.test.tsx (100%) delete mode 100644 packages/ui-options/src/Options/__tests__/theme.test.ts rename packages/ui-overlays/src/Mask/{__new-tests__ => __tests__}/Mask.test.tsx (100%) rename packages/ui-overlays/src/Overlay/{__new-tests__ => __tests__}/Overlay.test.tsx (100%) rename packages/ui-pages/src/Pages/Page/{__new-tests__ => __tests__}/Page.test.tsx (100%) rename packages/ui-pages/src/Pages/{__new-tests__ => __tests__}/Pages.test.tsx (100%) delete mode 100644 packages/ui-pages/src/Pages/__tests__/theme.test.ts rename packages/ui-pagination/src/Pagination/PaginationArrowButton/{__new-tests__ => __tests__}/PaginationArrowButton.test.tsx (100%) rename packages/ui-pagination/src/Pagination/PaginationButton/{__new-tests__ => __tests__}/PaginationButton.test.tsx (100%) rename packages/ui-pagination/src/Pagination/PaginationPageInput/{__new-tests__ => __tests__}/PaginationPageInput.test.tsx (100%) rename packages/ui-pagination/src/Pagination/{__new-tests__ => __tests__}/Pagination.test.tsx (100%) delete mode 100644 packages/ui-pill/src/Pill/PillLocator.ts rename packages/ui-pill/src/Pill/{__new-tests__ => __tests__}/Pill.test.tsx (100%) delete mode 100644 packages/ui-pill/src/Pill/__tests__/theme.test.ts delete mode 100644 packages/ui-pill/src/Pill/locator.ts delete mode 100644 packages/ui-popover/src/Popover/PopoverLocator.ts delete mode 100644 packages/ui-popover/src/Popover/PopoverTriggerLocator.ts rename packages/ui-popover/src/Popover/{__new-tests__ => __tests__}/Popover.test.tsx (100%) delete mode 100644 packages/ui-popover/src/Popover/locator.ts rename packages/ui-portal/src/Portal/{__new-tests__ => __tests__}/Portal.test.tsx (100%) delete mode 100644 packages/ui-position/src/Position/PositionContentLocator.ts delete mode 100644 packages/ui-position/src/Position/PositionLocator.ts delete mode 100644 packages/ui-position/src/Position/PositionTargetLocator.ts rename packages/ui-position/src/Position/{__new-tests__ => __tests__}/Position.test.tsx (100%) delete mode 100644 packages/ui-position/src/Position/locator.ts rename packages/ui-position/src/{__new-tests__ => __tests__}/mirrorHorizontalPlacement.test.tsx (100%) rename packages/ui-position/src/{__new-tests__ => __tests__}/mirrorPlacement.test.tsx (100%) rename packages/ui-progress/src/ProgressBar/{__new-tests__ => __tests__}/ProgressBar.test.tsx (100%) delete mode 100644 packages/ui-progress/src/ProgressBar/__tests__/theme.test.ts rename packages/ui-progress/src/ProgressCircle/{__new-tests__ => __tests__}/ProgressCircle.test.tsx (100%) delete mode 100644 packages/ui-progress/src/ProgressCircle/__tests__/theme.test.ts rename packages/ui-prop-types/src/{__new-tests__ => __tests__}/children.test.tsx (100%) rename packages/ui-prop-types/src/{__new-tests__ => __tests__}/childrenOrValue.test.tsx (100%) rename packages/ui-prop-types/src/{__new-tests__ => __tests__}/controllable.test.tsx (100%) rename packages/ui-prop-types/src/{__new-tests__ => __tests__}/makeRequirable.test.tsx (100%) rename packages/ui-prop-types/src/{__new-tests__ => __tests__}/xor.test.tsx (100%) rename packages/ui-radio-input/src/RadioInput/{__new-tests__ => __tests__}/RadioInput.test.tsx (100%) delete mode 100644 packages/ui-radio-input/src/RadioInput/__tests__/theme.test.ts rename packages/ui-radio-input/src/RadioInputGroup/{__new-tests__ => __tests__}/RadioInputGroup.test.tsx (100%) rename packages/ui-range-input/src/RangeInput/{__new-tests__ => __tests__}/RangeInput.test.tsx (100%) rename packages/ui-rating/src/Rating/{__new-tests__ => __tests__}/Rating.test.tsx (100%) rename packages/ui-rating/src/RatingIcon/{__new-tests__ => __tests__}/RatingIcon.test.tsx (100%) rename packages/ui-react-utils/src/{__new-tests__ => __tests__}/DeterministicIdContext.test.tsx (100%) rename packages/ui-react-utils/src/{__new-tests__ => __tests__}/callRenderProp.test.tsx (100%) rename packages/ui-react-utils/src/{__new-tests__ => __tests__}/deprecated.test.tsx (100%) rename packages/ui-react-utils/src/{__new-tests__ => __tests__}/experimental.test.tsx (100%) rename packages/ui-react-utils/src/{__new-tests__ => __tests__}/getInteraction.test.tsx (100%) rename packages/ui-react-utils/src/{__new-tests__ => __tests__}/hack.test.tsx (100%) rename packages/ui-react-utils/src/{__new-tests__ => __tests__}/omitProps.test.tsx (100%) rename packages/ui-react-utils/src/{__new-tests__ => __tests__}/passthroughProps.test.tsx (100%) rename packages/ui-react-utils/src/{__new-tests__ => __tests__}/pickProps.test.tsx (100%) rename packages/ui-react-utils/src/{__new-tests__ => __tests__}/safeCloneElement.test.tsx (100%) rename packages/ui-responsive/src/Responsive/{__new-tests__ => __tests__}/Responsive.test.tsx (100%) rename packages/ui-select/src/Select/{__new-tests__ => __tests__}/Select.test.tsx (100%) delete mode 100644 packages/ui-select/src/Select/__tests__/theme.test.ts rename packages/ui-selectable/src/Selectable/{__new-tests__ => __tests__}/Selectable.test.tsx (100%) rename packages/ui-side-nav-bar/src/SideNavBar/SideNavBarItem/{__new-tests__ => __tests__}/NavigationItem.test.tsx (100%) delete mode 100644 packages/ui-side-nav-bar/src/SideNavBar/SideNavBarItem/__tests__/theme.test.ts rename packages/ui-side-nav-bar/src/SideNavBar/{__new-tests__ => __tests__}/SideNavBar.test.tsx (100%) delete mode 100644 packages/ui-side-nav-bar/src/SideNavBar/__tests__/theme.test.ts rename packages/ui-simple-select/src/SimpleSelect/{__new-tests__ => __tests__}/SimpleSelect.test.tsx (100%) rename packages/ui-source-code-editor/src/SourceCodeEditor/{__new-tests__ => __tests__}/SourceCodeEditor.test.tsx (100%) rename packages/ui-spinner/src/Spinner/{__new-tests__ => __tests__}/Spinner.test.tsx (100%) delete mode 100644 packages/ui-spinner/src/Spinner/__tests__/theme.test.ts rename packages/ui-svg-images/src/InlineSVG/{__new-tests__ => __tests__}/InlineSVG.test.tsx (100%) rename packages/ui-svg-images/src/SVGIcon/{__new-tests__ => __tests__}/SVGIcon.test.tsx (100%) rename packages/ui-table/src/Table/{__new-tests__ => __tests__}/Table.test.tsx (100%) delete mode 100644 packages/ui-table/src/Table/__tests__/theme.test.ts rename packages/ui-tabs/src/Tabs/Panel/{__new-tests__ => __tests__}/Panel.test.tsx (100%) delete mode 100644 packages/ui-tabs/src/Tabs/Panel/__tests__/theme.test.ts rename packages/ui-tabs/src/Tabs/Tab/{__new-tests__ => __tests__}/Tab.test.tsx (100%) delete mode 100644 packages/ui-tabs/src/Tabs/Tab/__tests__/theme.test.ts rename packages/ui-tabs/src/Tabs/{__new-tests__ => __tests__}/Tabs.test.tsx (100%) rename packages/ui-tag/src/Tag/{__new-tests__ => __tests__}/Tag.test.tsx (100%) delete mode 100644 packages/ui-tag/src/Tag/__tests__/theme.test.ts rename packages/ui-test-utils/src/{__tests__ => __old-tests__}/assertions.test.tsx (100%) rename packages/ui-test-utils/src/{__tests__ => __old-tests__}/generateComponentExamples.test.tsx (99%) rename packages/ui-test-utils/src/{__tests__ => __old-tests__}/generatePropCombinations.test.ts (100%) rename packages/ui-test-utils/src/{__tests__ => __old-tests__}/locator.test.tsx (99%) rename packages/ui-test-utils/src/{__tests__ => __old-tests__}/queries.test.tsx (100%) rename packages/ui-test-utils/src/{__tests__ => __old-tests__}/reactComponentWrapper.test.tsx (100%) rename packages/ui-testable/src/{__tests__ => __old-tests__}/testable.test.tsx (100%) rename packages/ui-text-area/src/TextArea/{__new-tests__ => __tests__}/TextArea.test.tsx (100%) delete mode 100644 packages/ui-text-area/src/TextArea/__tests__/theme.test.ts rename packages/ui-text-input/src/TextInput/{__new-tests__ => __tests__}/TextInput.test.tsx (100%) delete mode 100644 packages/ui-text-input/src/TextInput/__tests__/theme.test.ts rename packages/ui-text/src/Text/{__new-tests__ => __tests__}/Text.test.tsx (100%) rename packages/ui-themes/src/{__new-tests__ => __tests__}/themes.test.tsx (100%) rename packages/ui-time-select/src/TimeSelect/{__new-tests__ => __tests__}/TimeSelect.test.tsx (100%) rename packages/ui-toggle-details/src/ToggleDetails/{__new-tests__ => __tests__}/ToggleDetails.test.tsx (100%) rename packages/ui-toggle-details/src/ToggleGroup/{__new-tests__ => __tests__}/ToggleGroup.test.tsx (100%) delete mode 100644 packages/ui-tooltip/src/Tooltip/TooltipLocator.ts rename packages/ui-tooltip/src/Tooltip/{__new-tests__ => __tests__}/Tooltip.test.tsx (100%) delete mode 100644 packages/ui-tooltip/src/Tooltip/locator.ts rename packages/ui-top-nav-bar/src/TopNavBar/TopNavBarActionItems/{__new-tests__ => __tests__}/TopNavBarActionItems.test.tsx (100%) delete mode 100644 packages/ui-top-nav-bar/src/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.ts delete mode 100644 packages/ui-top-nav-bar/src/TopNavBar/TopNavBarBrand/__examples__/TopNavBarBrand.examples.tsx delete mode 100644 packages/ui-top-nav-bar/src/TopNavBar/TopNavBarBrand/__tests__/TopNavBarBrand.test.tsx rename packages/ui-top-nav-bar/src/TopNavBar/TopNavBarBreadcrumb/{__new-tests__ => __tests__}/TopNavBarBreadcrumb.test.tsx (100%) rename packages/ui-top-nav-bar/src/TopNavBar/TopNavBarItem/{__new-tests__ => __tests__}/TopNavBarItem.test.tsx (100%) rename packages/ui-top-nav-bar/src/TopNavBar/TopNavBarLayout/DesktopLayout/{__new-tests__ => __tests__}/TopNavBarDesktopLayout.test.tsx (100%) rename packages/ui-top-nav-bar/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/{__new-tests__ => __tests__}/TopNavBarSmallViewportLayout.test.tsx (100%) rename packages/ui-top-nav-bar/src/TopNavBar/TopNavBarLayout/{__new-tests__ => __tests__}/TopNavBarLayout.test.tsx (100%) rename packages/ui-top-nav-bar/src/TopNavBar/TopNavBarMenuItems/{__new-tests__ => __tests__}/TopNavBarMenuItems.test.tsx (100%) rename packages/ui-top-nav-bar/src/TopNavBar/TopNavBarUser/{__new-tests__ => __tests__}/TopNavBarUser.test.tsx (100%) rename packages/ui-top-nav-bar/src/TopNavBar/{__new-tests__ => __tests__}/TopNavBar.test.tsx (100%) rename packages/ui-tray/src/Tray/{__new-tests__ => __tests__}/Tray.test.tsx (100%) rename packages/ui-tree-browser/src/TreeBrowser/TreeButton/{__new-tests__ => __tests__}/TreeButton.test.tsx (100%) rename packages/ui-tree-browser/src/TreeBrowser/TreeCollection/{__new-tests__ => __tests__}/TreeCollection.test.tsx (100%) rename packages/ui-tree-browser/src/TreeBrowser/TreeNode/{__new-tests__ => __tests__}/TreeNode.test.tsx (100%) rename packages/ui-tree-browser/src/TreeBrowser/{__new-tests__ => __tests__}/TreeBrowser.test.tsx (100%) rename packages/ui-truncate-list/src/TruncateList/{__new-tests__ => __tests__}/TruncateList.test.tsx (100%) rename packages/ui-truncate-text/src/TruncateText/{__new-tests__ => __tests__}/TruncateText.test.tsx (100%) rename packages/ui-truncate-text/src/TruncateText/utils/{__new-tests__ => __tests__}/cleanData.test.tsx (100%) rename packages/ui-truncate-text/src/TruncateText/utils/{__new-tests__ => __tests__}/cleanString.test.tsx (100%) rename packages/ui-truncate-text/src/TruncateText/utils/{__new-tests__ => __tests__}/measureText.test.tsx (100%) rename packages/ui-utils/src/{__new-tests__ => __tests__}/camelize.test.tsx (100%) rename packages/ui-utils/src/{__new-tests__ => __tests__}/cloneArray.test.tsx (100%) rename packages/ui-utils/src/{__new-tests__ => __tests__}/createChainedFunction.test.tsx (100%) rename packages/ui-utils/src/{__new-tests__ => __tests__}/generateId.test.tsx (100%) rename packages/ui-utils/src/{__new-tests__ => __tests__}/hash.test.tsx (100%) rename packages/ui-utils/src/{__new-tests__ => __tests__}/mergeDeep.test.tsx (100%) rename packages/ui-utils/src/{__new-tests__ => __tests__}/ms.test.tsx (100%) rename packages/ui-utils/src/{__new-tests__ => __tests__}/parseUnit.test.tsx (100%) rename packages/ui-utils/src/{__new-tests__ => __tests__}/pascalize.test.tsx (100%) rename packages/ui-utils/src/{__new-tests__ => __tests__}/px.test.tsx (100%) rename packages/ui-utils/src/{__new-tests__ => __tests__}/within.test.tsx (100%) rename packages/ui-view/src/ContextView/{__new-tests__ => __tests__}/ContextView.test.tsx (100%) rename packages/ui-view/src/View/{__new-tests__ => __tests__}/View.test.tsx (100%) delete mode 100644 packages/ui-view/src/View/__tests__/theme.test.ts rename packages/uid/src/{__new-tests__ => __tests__}/uid.test.tsx (100%) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 432e0168ea..4c6cc1d9b7 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -35,8 +35,6 @@ jobs: run: npm run bootstrap - name: Run vitest unit tests run: npm run test:vitest - - name: Run codemods unit tests - run: npm run test:codemods cypress: name: Cypress component tests runs-on: ubuntu-latest @@ -52,18 +50,4 @@ jobs: run: npm run bootstrap - name: Run Cypress components tests run: npm run cy:component - legacy-tests: - name: Legacy unit tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: '22' - cache: 'npm' - - name: Install dependencies - run: npm ci - - name: Bootstrap project - run: npm run bootstrap - - name: Run legacy unit tests - run: npm run test + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 52825380d4..cce083bf24 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: - name: Set up project. run: npm run bootstrap - name: Run tests. - run: USE_REACT_STRICT_MODE=0 npm run test && npm run test:vitest + run: USE_REACT_STRICT_MODE=0 npm run test:vitest - name: Release to NPM env: NPM_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/eslint.config.mjs b/eslint.config.mjs index 3be8d2d44b..bd879d6c21 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -168,8 +168,7 @@ const finalConfig = tseslint.config( { // Vitest tests files: [ - '**/__new-tests__/**', - 'packages/ui-codemods/__tests__/*' + '**/__tests__/**' ], plugins: { vitest @@ -182,7 +181,6 @@ const finalConfig = tseslint.config( }, { // Do not check unit tests for a11y ignores: [ - '**/__new-tests__/**', '**/__tests__/**' ], plugins: { diff --git a/package-lock.json b/package-lock.json index 1fb3f31721..7704a90c88 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35453,7 +35453,6 @@ "@instructure/ui-axe-check": "10.19.1", "@instructure/ui-babel-preset": "10.19.1", "@instructure/ui-color-utils": "10.19.1", - "@instructure/ui-test-locator": "10.19.1", "@instructure/ui-test-utils": "10.19.1", "@instructure/ui-themes": "10.19.1", "@testing-library/jest-dom": "^6.6.3", @@ -38712,7 +38711,6 @@ }, "devDependencies": { "@instructure/ui-babel-preset": "10.19.1", - "@instructure/ui-test-utils": "10.19.1", "@types/tinycolor2": "^1.4.6" } }, @@ -47515,8 +47513,6 @@ "@instructure/ui-color-utils": "10.19.1", "@instructure/ui-icons": "10.19.1", "@instructure/ui-scripts": "10.19.1", - "@instructure/ui-test-locator": "10.19.1", - "@instructure/ui-test-queries": "10.19.1", "@instructure/ui-test-utils": "10.19.1", "@instructure/ui-themes": "10.19.1", "@testing-library/jest-dom": "^6.6.3", @@ -47830,8 +47826,6 @@ "devDependencies": { "@instructure/ui-babel-preset": "10.19.1", "@instructure/ui-color-utils": "10.19.1", - "@instructure/ui-test-locator": "10.19.1", - "@instructure/ui-test-queries": "10.19.1", "@instructure/ui-test-utils": "10.19.1", "@testing-library/jest-dom": "^6.6.3", "@testing-library/react": "^16.0.1", @@ -48443,7 +48437,6 @@ "devDependencies": { "@instructure/ui-babel-preset": "10.19.1", "@instructure/ui-color-utils": "10.19.1", - "@instructure/ui-test-locator": "10.19.1", "@instructure/ui-test-utils": "10.19.1", "@instructure/ui-themes": "10.19.1", "@testing-library/jest-dom": "^6.6.3", @@ -55999,8 +55992,6 @@ "@instructure/ui-babel-preset": "10.19.1", "@instructure/ui-color-utils": "10.19.1", "@instructure/ui-scripts": "10.19.1", - "@instructure/ui-test-locator": "10.19.1", - "@instructure/ui-test-queries": "10.19.1", "@instructure/ui-test-utils": "10.19.1", "@instructure/ui-themes": "10.19.1", "@testing-library/jest-dom": "^6.6.3", @@ -56324,7 +56315,6 @@ "@instructure/ui-babel-preset": "10.19.1", "@instructure/ui-color-utils": "10.19.1", "@instructure/ui-scripts": "10.19.1", - "@instructure/ui-test-locator": "10.19.1", "@instructure/ui-test-utils": "10.19.1", "@instructure/ui-themes": "10.19.1", "@testing-library/jest-dom": "^6.6.3", @@ -57268,7 +57258,6 @@ "@instructure/ui-axe-check": "10.19.1", "@instructure/ui-babel-preset": "10.19.1", "@instructure/ui-color-utils": "10.19.1", - "@instructure/ui-test-queries": "10.19.1", "@instructure/ui-test-utils": "10.19.1", "@instructure/ui-themes": "10.19.1", "@testing-library/jest-dom": "^6.6.3", diff --git a/package.json b/package.json index 844254aa03..557a3e0cd8 100644 --- a/package.json +++ b/package.json @@ -18,11 +18,9 @@ "start": "npm run start --workspace=docs-app", "start:watch": "npm run start:watch --workspace=docs-app", "dev": "npm run start:watch", - "test": "ui-scripts test --randomize", "cy:component": "cypress run --component", "test:vitest": "vitest --watch=false", "test:vitest-watch": "vitest", - "test:codemods": "vitest --watch=false --root=packages/ui-codemods", "lint": "lerna run lint --stream", "lint:changes": "npm run lint -- --since HEAD^", "lint:fix": "lerna run lint:fix --stream", diff --git a/packages/emotion/src/InstUISettingsProvider/__tests__/InstUISettingProvider.test.tsx b/packages/emotion/src/InstUISettingsProvider/__old-tests__/InstUISettingProvider.test.tsx similarity index 100% rename from packages/emotion/src/InstUISettingsProvider/__tests__/InstUISettingProvider.test.tsx rename to packages/emotion/src/InstUISettingsProvider/__old-tests__/InstUISettingProvider.test.tsx diff --git a/packages/emotion/src/InstUISettingsProvider/__new-tests__/InstUISettingsProvider.test.tsx b/packages/emotion/src/InstUISettingsProvider/__tests__/InstUISettingsProvider.test.tsx similarity index 100% rename from packages/emotion/src/InstUISettingsProvider/__new-tests__/InstUISettingsProvider.test.tsx rename to packages/emotion/src/InstUISettingsProvider/__tests__/InstUISettingsProvider.test.tsx diff --git a/packages/emotion/src/__tests__/getComponentThemeOverride.test.ts b/packages/emotion/src/__old-tests__/getComponentThemeOverride.test.ts similarity index 100% rename from packages/emotion/src/__tests__/getComponentThemeOverride.test.ts rename to packages/emotion/src/__old-tests__/getComponentThemeOverride.test.ts diff --git a/packages/emotion/src/__tests__/useStyle.test.tsx b/packages/emotion/src/__old-tests__/useStyle.test.tsx similarity index 100% rename from packages/emotion/src/__tests__/useStyle.test.tsx rename to packages/emotion/src/__old-tests__/useStyle.test.tsx diff --git a/packages/emotion/src/__tests__/useTheme.test.tsx b/packages/emotion/src/__old-tests__/useTheme.test.tsx similarity index 100% rename from packages/emotion/src/__tests__/useTheme.test.tsx rename to packages/emotion/src/__old-tests__/useTheme.test.tsx diff --git a/packages/emotion/src/__tests__/withStyle.test.tsx b/packages/emotion/src/__old-tests__/withStyle.test.tsx similarity index 100% rename from packages/emotion/src/__tests__/withStyle.test.tsx rename to packages/emotion/src/__old-tests__/withStyle.test.tsx diff --git a/packages/emotion/src/styleUtils/__tests__/getShorthandPropValue.test.ts b/packages/emotion/src/styleUtils/__old-tests__/getShorthandPropValue.test.ts similarity index 100% rename from packages/emotion/src/styleUtils/__tests__/getShorthandPropValue.test.ts rename to packages/emotion/src/styleUtils/__old-tests__/getShorthandPropValue.test.ts diff --git a/packages/emotion/src/styleUtils/__tests__/makeThemeVars.test.ts b/packages/emotion/src/styleUtils/__old-tests__/makeThemeVars.test.ts similarity index 100% rename from packages/emotion/src/styleUtils/__tests__/makeThemeVars.test.ts rename to packages/emotion/src/styleUtils/__old-tests__/makeThemeVars.test.ts diff --git a/packages/emotion/src/styleUtils/__tests__/mirrorShorthand.test.ts b/packages/emotion/src/styleUtils/__old-tests__/mirrorShorthand.test.ts similarity index 100% rename from packages/emotion/src/styleUtils/__tests__/mirrorShorthand.test.ts rename to packages/emotion/src/styleUtils/__old-tests__/mirrorShorthand.test.ts diff --git a/packages/theme-registry/src/__tests__/ThemeRegistry.test.ts b/packages/theme-registry/src/__old-tests__/ThemeRegistry.test.ts similarity index 100% rename from packages/theme-registry/src/__tests__/ThemeRegistry.test.ts rename to packages/theme-registry/src/__old-tests__/ThemeRegistry.test.ts diff --git a/packages/ui-a11y-content/src/AccessibleContent/__new-tests__/AccessibleContent.test.tsx b/packages/ui-a11y-content/src/AccessibleContent/__tests__/AccessibleContent.test.tsx similarity index 100% rename from packages/ui-a11y-content/src/AccessibleContent/__new-tests__/AccessibleContent.test.tsx rename to packages/ui-a11y-content/src/AccessibleContent/__tests__/AccessibleContent.test.tsx diff --git a/packages/ui-a11y-content/src/PresentationContent/__new-tests__/PresentationContent.test.tsx b/packages/ui-a11y-content/src/PresentationContent/__tests__/PresentationContent.test.tsx similarity index 100% rename from packages/ui-a11y-content/src/PresentationContent/__new-tests__/PresentationContent.test.tsx rename to packages/ui-a11y-content/src/PresentationContent/__tests__/PresentationContent.test.tsx diff --git a/packages/ui-a11y-content/src/ScreenReaderContent/__new-tests__/ScreenReaderContent.test.tsx b/packages/ui-a11y-content/src/ScreenReaderContent/__tests__/ScreenReaderContent.test.tsx similarity index 100% rename from packages/ui-a11y-content/src/ScreenReaderContent/__new-tests__/ScreenReaderContent.test.tsx rename to packages/ui-a11y-content/src/ScreenReaderContent/__tests__/ScreenReaderContent.test.tsx diff --git a/packages/ui-a11y-utils/src/__new-tests__/FocusRegionManager.test.tsx b/packages/ui-a11y-utils/src/__tests__/FocusRegionManager.test.tsx similarity index 100% rename from packages/ui-a11y-utils/src/__new-tests__/FocusRegionManager.test.tsx rename to packages/ui-a11y-utils/src/__tests__/FocusRegionManager.test.tsx diff --git a/packages/ui-a11y-utils/src/__new-tests__/ScreenReaderFocusRegion.test.tsx b/packages/ui-a11y-utils/src/__tests__/ScreenReaderFocusRegion.test.tsx similarity index 100% rename from packages/ui-a11y-utils/src/__new-tests__/ScreenReaderFocusRegion.test.tsx rename to packages/ui-a11y-utils/src/__tests__/ScreenReaderFocusRegion.test.tsx diff --git a/packages/ui-a11y-utils/src/__new-tests__/hasVisibleChildren.test.tsx b/packages/ui-a11y-utils/src/__tests__/hasVisibleChildren.test.tsx similarity index 100% rename from packages/ui-a11y-utils/src/__new-tests__/hasVisibleChildren.test.tsx rename to packages/ui-a11y-utils/src/__tests__/hasVisibleChildren.test.tsx diff --git a/packages/ui-a11y-utils/src/__new-tests__/scopeTab.test.tsx b/packages/ui-a11y-utils/src/__tests__/scopeTab.test.tsx similarity index 100% rename from packages/ui-a11y-utils/src/__new-tests__/scopeTab.test.tsx rename to packages/ui-a11y-utils/src/__tests__/scopeTab.test.tsx diff --git a/packages/ui-alerts/src/Alert/__new-tests__/Alert.test.tsx b/packages/ui-alerts/src/Alert/__tests__/Alert.test.tsx similarity index 100% rename from packages/ui-alerts/src/Alert/__new-tests__/Alert.test.tsx rename to packages/ui-alerts/src/Alert/__tests__/Alert.test.tsx diff --git a/packages/ui-alerts/src/Alert/__tests__/theme.test.ts b/packages/ui-alerts/src/Alert/__tests__/theme.test.ts deleted file mode 100644 index b5a483c076..0000000000 --- a/packages/ui-alerts/src/Alert/__tests__/theme.test.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('Alert.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - describe('default', () => { - it('should ensure text color and background color meet 3:1 contrast', () => { - expect(contrast(variables.color, variables.background)).to.be.above(3) - }) - }) - }) - - describe('with the "canvas-high-contrast" theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - describe('default', () => { - it('should ensure text color and background color meet 3:1 contrast', () => { - expect(contrast(variables.color, variables.background)).to.be.above(4.5) - }) - }) - }) -}) diff --git a/packages/ui-avatar/package.json b/packages/ui-avatar/package.json index 65388329ed..2b654d2933 100644 --- a/packages/ui-avatar/package.json +++ b/packages/ui-avatar/package.json @@ -36,7 +36,6 @@ "@instructure/ui-axe-check": "10.19.1", "@instructure/ui-babel-preset": "10.19.1", "@instructure/ui-color-utils": "10.19.1", - "@instructure/ui-test-locator": "10.19.1", "@instructure/ui-test-utils": "10.19.1", "@instructure/ui-themes": "10.19.1", "@testing-library/jest-dom": "^6.6.3", diff --git a/packages/ui-avatar/src/Avatar/__new-tests__/Avatar.test.tsx b/packages/ui-avatar/src/Avatar/__new-tests__/Avatar.test.tsx deleted file mode 100644 index 4d6a66c44f..0000000000 --- a/packages/ui-avatar/src/Avatar/__new-tests__/Avatar.test.tsx +++ /dev/null @@ -1,291 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { fireEvent, render, screen } from '@testing-library/react' -import { vi } from 'vitest' -import { runAxeCheck } from '@instructure/ui-axe-check' - -import '@testing-library/jest-dom' -import Avatar from '../index' -import { IconGroupLine } from '@instructure/ui-icons' -import { View } from '@instructure/ui-view' - -describe('', () => { - describe('for a11y', () => { - it('should be accessible', async () => { - const { container } = render() - const axeCheck = await runAxeCheck(container) - expect(axeCheck).toBe(true) - }) - - it('initials should have aria-hidden=true', async () => { - render() - const initials = screen.getByText('JJ') - expect(initials).toHaveAttribute('aria-hidden', 'true') - }) - }) - - describe('with the default props', () => { - it('should display as a circle', async () => { - const { container } = render() - const avatarImg = container.querySelector('span[name="Avatar Name"]') - expect(avatarImg).toHaveAttribute('shape', 'circle') - }) - - it('should render initials', async () => { - render() - const avatarWithInitials = await screen.findByText('AN') - expect(avatarWithInitials).toBeVisible() - }) - - it('should have border and no box-shadow', async () => { - const { container } = render() - const element = container.querySelector('span') - expect(element).not.toHaveStyle('border-width: 0px') - const containerStyle = element && getComputedStyle(element) - expect(containerStyle?.boxShadow).toBe('') - }) - - it('should display the initials in brand color', async () => { - render() - const initials = screen.getByText('JJ') - expect(getComputedStyle(initials).color).toBe('rgb(43, 122, 188)') - }) - - it('refs should return the underlying component', async () => { - const elementRef = vi.fn() - const ref: React.Ref = { current: null } - const { container } = render( - <> - - - - ) - expect(ref.current!.props.id).toBe('av2') - expect(elementRef).toHaveBeenCalledWith(container.querySelector('#av1')) - }) - }) - - describe('when the renderIcon prop is provided', () => { - it('should display an svg passed', async () => { - const SomeIcon = () => ( - - - - ) - const { container } = render( - - hello - - ) - const avatarSvg = container.querySelector('svg') - expect(avatarSvg).toBeInTheDocument() - }) - - it('should display an InstUI icon passed', async () => { - const { container } = render( - }> - hello - - ) - const avatarSvg = container.querySelector('svg') - expect(avatarSvg).toBeInTheDocument() - }) - - it('should display correctly when an icon renderer is passed', async () => { - const { container } = render( - }> - Hello World - - ) - const avatarSvg = container.querySelector('svg') - expect(avatarSvg).toBeInTheDocument() - }) - }) - - describe('when an image src url is provided', () => { - const src = - 'data:image/gif;base64,R0lGODlhFAAUAJEAAP/9/fYQEPytrflWViH5BAAAAAAALAAAAAAUABQAQAJKhI+pGe09lnhBnEETfodatVHNh1BR+ZzH9LAOCYrVYpiAfWWJOxrC/5MASbyZT4d6AUIBlUYGoR1FsAXUuTN5YhxAEYbrpKRkQwEAOw==' - - it('should display the image url provided', async () => { - const { container } = render() - const avatarImg = container.querySelector('img') - expect(avatarImg).toHaveAttribute('src', src) - }) - - it('should display the image even if an icon is provided', async () => { - const { container } = render( - } /> - ) - const avatarImg = container.querySelector('img') - expect(avatarImg).toHaveAttribute('src', src) - }) - - it('should call onImageLoaded once the image loads', async () => { - const onImageLoaded = vi.fn() - const { container } = render( - - ) - const avatarImg = container.querySelector('img') - if (avatarImg) { - fireEvent.load(avatarImg) - } - expect(onImageLoaded).toHaveBeenCalled() - }) - - it('should have box-shadow instead of border', async () => { - const { container } = render() - const element = container.querySelector('span') - const avatarImg = container.querySelector('img') - if (avatarImg) { - fireEvent.load(avatarImg) - } - expect(element).toHaveStyle('border-width: 0px') - const containerStyle = element && window.getComputedStyle(element) - expect(containerStyle?.boxShadow).not.toBe('') - }) - }) - - describe('when shape is set to "rectangle"', () => { - it('should display as a rectangle', async () => { - const { container } = render( - - ) - const avatarImg = container.querySelector('span[name="Avatar Name"]') - expect(avatarImg).toHaveAttribute('shape', 'rectangle') - }) - }) - - describe('when the color is set to "shamrock"', () => { - it('should display the initials in green (shamrock)', async () => { - render() - const initials = screen.getByText('JJ') - expect(getComputedStyle(initials).color).toBe('rgb(3, 137, 61)') - }) - - it('should display the icon in green (shamrock)', async () => { - const { container } = render( - } - color="fire" - > - Hello World - - ) - const avatarSvg = container.querySelector('svg') - expect(avatarSvg).toHaveStyle({ fill: '#CF4A00' }) - }) - }) - - describe('when "hasInverseColor" is set', () => { - describe('with initials', () => { - it('should display the background in the color', async () => { - render() - const initials = screen.getByText('JJ') - expect(initials.parentNode).toHaveStyle({ - backgroundColor: 'rgb(3, 137, 61)' - }) - }) - - it('should display the initials in white', async () => { - render() - const initials = screen.getByText('JJ') - expect(initials).toHaveStyle({ color: 'rgb(255, 255, 255)' }) - }) - }) - - describe('with icon', () => { - it('should display the background in the color', async () => { - const { container } = render( - } - /> - ) - const element = container.querySelector('span') - expect(element).toHaveStyle({ backgroundColor: 'rgb(3, 137, 61)' }) - }) - - it('should display the icon in white', async () => { - const { container } = render( - } - hasInverseColor - color="fire" - > - Hello World - - ) - const avatarSvg = container.querySelector('svg') - expect(avatarSvg).toHaveStyle({ fill: '#FFFFFF' }) - }) - }) - }) - - describe('when the user name has no spaces', () => { - it('should render a single initial', async () => { - render() - const initials = screen.getByText('J') - expect(initials).toBeInTheDocument() - }) - }) - - describe('when the user name has leading spaces', () => { - it('should skip them', async () => { - render() - const initials = screen.getByText('JJ') - expect(initials).toBeInTheDocument() - }) - }) - - describe('when the user name is empty', () => { - it('should render', async () => { - const { container } = render() - const initials = container.querySelector('[class$="-avatar__initials"]') - expect(initials).toBeInTheDocument() - expect(initials).toHaveTextContent('') - }) - }) - - describe('when alt text is provided', () => { - it('should render the text as an aria-label attribute', async () => { - render() - const initials = screen.getByText('JJ') - expect(initials.parentNode).toHaveAttribute( - 'aria-label', - 'This is a test' - ) - }) - - it('should set the role attribute to img', async () => { - render() - const initials = screen.getByText('JJ') - expect(initials.parentNode).toHaveAttribute('role', 'img') - }) - }) -}) diff --git a/packages/ui-avatar/src/Avatar/__tests__/Avatar.test.tsx b/packages/ui-avatar/src/Avatar/__tests__/Avatar.test.tsx index 27d0eab095..4d6a66c44f 100644 --- a/packages/ui-avatar/src/Avatar/__tests__/Avatar.test.tsx +++ b/packages/ui-avatar/src/Avatar/__tests__/Avatar.test.tsx @@ -22,246 +22,203 @@ * SOFTWARE. */ -import { expect, mount, stub } from '@instructure/ui-test-utils' +import { fireEvent, render, screen } from '@testing-library/react' +import { vi } from 'vitest' +import { runAxeCheck } from '@instructure/ui-axe-check' +import '@testing-library/jest-dom' +import Avatar from '../index' import { IconGroupLine } from '@instructure/ui-icons' +import { View } from '@instructure/ui-view' -import { Avatar } from '../index' -import { AvatarLocator } from '../AvatarLocator' - -describe.skip('', async () => { - describe('for a11y', async () => { +describe('', () => { + describe('for a11y', () => { it('should be accessible', async () => { - await mount() - - const avatar = await AvatarLocator.find() - - expect(await avatar.accessible()).to.be.true() + const { container } = render() + const axeCheck = await runAxeCheck(container) + expect(axeCheck).toBe(true) }) it('initials should have aria-hidden=true', async () => { - await mount() - - const avatar = await AvatarLocator.find() - const initials = await avatar.findWithText('JJ') - - expect(initials.getAttribute('aria-hidden')).to.equal('true') + render() + const initials = screen.getByText('JJ') + expect(initials).toHaveAttribute('aria-hidden', 'true') }) }) - describe('with the default props', async () => { + describe('with the default props', () => { it('should display as a circle', async () => { - await mount() - const avatar = await AvatarLocator.find() - - expect(avatar.getAttribute('shape')).to.equal('circle') + const { container } = render() + const avatarImg = container.querySelector('span[name="Avatar Name"]') + expect(avatarImg).toHaveAttribute('shape', 'circle') }) it('should render initials', async () => { - await mount() - - expect(await AvatarLocator.findWithText('JJ')).to.exist() + render() + const avatarWithInitials = await screen.findByText('AN') + expect(avatarWithInitials).toBeVisible() }) it('should have border and no box-shadow', async () => { - const subject = await mount() - - const avatar = subject.getDOMNode() - const computedStyle = getComputedStyle(avatar) - - expect(computedStyle.borderWidth).not.to.equal('0px') - expect(computedStyle.boxShadow).to.equal('none') + const { container } = render() + const element = container.querySelector('span') + expect(element).not.toHaveStyle('border-width: 0px') + const containerStyle = element && getComputedStyle(element) + expect(containerStyle?.boxShadow).toBe('') }) it('should display the initials in brand color', async () => { - await mount() - - const avatar = await AvatarLocator.find() - const initials = await avatar.findWithText('JJ') - - expect(getComputedStyle(initials.getDOMNode()).color).to.equal( - 'rgb(3, 116, 181)' - ) + render() + const initials = screen.getByText('JJ') + expect(getComputedStyle(initials).color).toBe('rgb(43, 122, 188)') }) - it('should return the underlying component', async () => { - const elementRef = stub() - const subject = await mount( - + it('refs should return the underlying component', async () => { + const elementRef = vi.fn() + const ref: React.Ref = { current: null } + const { container } = render( + <> + + + ) - expect(elementRef).to.have.been.calledWith(subject.getDOMNode()) + expect(ref.current!.props.id).toBe('av2') + expect(elementRef).toHaveBeenCalledWith(container.querySelector('#av1')) }) }) - describe('when the renderIcon prop is provided', async () => { + describe('when the renderIcon prop is provided', () => { it('should display an svg passed', async () => { const SomeIcon = () => ( ) - - await mount( - - Hello World + const { container } = render( + + hello ) - const avatar = await AvatarLocator.find() - expect(await avatar.find('svg')).to.exist() + const avatarSvg = container.querySelector('svg') + expect(avatarSvg).toBeInTheDocument() }) it('should display an InstUI icon passed', async () => { - await mount( - }> - Hello World + const { container } = render( + }> + hello ) - const avatar = await AvatarLocator.find() - expect(await avatar.find('svg')).to.exist() + const avatarSvg = container.querySelector('svg') + expect(avatarSvg).toBeInTheDocument() }) it('should display correctly when an icon renderer is passed', async () => { - await mount( + const { container } = render( }> Hello World ) - const avatar = await AvatarLocator.find() - expect(await avatar.find('svg')).to.exist() + const avatarSvg = container.querySelector('svg') + expect(avatarSvg).toBeInTheDocument() }) }) - describe('when an image src url is provided', async () => { + describe('when an image src url is provided', () => { const src = 'data:image/gif;base64,R0lGODlhFAAUAJEAAP/9/fYQEPytrflWViH5BAAAAAAALAAAAAAUABQAQAJKhI+pGe09lnhBnEETfodatVHNh1BR+ZzH9LAOCYrVYpiAfWWJOxrC/5MASbyZT4d6AUIBlUYGoR1FsAXUuTN5YhxAEYbrpKRkQwEAOw==' it('should display the image url provided', async () => { - await mount() - - const avatar = await AvatarLocator.find() - const image = await avatar.find('img') - - await image.load() - - expect(avatar.getAttribute('src')).to.contain(src) + const { container } = render() + const avatarImg = container.querySelector('img') + expect(avatarImg).toHaveAttribute('src', src) }) it('should display the image even if an icon is provided', async () => { - await mount( - } /> + const { container } = render( + } /> ) - - const avatar = await AvatarLocator.find() - const image = await avatar.find('img') - - await image.load() - - expect(avatar.getAttribute('src')).to.contain(src) + const avatarImg = container.querySelector('img') + expect(avatarImg).toHaveAttribute('src', src) }) it('should call onImageLoaded once the image loads', async () => { - const onImageLoaded = stub() - - await mount( - + const onImageLoaded = vi.fn() + const { container } = render( + ) - - const avatar = await AvatarLocator.find() - const image = await avatar.find('img') - - await image.load() - - expect(onImageLoaded).to.have.been.called() + const avatarImg = container.querySelector('img') + if (avatarImg) { + fireEvent.load(avatarImg) + } + expect(onImageLoaded).toHaveBeenCalled() }) it('should have box-shadow instead of border', async () => { - const subject = await mount() - - const avatar = await AvatarLocator.find() - const image = await avatar.find('img') - - await image.load() - - const computedStyle = getComputedStyle(subject.getDOMNode()) - - expect(computedStyle.borderWidth).to.equal('0px') - expect(computedStyle.boxShadow).not.to.equal('none') + const { container } = render() + const element = container.querySelector('span') + const avatarImg = container.querySelector('img') + if (avatarImg) { + fireEvent.load(avatarImg) + } + expect(element).toHaveStyle('border-width: 0px') + const containerStyle = element && window.getComputedStyle(element) + expect(containerStyle?.boxShadow).not.toBe('') }) }) - describe('when shape is set to "rectangle"', async () => { + describe('when shape is set to "rectangle"', () => { it('should display as a rectangle', async () => { - await mount() - - const avatar = await AvatarLocator.find() - - expect(avatar.getAttribute('shape')).to.equal('rectangle') + const { container } = render( + + ) + const avatarImg = container.querySelector('span[name="Avatar Name"]') + expect(avatarImg).toHaveAttribute('shape', 'rectangle') }) }) - describe('when the color is set to "shamrock"', async () => { + describe('when the color is set to "shamrock"', () => { it('should display the initials in green (shamrock)', async () => { - await mount() - - const avatar = await AvatarLocator.find() - const initials = await avatar.findWithText('JJ') - - expect(getComputedStyle(initials.getDOMNode()).color).to.equal( - 'rgb(11, 135, 75)' - ) + render() + const initials = screen.getByText('JJ') + expect(getComputedStyle(initials).color).toBe('rgb(3, 137, 61)') }) it('should display the icon in green (shamrock)', async () => { - await mount( + const { container } = render( } - color="shamrock" + color="fire" > Hello World ) - - const avatar = await AvatarLocator.find() - const svg = await avatar.find('svg') - - expect(getComputedStyle(svg.getDOMNode()).fill).to.equal( - 'rgb(11, 135, 75)' - ) + const avatarSvg = container.querySelector('svg') + expect(avatarSvg).toHaveStyle({ fill: '#CF4A00' }) }) }) - describe('when "hasInverseColor" is set', async () => { - describe('with initials', async () => { + describe('when "hasInverseColor" is set', () => { + describe('with initials', () => { it('should display the background in the color', async () => { - await mount( - - ) - - const avatar = await AvatarLocator.find() - - expect(getComputedStyle(avatar.getDOMNode()).backgroundColor).to.equal( - 'rgb(11, 135, 75)' - ) + render() + const initials = screen.getByText('JJ') + expect(initials.parentNode).toHaveStyle({ + backgroundColor: 'rgb(3, 137, 61)' + }) }) it('should display the initials in white', async () => { - await mount( - - ) - - const avatar = await AvatarLocator.find() - const initials = await avatar.findWithText('JJ') - - expect(getComputedStyle(initials.getDOMNode()).color).to.equal( - 'rgb(255, 255, 255)' - ) + render() + const initials = screen.getByText('JJ') + expect(initials).toHaveStyle({ color: 'rgb(255, 255, 255)' }) }) }) - describe('with icon', async () => { + describe('with icon', () => { it('should display the background in the color', async () => { - await mount( + const { container } = render( ', async () => { renderIcon={} /> ) - - const avatar = await AvatarLocator.find() - - expect(getComputedStyle(avatar.getDOMNode()).backgroundColor).to.equal( - 'rgb(11, 135, 75)' - ) + const element = container.querySelector('span') + expect(element).toHaveStyle({ backgroundColor: 'rgb(3, 137, 61)' }) }) it('should display the icon in white', async () => { - await mount( + const { container } = render( } - /> - ) - - const avatar = await AvatarLocator.find() - const svg = await avatar.find('svg') - - expect(getComputedStyle(svg.getDOMNode()).fill).to.equal( - 'rgb(255, 255, 255)' + hasInverseColor + color="fire" + > + Hello World + ) + const avatarSvg = container.querySelector('svg') + expect(avatarSvg).toHaveStyle({ fill: '#FFFFFF' }) }) }) }) - describe('when the user name has no spaces', async () => { + describe('when the user name has no spaces', () => { it('should render a single initial', async () => { - await mount() - - expect(await AvatarLocator.find()).to.have.text('J') + render() + const initials = screen.getByText('J') + expect(initials).toBeInTheDocument() }) }) - describe('when the user name has leading spaces', async () => { + describe('when the user name has leading spaces', () => { it('should skip them', async () => { - await mount() - - expect(await AvatarLocator.find()).to.have.text('JJ') + render() + const initials = screen.getByText('JJ') + expect(initials).toBeInTheDocument() }) }) - describe('when the user name is empty', async () => { + describe('when the user name is empty', () => { it('should render', async () => { - await mount() - - const avatar = await AvatarLocator.find() - const initials = await avatar.find('[class$="-avatar__initials"]') - - expect(initials).to.exist() - expect(initials.getTextContent()).to.equal('') + const { container } = render() + const initials = container.querySelector('[class$="-avatar__initials"]') + expect(initials).toBeInTheDocument() + expect(initials).toHaveTextContent('') }) }) - describe('when alt text is provided', async () => { + describe('when alt text is provided', () => { it('should render the text as an aria-label attribute', async () => { - await mount() - - expect(await AvatarLocator.find()).to.have.label('This is a test') + render() + const initials = screen.getByText('JJ') + expect(initials.parentNode).toHaveAttribute( + 'aria-label', + 'This is a test' + ) }) it('should set the role attribute to img', async () => { - await mount() - expect(await AvatarLocator.find()).to.contain('[role="img"]') + render() + const initials = screen.getByText('JJ') + expect(initials.parentNode).toHaveAttribute('role', 'img') }) }) }) diff --git a/packages/ui-avatar/src/Avatar/__tests__/theme.test.ts b/packages/ui-avatar/src/Avatar/__tests__/theme.test.ts deleted file mode 100644 index 1cfc5ada29..0000000000 --- a/packages/ui-avatar/src/Avatar/__tests__/theme.test.ts +++ /dev/null @@ -1,147 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('Avatar.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - describe('default color', () => { - it('should ensure background color and text color meet 3:1 contrast', () => { - expect(contrast(variables.background, variables.color)).to.be.above(3) - }) - }) - - describe('colorShamrock', () => { - it('should ensure background color and text color meet 3:1 contrast', () => { - expect( - contrast(variables.background, variables.colorShamrock) - ).to.be.above(3) - }) - }) - - describe('colorBarney', () => { - it('should ensure background color and text color meet 3:1 contrast', () => { - expect( - contrast(variables.background, variables.colorBarney) - ).to.be.above(3) - }) - }) - - describe('colorCrimson', () => { - it('should ensure background color and text color meet 3:1 contrast', () => { - expect( - contrast(variables.background, variables.colorCrimson) - ).to.be.above(3) - }) - }) - - describe('colorFire', () => { - it('should ensure background color and text color meet 3:1 contrast', () => { - expect(contrast(variables.background, variables.colorFire)).to.be.above( - 3 - ) - }) - }) - - describe('colorLicorice', () => { - it('should ensure background color and text color meet 3:1 contrast', () => { - expect( - contrast(variables.background, variables.colorLicorice) - ).to.be.above(3) - }) - }) - - describe('colorAsh', () => { - it('should ensure background color and text color meet 3:1 contrast', () => { - expect(contrast(variables.background, variables.colorAsh)).to.be.above( - 3 - ) - }) - }) - }) - - describe('with the "canvas-high-contrast" theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - describe('default color', () => { - it('should ensure background color and text color meet 4.5:1 contrast', () => { - expect(contrast(variables.background, variables.color)).to.be.above(4.5) - }) - }) - - describe('colorShamrock', () => { - it('should ensure background color and text color meet 4.5:1 contrast', () => { - expect( - contrast(variables.background, variables.colorShamrock) - ).to.be.above(4.5) - }) - }) - - describe('colorBarney', () => { - it('should ensure background color and text color meet 4.5:1 contrast', () => { - expect( - contrast(variables.background, variables.colorBarney) - ).to.be.above(4.5) - }) - }) - - describe('colorCrimson', () => { - it('should ensure background color and text color meet 4.5:1 contrast', () => { - expect( - contrast(variables.background, variables.colorCrimson) - ).to.be.above(4.5) - }) - }) - - describe('colorFire', () => { - it('should ensure background color and text color meet 4.5:1 contrast', () => { - expect(contrast(variables.background, variables.colorFire)).to.be.above( - 4.5 - ) - }) - }) - - describe('colorLicorice', () => { - it('should ensure background color and text color meet 4.5:1 contrast', () => { - expect( - contrast(variables.background, variables.colorLicorice) - ).to.be.above(4.5) - }) - }) - - describe('colorAsh', () => { - it('should ensure background color and text color meet 4.5:1 contrast', () => { - expect(contrast(variables.background, variables.colorAsh)).to.be.above( - 4.5 - ) - }) - }) - }) -}) diff --git a/packages/ui-avatar/tsconfig.build.json b/packages/ui-avatar/tsconfig.build.json index 1d8033a617..00edf7c676 100644 --- a/packages/ui-avatar/tsconfig.build.json +++ b/packages/ui-avatar/tsconfig.build.json @@ -28,9 +28,6 @@ { "path": "../ui-color-utils/tsconfig.build.json" }, - { - "path": "../ui-test-locator/tsconfig.build.json" - }, { "path": "../ui-test-utils/tsconfig.build.json" }, diff --git a/packages/ui-badge/src/Badge/__new-tests__/Badge.test.tsx b/packages/ui-badge/src/Badge/__tests__/Badge.test.tsx similarity index 100% rename from packages/ui-badge/src/Badge/__new-tests__/Badge.test.tsx rename to packages/ui-badge/src/Badge/__tests__/Badge.test.tsx diff --git a/packages/ui-badge/src/Badge/__tests__/theme.test.ts b/packages/ui-badge/src/Badge/__tests__/theme.test.ts deleted file mode 100644 index e729c5d326..0000000000 --- a/packages/ui-badge/src/Badge/__tests__/theme.test.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('Badge.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - it('should have a default background and text colors that meet 3:1 contrast', () => { - expect(contrast(variables.colorPrimary, variables.color)).to.be.above(3) - }) - it('should have a success variant background and text colors that meet 3:1 contrast', () => { - expect(contrast(variables.colorSuccess, variables.color)).to.be.above(3) - }) - it('should have a danger variant background and text colors that meet 3:1 contrast', () => { - expect(contrast(variables.colorDanger, variables.color)).to.be.above(3) - }) - it('should have a danger variant background and text colors that meet 3:1 contrast', () => { - expect(contrast(variables.colorInverse, variables.color)).to.be.above(3) - }) - }) - - describe('with the high contrast canvas theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - it('should have a default background and text colors that meet 4.5:1 contrast', () => { - expect(contrast(variables.colorPrimary, variables.color)).to.be.above(4.5) - }) - it('should have a success variant background and text colors that meet 4.5:1 contrast', () => { - expect(contrast(variables.colorSuccess, variables.color)).to.be.above(4.5) - }) - it('should have a danger variant background and text colors that meet 4.5:1 contrast', () => { - expect(contrast(variables.colorDanger, variables.color)).to.be.above(4.5) - }) - it('should have a danger variant background and text colors that meet 4.5:1 contrast', () => { - expect(contrast(variables.colorInverse, variables.color)).to.be.above(4.5) - }) - }) -}) diff --git a/packages/ui-billboard/src/Billboard/__new-tests__/Billboard.test.tsx b/packages/ui-billboard/src/Billboard/__tests__/Billboard.test.tsx similarity index 100% rename from packages/ui-billboard/src/Billboard/__new-tests__/Billboard.test.tsx rename to packages/ui-billboard/src/Billboard/__tests__/Billboard.test.tsx diff --git a/packages/ui-billboard/src/Billboard/__tests__/theme.test.ts b/packages/ui-billboard/src/Billboard/__tests__/theme.test.ts deleted file mode 100644 index 172e5af9dc..0000000000 --- a/packages/ui-billboard/src/Billboard/__tests__/theme.test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { contrast } from '@instructure/ui-color-utils' -import { expect } from '@instructure/ui-test-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('Billboard.theme', () => { - describe('with the canvas theme', () => { - const variables = generateComponentTheme(canvas) - - it('should have message text color that meets 3:1 contrast with the background color', () => { - expect( - contrast(variables.messageColor, variables.backgroundColor) - ).to.be.above(3) - expect( - contrast(variables.messageColorClickable, variables.backgroundColor) - ).to.be.above(3) - }) - }) - - describe('with the high contrast canvas theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - it('should have message text color that meets 4.5:1 contrast with the background color', () => { - expect( - contrast(variables.messageColor, variables.backgroundColor) - ).to.be.above(4.5) - expect( - contrast(variables.messageColorClickable, variables.backgroundColor) - ).to.be.above(4.5) - }) - }) -}) diff --git a/packages/ui-breadcrumb/src/Breadcrumb/BreadcrumbLink/__new-tests__/BreadcrumbLink.test.tsx b/packages/ui-breadcrumb/src/Breadcrumb/BreadcrumbLink/__tests__/BreadcrumbLink.test.tsx similarity index 100% rename from packages/ui-breadcrumb/src/Breadcrumb/BreadcrumbLink/__new-tests__/BreadcrumbLink.test.tsx rename to packages/ui-breadcrumb/src/Breadcrumb/BreadcrumbLink/__tests__/BreadcrumbLink.test.tsx diff --git a/packages/ui-breadcrumb/src/Breadcrumb/__new-tests__/Breadcrumb.test.tsx b/packages/ui-breadcrumb/src/Breadcrumb/__tests__/Breadcrumb.test.tsx similarity index 100% rename from packages/ui-breadcrumb/src/Breadcrumb/__new-tests__/Breadcrumb.test.tsx rename to packages/ui-breadcrumb/src/Breadcrumb/__tests__/Breadcrumb.test.tsx diff --git a/packages/ui-buttons/src/BaseButton/__new-tests__/BaseButton.test.tsx b/packages/ui-buttons/src/BaseButton/__tests__/BaseButton.test.tsx similarity index 100% rename from packages/ui-buttons/src/BaseButton/__new-tests__/BaseButton.test.tsx rename to packages/ui-buttons/src/BaseButton/__tests__/BaseButton.test.tsx diff --git a/packages/ui-buttons/src/BaseButton/__tests__/theme.test.ts b/packages/ui-buttons/src/BaseButton/__tests__/theme.test.ts deleted file mode 100644 index dc2362aecc..0000000000 --- a/packages/ui-buttons/src/BaseButton/__tests__/theme.test.ts +++ /dev/null @@ -1,245 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { contrast } from '@instructure/ui-color-utils' -import { expect } from '@instructure/ui-test-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('BaseButton.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - describe('primary', () => { - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.primaryBackground, variables.primaryColor) - ).to.be.above(3) - expect( - contrast(variables.primaryHoverBackground, variables.primaryColor) - ).to.be.above(3) - expect( - contrast(variables.primaryActiveBackground, variables.primaryColor) - ).to.be.above(3) - expect( - contrast(variables.primaryActiveBackground, variables.primaryColor) - ).to.be.above(3) - }) - }) - - describe('secondary', () => { - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.secondaryBackground, variables.secondaryColor) - ).to.be.above(3) - expect( - contrast(variables.secondaryHoverBackground, variables.secondaryColor) - ).to.be.above(3) - expect( - contrast( - variables.secondaryActiveBackground, - variables.secondaryColor - ) - ).to.be.above(3) - expect( - contrast( - variables.secondaryActiveBackground, - variables.secondaryColor - ) - ).to.be.above(3) - }) - }) - - describe('success', () => { - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.successBackground, variables.successColor) - ).to.be.above(3) - expect( - contrast(variables.successHoverBackground, variables.successColor) - ).to.be.above(3) - expect( - contrast(variables.successActiveBackground, variables.successColor) - ).to.be.above(3) - expect( - contrast(variables.successActiveBackground, variables.successColor) - ).to.be.above(3) - }) - }) - - describe('danger', () => { - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.dangerBackground, variables.dangerColor) - ).to.be.above(3) - expect( - contrast(variables.dangerHoverBackground, variables.dangerColor) - ).to.be.above(3) - expect( - contrast(variables.dangerActiveBackground, variables.dangerColor) - ).to.be.above(3) - expect( - contrast(variables.dangerActiveBackground, variables.dangerColor) - ).to.be.above(3) - }) - }) - - describe('primary-inverse', () => { - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast( - variables.primaryInverseBackground, - variables.primaryInverseColor - ) - ).to.be.above(3) - expect( - contrast( - variables.primaryInverseHoverBackground, - variables.primaryInverseColor - ) - ).to.be.above(3) - expect( - contrast( - variables.primaryInverseActiveBackground, - variables.primaryInverseColor - ) - ).to.be.above(3) - expect( - contrast( - variables.primaryInverseActiveBackground, - variables.primaryInverseColor - ) - ).to.be.above(3) - }) - }) - }) - - describe('with the "canvas-high-contrast" theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - describe('primary', () => { - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.primaryBackground, variables.primaryColor) - ).to.be.above(4.5) - expect( - contrast(variables.primaryHoverBackground, variables.primaryColor) - ).to.be.above(4.5) - expect( - contrast(variables.primaryActiveBackground, variables.primaryColor) - ).to.be.above(4.5) - expect( - contrast(variables.primaryActiveBackground, variables.primaryColor) - ).to.be.above(4.5) - }) - }) - - describe('secondary', () => { - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.secondaryBackground, variables.secondaryColor) - ).to.be.above(4.5) - expect( - contrast(variables.secondaryHoverBackground, variables.secondaryColor) - ).to.be.above(4.5) - expect( - contrast( - variables.secondaryActiveBackground, - variables.secondaryColor - ) - ).to.be.above(4.5) - expect( - contrast( - variables.secondaryActiveBackground, - variables.secondaryColor - ) - ).to.be.above(4.5) - }) - }) - - describe('success', () => { - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.successBackground, variables.successColor) - ).to.be.above(4.5) - expect( - contrast(variables.successHoverBackground, variables.successColor) - ).to.be.above(4.5) - expect( - contrast(variables.successActiveBackground, variables.successColor) - ).to.be.above(4.5) - expect( - contrast(variables.successActiveBackground, variables.successColor) - ).to.be.above(4.5) - }) - }) - - describe('danger', () => { - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.dangerBackground, variables.dangerColor) - ).to.be.above(4.5) - expect( - contrast(variables.dangerHoverBackground, variables.dangerColor) - ).to.be.above(4.5) - expect( - contrast(variables.dangerActiveBackground, variables.dangerColor) - ).to.be.above(4.5) - expect( - contrast(variables.dangerActiveBackground, variables.dangerColor) - ).to.be.above(4.5) - }) - }) - - describe('primary-inverse', () => { - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast( - variables.primaryInverseBackground, - variables.primaryInverseColor - ) - ).to.be.above(4.5) - expect( - contrast( - variables.primaryInverseHoverBackground, - variables.primaryInverseColor - ) - ).to.be.above(4.5) - expect( - contrast( - variables.primaryInverseActiveBackground, - variables.primaryInverseColor - ) - ).to.be.above(4.5) - expect( - contrast( - variables.primaryInverseActiveBackground, - variables.primaryInverseColor - ) - ).to.be.above(4.5) - }) - }) - }) -}) diff --git a/packages/ui-buttons/src/Button/__new-tests__/Button.test.tsx b/packages/ui-buttons/src/Button/__tests__/Button.test.tsx similarity index 100% rename from packages/ui-buttons/src/Button/__new-tests__/Button.test.tsx rename to packages/ui-buttons/src/Button/__tests__/Button.test.tsx diff --git a/packages/ui-buttons/src/CloseButton/__new-tests__/CloseButton.test.tsx b/packages/ui-buttons/src/CloseButton/__tests__/CloseButton.test.tsx similarity index 100% rename from packages/ui-buttons/src/CloseButton/__new-tests__/CloseButton.test.tsx rename to packages/ui-buttons/src/CloseButton/__tests__/CloseButton.test.tsx diff --git a/packages/ui-buttons/src/CondensedButton/__new-tests__/CondensedButton.test.tsx b/packages/ui-buttons/src/CondensedButton/__tests__/CondensedButton.test.tsx similarity index 100% rename from packages/ui-buttons/src/CondensedButton/__new-tests__/CondensedButton.test.tsx rename to packages/ui-buttons/src/CondensedButton/__tests__/CondensedButton.test.tsx diff --git a/packages/ui-buttons/src/IconButton/__new-tests__/IconButton.test.tsx b/packages/ui-buttons/src/IconButton/__tests__/IconButton.test.tsx similarity index 100% rename from packages/ui-buttons/src/IconButton/__new-tests__/IconButton.test.tsx rename to packages/ui-buttons/src/IconButton/__tests__/IconButton.test.tsx diff --git a/packages/ui-buttons/src/ToggleButton/__new-tests__/ToggleButton.test.tsx b/packages/ui-buttons/src/ToggleButton/__tests__/ToggleButton.test.tsx similarity index 100% rename from packages/ui-buttons/src/ToggleButton/__new-tests__/ToggleButton.test.tsx rename to packages/ui-buttons/src/ToggleButton/__tests__/ToggleButton.test.tsx diff --git a/packages/ui-byline/src/Byline/__new-tests__/Byline.test.tsx b/packages/ui-byline/src/Byline/__tests__/Byline.test.tsx similarity index 100% rename from packages/ui-byline/src/Byline/__new-tests__/Byline.test.tsx rename to packages/ui-byline/src/Byline/__tests__/Byline.test.tsx diff --git a/packages/ui-calendar/src/Calendar/Day/__new-tests__/Day.test.tsx b/packages/ui-calendar/src/Calendar/Day/__tests__/Day.test.tsx similarity index 100% rename from packages/ui-calendar/src/Calendar/Day/__new-tests__/Day.test.tsx rename to packages/ui-calendar/src/Calendar/Day/__tests__/Day.test.tsx diff --git a/packages/ui-calendar/src/Calendar/Day/__tests__/theme.test.ts b/packages/ui-calendar/src/Calendar/Day/__tests__/theme.test.ts deleted file mode 100644 index 8e73a7258c..0000000000 --- a/packages/ui-calendar/src/Calendar/Day/__tests__/theme.test.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('Day.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - it('should have default background and text colors that meet 3:1 contrast', () => { - expect(contrast(variables.background, variables.color)).to.be.above(3) - }) - - it('should have outside month background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.background, variables.outsideMonthColor) - ).to.be.above(3) - }) - - it('should have selected background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.selectedBackground, variables.selectedColor) - ).to.be.above(3) - }) - - it('should have today background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.todayBackground, variables.todayColor) - ).to.be.above(3) - }) - }) - - describe('with the high contrast canvas theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - it('should have default background and text colors that meet 4.5:1 contrast', () => { - expect(contrast(variables.background, variables.color)).to.be.above(4.5) - }) - - it('should have outside month background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.background, variables.outsideMonthColor) - ).to.be.above(3) - }) - - it('should have selected background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.selectedBackground, variables.selectedColor) - ).to.be.above(4.5) - }) - - it('should have today background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.todayBackground, variables.todayColor) - ).to.be.above(4.5) - }) - }) -}) diff --git a/packages/ui-calendar/src/Calendar/__new-tests__/Calendar.test.tsx b/packages/ui-calendar/src/Calendar/__tests__/Calendar.test.tsx similarity index 100% rename from packages/ui-calendar/src/Calendar/__new-tests__/Calendar.test.tsx rename to packages/ui-calendar/src/Calendar/__tests__/Calendar.test.tsx diff --git a/packages/ui-calendar/src/Calendar/__tests__/theme.test.ts b/packages/ui-calendar/src/Calendar/__tests__/theme.test.ts deleted file mode 100644 index d9a7eed9d9..0000000000 --- a/packages/ui-calendar/src/Calendar/__tests__/theme.test.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('Calendar.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect(contrast(variables.background, variables.color)).to.be.above(3) - }) - }) - - describe('with the high contrast canvas theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect(contrast(variables.background, variables.color)).to.be.above(4.5) - }) - }) -}) diff --git a/packages/ui-checkbox/src/Checkbox/CheckboxFacade/__new-tests__/CheckboxFacade.test.tsx b/packages/ui-checkbox/src/Checkbox/CheckboxFacade/__tests__/CheckboxFacade.test.tsx similarity index 100% rename from packages/ui-checkbox/src/Checkbox/CheckboxFacade/__new-tests__/CheckboxFacade.test.tsx rename to packages/ui-checkbox/src/Checkbox/CheckboxFacade/__tests__/CheckboxFacade.test.tsx diff --git a/packages/ui-checkbox/src/Checkbox/CheckboxFacade/__tests__/theme.test.ts b/packages/ui-checkbox/src/Checkbox/CheckboxFacade/__tests__/theme.test.ts deleted file mode 100644 index d54b1971c6..0000000000 --- a/packages/ui-checkbox/src/Checkbox/CheckboxFacade/__tests__/theme.test.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('CheckboxFacade.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - it('should ensure checkbox meets 3:1 contrast', () => { - expect( - contrast(variables.color, variables.checkedBackground) - ).to.be.above(3) - }) - }) - - describe('with the "canvas-high-contrast" theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - it('should ensure checkbox meets 4.5:1 contrast', () => { - expect( - contrast(variables.color, variables.checkedBackground) - ).to.be.above(4.5) - }) - }) -}) diff --git a/packages/ui-checkbox/src/Checkbox/ToggleFacade/__new-tests__/ToggleFacade.test.tsx b/packages/ui-checkbox/src/Checkbox/ToggleFacade/__tests__/ToggleFacade.test.tsx similarity index 100% rename from packages/ui-checkbox/src/Checkbox/ToggleFacade/__new-tests__/ToggleFacade.test.tsx rename to packages/ui-checkbox/src/Checkbox/ToggleFacade/__tests__/ToggleFacade.test.tsx diff --git a/packages/ui-checkbox/src/Checkbox/ToggleFacade/__tests__/theme.test.ts b/packages/ui-checkbox/src/Checkbox/ToggleFacade/__tests__/theme.test.ts deleted file mode 100644 index 2e1a47e503..0000000000 --- a/packages/ui-checkbox/src/Checkbox/ToggleFacade/__tests__/theme.test.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('ToggleFacade.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - it('should ensure icon meets 3:1 contrast', () => { - expect( - contrast(variables.uncheckedIconColor, variables.toggleBackground) - ).to.be.above(3) - }) - - it('should ensure icon meets 3:1 contrast when checked', () => { - expect( - contrast(variables.checkedIconColor, variables.toggleBackground) - ).to.be.above(3) - }) - }) - - describe('with the "canvas-high-contrast" theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - it('should ensure icon meets 4.5:1 contrast', () => { - expect( - contrast(variables.uncheckedIconColor, variables.toggleBackground) - ).to.be.above(4.5) - }) - - it('should ensure icon meets 4.5:1 contrast when checked', () => { - expect( - contrast(variables.checkedIconColor, variables.toggleBackground) - ).to.be.above(4.5) - }) - }) -}) diff --git a/packages/ui-checkbox/src/Checkbox/__new-tests__/Checkbox.test.tsx b/packages/ui-checkbox/src/Checkbox/__tests__/Checkbox.test.tsx similarity index 100% rename from packages/ui-checkbox/src/Checkbox/__new-tests__/Checkbox.test.tsx rename to packages/ui-checkbox/src/Checkbox/__tests__/Checkbox.test.tsx diff --git a/packages/ui-checkbox/src/CheckboxGroup/__new-tests__/CheckboxGroup.test.tsx b/packages/ui-checkbox/src/CheckboxGroup/__tests__/CheckboxGroup.test.tsx similarity index 100% rename from packages/ui-checkbox/src/CheckboxGroup/__new-tests__/CheckboxGroup.test.tsx rename to packages/ui-checkbox/src/CheckboxGroup/__tests__/CheckboxGroup.test.tsx diff --git a/packages/ui-code-editor/src/CodeEditor/__tests__/CodeEditor.test.tsx b/packages/ui-code-editor/src/CodeEditor/__tests__/CodeEditor.test.tsx deleted file mode 100644 index d3a423e5b5..0000000000 --- a/packages/ui-code-editor/src/CodeEditor/__tests__/CodeEditor.test.tsx +++ /dev/null @@ -1,56 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect, mount, stub } from '@instructure/ui-test-utils' -import { CodeEditor } from '../index' - -import { CodeEditorLocator } from '../CodeEditorLocator' - -describe('', async () => { - it('should render', async () => { - await mount() - const editor = await CodeEditorLocator.find() - const input = await editor.findInput() - - expect(input).to.exist() - }) - - it('should behave controlled', async () => { - const onChange = stub() - - const subject = await mount( - - ) - const editor = await CodeEditorLocator.find() - const input = await editor.findInput() - - await input.typeIn('d') - expect(onChange).to.have.been.calledWith('hello world') - expect(editor.getTextContent()).to.include('hello worl') - expect(editor.getTextContent()).to.not.include('world') - - await subject.setProps({ value: 'hello world' }) - expect(editor.getTextContent()).to.include('hello world') - }) -}) diff --git a/packages/ui-codemods/__testfixtures__/.prettierrc b/packages/ui-codemods/__testfixtures__/.prettierrc deleted file mode 100644 index 8c158f2dc9..0000000000 --- a/packages/ui-codemods/__testfixtures__/.prettierrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "semi": false, - "singleQuote": true, - "trailingComma": "none" -} \ No newline at end of file diff --git a/packages/ui-codemods/__testfixtures__/defaultToDefault.config.js b/packages/ui-codemods/__testfixtures__/defaultToDefault.config.js deleted file mode 100644 index 6c3fd427e4..0000000000 --- a/packages/ui-codemods/__testfixtures__/defaultToDefault.config.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -module.exports = { - transformDefaults: { - importType: 'default' - }, - transforms: [ - { - where: { - moduleName: 'foo', - packageName: 'instructure-ui' - }, - transform: { - importPath: '@instructure/ui-foo' - } - }, - { - where: { - packageName: 'ui-bar' - }, - transform: { - importPath: 'ui-baz' - } - }, - { - where: { - importPath: 'qux' - }, - transform: { - importPath: 'ui-qux' - } - }, - { - where: { - importPattern: '^instructure/themeable' - }, - transform: { - importPath: '@instructure/ui-themeable' - } - } - ] -} diff --git a/packages/ui-codemods/__testfixtures__/defaultToNamed.config.js b/packages/ui-codemods/__testfixtures__/defaultToNamed.config.js deleted file mode 100644 index c93e17397f..0000000000 --- a/packages/ui-codemods/__testfixtures__/defaultToNamed.config.js +++ /dev/null @@ -1,93 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -module.exports = { - transformDefaults: { - importType: 'named' - }, - transforms: [ - { - where: { - moduleName: 'Foo', - packageName: 'instructure-ui' - }, - transform: { - importPath: '@instructure/ui-foo' - } - }, - { - where: { - moduleName: 'Bar', - packageName: 'instructure-ui' - }, - transform: { - importPath: '@instructure/ui-bar' - } - }, - { - where: { - importPath: 'instructure-ui/lib/components/Baz' - }, - transform: { - importPath: '@instructure/ui-qux' - } - }, - { - where: { - importPattern: '^instructure-ui/lib/utils/Rad' - }, - transform: { - importPath: '@instructure/ui-fad' - } - }, - { - where: { - moduleName: 'themeable', - packageName: 'instructure-ui' - }, - transform: { - importPath: '@instructure/ui-themeable' - } - }, - { - where: { - moduleNames: ['View', 'ContextView', 'Flex', 'Grid'], - packageName: 'instructure-ui' - }, - transform: { - importPath: '@instructure/ui-layout' - } - }, - { - where: { - packageName: '@instructure/ui-themes', - moduleName: 'base' - }, - transform: { - moduleName: 'theme', - importPath: '@instructure/canvas-theme' - } - } - ] -} diff --git a/packages/ui-codemods/__testfixtures__/maintainComments.config.js b/packages/ui-codemods/__testfixtures__/maintainComments.config.js deleted file mode 100644 index cc60bd6bb9..0000000000 --- a/packages/ui-codemods/__testfixtures__/maintainComments.config.js +++ /dev/null @@ -1,86 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -module.exports = { - transformDefaults: { - importType: 'named' - }, - transforms: [ - { - where: { - moduleName: 'Foo', - packageName: 'instructure-ui' - }, - transform: { - importPath: '@instructure/ui-foo' - } - }, - { - where: { - moduleNames: ['Bar', 'Baz', 'Qux'], - packageName: 'instructure-ui' - }, - transform: { - importPath: '@instructure/ui-baz' - } - }, - { - where: { - moduleName: 'theme', - packageName: 'somepackage' - }, - transform: { - importType: 'default', - importPath: 'somepackage' - } - }, - { - where: { - moduleName: 'colors', - packageName: 'somepackage' - }, - transform: { - importPath: 'somepackage' - } - }, - { - where: { - moduleNames: ['children', 'render'], - packageName: 'anotherpackage' - }, - transform: { - importPath: 'anotherpackage' - } - }, - { - where: { - moduleName: 'elementType', - packageName: 'ui-prop-types' - }, - transform: { - importPath: 'ui-element-type' - } - } - ] -} diff --git a/packages/ui-codemods/__testfixtures__/maintainImportTypes.config.js b/packages/ui-codemods/__testfixtures__/maintainImportTypes.config.js deleted file mode 100644 index e650433e8c..0000000000 --- a/packages/ui-codemods/__testfixtures__/maintainImportTypes.config.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -module.exports = { - transformDefaults: { - importType: 'named' - }, - transforms: [ - { - where: { - moduleName: 'Foo', - packageName: 'instructure-ui' - }, - transform: { - importType: undefined, - importPath: '@instructure/ui-foo' - } - }, - { - where: { - importPattern: '^instructure-ui/time' - }, - transform: { - importType: undefined, - importPath: '@instructure/time' - } - } - ] -} diff --git a/packages/ui-codemods/__testfixtures__/namedToDefault.config.js b/packages/ui-codemods/__testfixtures__/namedToDefault.config.js deleted file mode 100644 index 8633b8c7a7..0000000000 --- a/packages/ui-codemods/__testfixtures__/namedToDefault.config.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -module.exports = { - transformDefaults: { - importType: 'named' - }, - transforms: [ - { - where: { - moduleName: 'Foo', - packageName: '@instructure/ui-foo' - }, - transform: { - importType: 'default' - } - }, - { - where: { - moduleName: 'Baz', - packageName: 'stuff' - }, - transform: { - importPath: '@other/stuff', - importType: 'default' - } - }, - { - where: { - moduleName: 'Qux', - packageName: 'stuff' - }, - transform: { - importPath: 'more-stuff', - importType: 'default' - } - }, - { - where: { - importPath: 'thing1' - }, - transform: { - importPath: 'thing2', - importType: 'default' - } - }, - { - where: { - moduleName: 'themeable', - importPath: 'themeable' - }, - transform: { - importPath: '@instructure/ui-themeable', - importType: 'default' - } - } - ] -} diff --git a/packages/ui-codemods/__testfixtures__/namedToNamed.config.js b/packages/ui-codemods/__testfixtures__/namedToNamed.config.js deleted file mode 100644 index bccda60d8b..0000000000 --- a/packages/ui-codemods/__testfixtures__/namedToNamed.config.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -module.exports = { - transformDefaults: { - importType: 'named' - }, - transforms: [ - { - where: { - importPattern: '^ui-foo' - }, - transform: { - importPath: 'ui-bar' - } - }, - { - where: { - moduleName: 'Baz', - importPath: 'ui-baz' - }, - transform: { - importPath: 'ui-qux' - } - }, - { - where: { - moduleName: 'themeable', - importPath: 'themeable' - }, - transform: { - importPath: '@instructure/ui-themeable' - } - }, - { - where: { - moduleName: 'something', - packageName: 'ui-something' - }, - transform: { - moduleName: 'somethingElse', - importPath: 'ui-something-else' - } - }, - { - where: { - moduleName: 'LayoutPropTypes', - packageName: '@instructure/ui-layout' - }, - transform: { - importPath: '@instructure/ui-prop-types' - } - }, - { - where: { - moduleName: 'Flex', - packageName: '@instructure/ui-layout' - }, - transform: { - importPath: '@instructure/ui-flex' - } - }, - { - where: { - moduleName: 'View', - packageName: '@instructure/ui-layout' - }, - transform: { - importPath: '@instructure/ui-view' - } - }, - { - where: { - moduleNames: ['Modal', 'Tray', 'Popover'] - }, - transform: { - importPath: '@instructure/ui-overlays' - } - } - ] -} diff --git a/packages/ui-codemods/__testfixtures__/noSpecifiers.config.js b/packages/ui-codemods/__testfixtures__/noSpecifiers.config.js deleted file mode 100644 index a7cf54eeee..0000000000 --- a/packages/ui-codemods/__testfixtures__/noSpecifiers.config.js +++ /dev/null @@ -1,53 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -module.exports = { - transforms: [ - { - where: { - moduleName: 'Foo', - packageName: 'MyFoo' - }, - transform: { - importPath: '@foo/ui-foo' - } - }, - { - where: { - importPattern: '^instructure-ui/canvas-theme' - }, - transform: { - importPath: '@instructure/ui-themes' - } - }, - { - where: { - importPath: 'some/path/to/something' - }, - transform: { - importPath: 'something' - } - } - ] -} diff --git a/packages/ui-codemods/__testfixtures__/props.config.js b/packages/ui-codemods/__testfixtures__/props.config.js deleted file mode 100644 index 1916be017c..0000000000 --- a/packages/ui-codemods/__testfixtures__/props.config.js +++ /dev/null @@ -1,87 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -module.exports = { - Modal: { - '3.0.0': [ - { old: 'onReady', new: 'onOpen' }, - { old: 'isOpen', new: 'open' }, - { old: 'getDefaultFocusElement', new: 'defaultFocusElement' }, - { old: 'closeButtonVariant', new: null } - ] - }, - - Overlay: { - '3.0.0': [{ old: 'onRequestClose', new: 'onDismiss' }] - }, - - Popover: { - '3.0.0': [ - { old: 'onReady', new: 'onShow' }, - { old: 'rootClose', new: 'shouldCloseOnDocumentClick' }, - { old: 'renderOffscreen', new: 'shouldRenderOffscreen' } - ] - }, - - Position: { - '3.0.0': [{ old: 'onReady', new: 'onPositioned' }] - }, - - TestComponent: { - '3.0.0': [ - { - old: 'isSquare', - new: 'shape', - values: [ - { old: true, new: 'square' }, - { old: false, new: 'circle' } - ] - }, - { - old: 'alertType', - new: 'shouldDisplayAlert', - values: [ - { old: 'visible', new: true }, - { old: 'hidden', new: false }, - { old: 'screenreader' } - ] - }, - { - old: 'errorCode', - new: 'errorType', - values: [ - { old: 0, new: 'low' }, - { old: 1, new: 'moderate' }, - { old: 2, new: 'severe' }, - { old: 3, new: 'critical' } - ] - }, - { - old: 'testNull', - new: 'testNull', - values: [{ old: 'toNull', new: null }] - } - ] - } -} diff --git a/packages/ui-codemods/__testfixtures__/updateImports/defaultToDefault.input.js b/packages/ui-codemods/__testfixtures__/updateImports/defaultToDefault.input.js deleted file mode 100644 index 32fec8d2cd..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateImports/defaultToDefault.input.js +++ /dev/null @@ -1,8 +0,0 @@ -/* eslint-disable */ -import Foo from 'instructure-ui/lib/components/foo' -import Bar from 'ui-bar' -import { Baz as Something } from 'ui-baz' -import Qux from 'qux' -import Qaz from 'ui-qux' -import themeable from 'instructure/themeable' -import '@instructure/ui-themeable' diff --git a/packages/ui-codemods/__testfixtures__/updateImports/defaultToDefault.output.js b/packages/ui-codemods/__testfixtures__/updateImports/defaultToDefault.output.js deleted file mode 100644 index 95c7fcad6f..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateImports/defaultToDefault.output.js +++ /dev/null @@ -1,7 +0,0 @@ -/* eslint-disable */ -import Foo from '@instructure/ui-foo' - -import Bar, { Baz as Something } from 'ui-baz' -import Qux from 'qux' -import Qaz from 'ui-qux' -import themeable from '@instructure/ui-themeable' diff --git a/packages/ui-codemods/__testfixtures__/updateImports/defaultToNamed.input.js b/packages/ui-codemods/__testfixtures__/updateImports/defaultToNamed.input.js deleted file mode 100644 index 946c01c59b..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateImports/defaultToNamed.input.js +++ /dev/null @@ -1,14 +0,0 @@ -/* eslint-disable */ -import Foo from 'instructure-ui/lib/components/Foo' -import Grid from 'instructure-ui/lib/components/Grid' -import MyBar from 'instructure-ui/lib/components/Bar' -import MyBaz from 'instructure-ui/lib/components/Baz' -import View from 'instructure-ui/lib/components/View' -import { Qux } from '@instructure/ui-qux' -import Rad from 'instructure-ui/lib/utils/Rad' -import Flex from 'instructure-ui/lib/components/Flex' -import Fad from '@instructure/ui-fad' -import themeable from 'instructure-ui/themeable' -import ContextView from 'instructure-ui/lib/components/ContextView' -import '@instructure/ui-themeable' -import myTheme, { colors, spacing } from '@instructure/ui-themes/lib/base' diff --git a/packages/ui-codemods/__testfixtures__/updateImports/defaultToNamed.output.js b/packages/ui-codemods/__testfixtures__/updateImports/defaultToNamed.output.js deleted file mode 100644 index 9a6cc6f066..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateImports/defaultToNamed.output.js +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable */ -import { Foo } from '@instructure/ui-foo' - -import { Grid, ContextView, Flex, View } from '@instructure/ui-layout' -import { Bar as MyBar } from '@instructure/ui-bar' -import { Qux, Baz as MyBaz } from '@instructure/ui-qux' -import Fad, { Rad } from '@instructure/ui-fad' -import { themeable } from '@instructure/ui-themeable' -import { colors, spacing } from '@instructure/ui-themes/lib/base' -import { theme as myTheme } from '@instructure/canvas-theme' diff --git a/packages/ui-codemods/__testfixtures__/updateImports/maintainComments.input.js b/packages/ui-codemods/__testfixtures__/updateImports/maintainComments.input.js deleted file mode 100644 index 842c918170..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateImports/maintainComments.input.js +++ /dev/null @@ -1,29 +0,0 @@ -/* eslint-disable */ -import Foo from 'instructure-ui/lib/components/Foo' - -// This comment should stay here -import { Bar } from 'instructure-ui/lib/components/Bar' - -// This comment should be amended to the above comment -import { Baz } from 'instructure-ui/lib/components/Baz' - -// This comment should stay here since this line isn't going away -import { Qux, Qaz } from 'instructure-ui/lib/components/Qux' - -/* - * This multiline comment - * block should stay - * here - */ -import theme from 'somepackage/lib/components/theme' -/* -This multline comment block -should get moved to the theme line -*/ -import colors from 'somepackage/lib/components/colors' - -import { children } from 'anotherpackage/lib/children' // This side comment should stay here -import { render } from 'anotherpackage/lib/render' // This side comment should be moved above - -// This comment should also stay here -import { elementType, xor } from 'ui-prop-types' diff --git a/packages/ui-codemods/__testfixtures__/updateImports/maintainComments.output.js b/packages/ui-codemods/__testfixtures__/updateImports/maintainComments.output.js deleted file mode 100644 index 3c4cf74148..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateImports/maintainComments.output.js +++ /dev/null @@ -1,26 +0,0 @@ -/* eslint-disable */ -import { Foo } from '@instructure/ui-foo' - -// This comment should stay here -// This comment should be amended to the above comment -import { Bar, Qux, Baz } from '@instructure/ui-baz' - -// This comment should stay here since this line isn't going away -import { Qaz } from 'instructure-ui/lib/components/Qux' - -/* - * This multiline comment - * block should stay - * here - */ -/* -This multline comment block -should get moved to the theme line -*/ -import theme, { colors } from 'somepackage' - -import { children, render } from 'anotherpackage' // This side comment should stay here // This side comment should be moved above - -// This comment should also stay here -import { xor } from 'ui-prop-types' -import { elementType } from 'ui-element-type' diff --git a/packages/ui-codemods/__testfixtures__/updateImports/maintainImportTypes.input.js b/packages/ui-codemods/__testfixtures__/updateImports/maintainImportTypes.input.js deleted file mode 100644 index 955e6d7404..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateImports/maintainImportTypes.input.js +++ /dev/null @@ -1,3 +0,0 @@ -/* eslint-disable */ -import Foo from 'instructure-ui/ui-foo/lib/Foo' -import Time, { getTimezone, getBrowserTime } from 'instructure-ui/time' diff --git a/packages/ui-codemods/__testfixtures__/updateImports/maintainImportTypes.output.js b/packages/ui-codemods/__testfixtures__/updateImports/maintainImportTypes.output.js deleted file mode 100644 index 8aae2b4632..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateImports/maintainImportTypes.output.js +++ /dev/null @@ -1,3 +0,0 @@ -/* eslint-disable */ -import Foo from '@instructure/ui-foo' -import Time, { getTimezone, getBrowserTime } from '@instructure/time' diff --git a/packages/ui-codemods/__testfixtures__/updateImports/namedToDefault.input.js b/packages/ui-codemods/__testfixtures__/updateImports/namedToDefault.input.js deleted file mode 100644 index 82dd6f2a17..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateImports/namedToDefault.input.js +++ /dev/null @@ -1,9 +0,0 @@ -/* eslint-disable */ -import { Foo } from '@instructure/ui-foo' -import { Baz as Bar, Qux as Qang } from 'stuff/lib/SomeStuff' -import Fad from 'fad' -import { Rad } from '@other/stuff' -import { Thing1 } from 'thing1' -import Thing2 from 'thing2' -import { themeable } from 'themeable' -import '@instructure/ui-themeable' diff --git a/packages/ui-codemods/__testfixtures__/updateImports/namedToDefault.output.js b/packages/ui-codemods/__testfixtures__/updateImports/namedToDefault.output.js deleted file mode 100644 index 13214b8e65..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateImports/namedToDefault.output.js +++ /dev/null @@ -1,8 +0,0 @@ -/* eslint-disable */ -import Foo from '@instructure/ui-foo' -import Qang from 'more-stuff' -import Fad from 'fad' -import Bar, { Rad } from '@other/stuff' -import { Thing1 } from 'thing1' -import Thing2 from 'thing2' -import themeable from '@instructure/ui-themeable' diff --git a/packages/ui-codemods/__testfixtures__/updateImports/namedToNamed.input.js b/packages/ui-codemods/__testfixtures__/updateImports/namedToNamed.input.js deleted file mode 100644 index 0c4bfd3388..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateImports/namedToNamed.input.js +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable */ -import { Foo } from 'ui-foo' -import { Bar } from 'ui-bar' -import { Baz as Bam } from 'ui-baz' -import Qux from 'ui-qux' -import { LayoutPropTypes, View, Flex } from '@instructure/ui-layout' -import { themeable } from 'themeable' -import '@instructure/ui-themeable' -import { Modal } from '@instructure/ui-modal' -import { Tray } from '@instructure/ui-tray' -import { Popover } from '@instructure/ui-popover' -import { something } from 'ui-something' diff --git a/packages/ui-codemods/__testfixtures__/updateImports/namedToNamed.output.js b/packages/ui-codemods/__testfixtures__/updateImports/namedToNamed.output.js deleted file mode 100644 index 0cce29bcc8..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateImports/namedToNamed.output.js +++ /dev/null @@ -1,9 +0,0 @@ -/* eslint-disable */ -import { Bar, Foo } from 'ui-bar' -import Qux, { Baz as Bam } from 'ui-qux' -import { Flex } from '@instructure/ui-flex' -import { View } from '@instructure/ui-view' -import { LayoutPropTypes } from '@instructure/ui-prop-types' -import { themeable } from '@instructure/ui-themeable' -import { Modal, Popover, Tray } from '@instructure/ui-overlays' -import { somethingElse as something } from 'ui-something-else' diff --git a/packages/ui-codemods/__testfixtures__/updateImports/noSpecifiers.input.js b/packages/ui-codemods/__testfixtures__/updateImports/noSpecifiers.input.js deleted file mode 100644 index 267f25c394..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateImports/noSpecifiers.input.js +++ /dev/null @@ -1,4 +0,0 @@ -/* eslint-disable */ -import 'MyFoo/lib/components/Foo' -import 'instructure-ui/canvas-theme' // Some comment to make sure comments are preserved -import 'some/path/to/something' diff --git a/packages/ui-codemods/__testfixtures__/updateImports/noSpecifiers.output.js b/packages/ui-codemods/__testfixtures__/updateImports/noSpecifiers.output.js deleted file mode 100644 index ba0744a417..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateImports/noSpecifiers.output.js +++ /dev/null @@ -1,4 +0,0 @@ -/* eslint-disable */ -import '@foo/ui-foo' -import '@instructure/ui-themes' // Some comment to make sure comments are preserved -import 'something' diff --git a/packages/ui-codemods/__testfixtures__/updateImports/testCases.txt b/packages/ui-codemods/__testfixtures__/updateImports/testCases.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/ui-codemods/__testfixtures__/updatePropNames/elements.input.js b/packages/ui-codemods/__testfixtures__/updatePropNames/elements.input.js deleted file mode 100644 index 7c98140f7d..0000000000 --- a/packages/ui-codemods/__testfixtures__/updatePropNames/elements.input.js +++ /dev/null @@ -1,3 +0,0 @@ -/* eslint-disable */ - -const Modal = {}} closeButtonVariant="value" /> diff --git a/packages/ui-codemods/__testfixtures__/updatePropNames/elements.output.js b/packages/ui-codemods/__testfixtures__/updatePropNames/elements.output.js deleted file mode 100644 index 4b541c6e57..0000000000 --- a/packages/ui-codemods/__testfixtures__/updatePropNames/elements.output.js +++ /dev/null @@ -1,3 +0,0 @@ -/* eslint-disable */ - -const Modal = {}} /> diff --git a/packages/ui-codemods/__testfixtures__/updatePropNames/updateValues.input.js b/packages/ui-codemods/__testfixtures__/updatePropNames/updateValues.input.js deleted file mode 100644 index 752b96023b..0000000000 --- a/packages/ui-codemods/__testfixtures__/updatePropNames/updateValues.input.js +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable */ -let shouldTriggerWarning = { b: 1 } - -const Test = ( -
- - - - - -
-) diff --git a/packages/ui-codemods/__testfixtures__/updatePropNames/updateValues.output.js b/packages/ui-codemods/__testfixtures__/updatePropNames/updateValues.output.js deleted file mode 100644 index e0331cb968..0000000000 --- a/packages/ui-codemods/__testfixtures__/updatePropNames/updateValues.output.js +++ /dev/null @@ -1,20 +0,0 @@ -/* eslint-disable */ -let shouldTriggerWarning = { b: 1 } - -const Test = ( -
- - - - - -
-) diff --git a/packages/ui-codemods/__testfixtures__/updateV10Breaking/colors.input.js b/packages/ui-codemods/__testfixtures__/updateV10Breaking/colors.input.js deleted file mode 100644 index fd4f8f29bc..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateV10Breaking/colors.input.js +++ /dev/null @@ -1,40 +0,0 @@ -/* eslint-disable */ -import { canvas, canvasHighContrast } from '@instructure/ui' - -export const generateStyle = () => { - return { - logoSubtitle: { - label: 'logoSubtitle', - marginTop: '-3px' - }, - optionWrapper: { - label: 'optionWrapper', - margin: '-0.5rem -0.75rem', - padding: '0.5rem 0.75rem', - border: '0 solid ' + canvas.colors.tiara, - borderBottomWidth: '1px', - display: 'flex', - maxWidth: '100%', - overflow: 'hidden', - alignItems: 'center' - }, - optionIcon: { - label: 'optionIcon', - width: '36px', - height: '36px', - backgroundColor: canvasHighContrast.colors.oxford, - borderRadius: 100, - flexShrink: 0, - display: 'flex', - justifyContent: 'center', - alignItems: 'center' - }, - truncateSingleLine: { - overflow: 'hidden', - whiteSpace: 'nowrap', - textOverflow: 'ellipsis' - } - } -} - -export const generateComponentTheme = () => ({}) diff --git a/packages/ui-codemods/__testfixtures__/updateV10Breaking/colors.output.js b/packages/ui-codemods/__testfixtures__/updateV10Breaking/colors.output.js deleted file mode 100644 index 1ae4228ee4..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateV10Breaking/colors.output.js +++ /dev/null @@ -1,40 +0,0 @@ -/* eslint-disable */ -import { canvas, canvasHighContrast } from '@instructure/ui' - -export const generateStyle = () => { - return { - logoSubtitle: { - label: 'logoSubtitle', - marginTop: '-3px' - }, - optionWrapper: { - label: 'optionWrapper', - margin: '-0.5rem -0.75rem', - padding: '0.5rem 0.75rem', - border: '0 solid ' + canvas.colors?.contrasts?.grey1214, - borderBottomWidth: '1px', - display: 'flex', - maxWidth: '100%', - overflow: 'hidden', - alignItems: 'center' - }, - optionIcon: { - label: 'optionIcon', - width: '36px', - height: '36px', - backgroundColor: canvasHighContrast.colors?.contrasts?.grey100100, - borderRadius: 100, - flexShrink: 0, - display: 'flex', - justifyContent: 'center', - alignItems: 'center' - }, - truncateSingleLine: { - overflow: 'hidden', - whiteSpace: 'nowrap', - textOverflow: 'ellipsis' - } - } -} - -export const generateComponentTheme = () => ({}) diff --git a/packages/ui-codemods/__testfixtures__/updateV10Breaking/colors2.input.tsx b/packages/ui-codemods/__testfixtures__/updateV10Breaking/colors2.input.tsx deleted file mode 100644 index ada0128752..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateV10Breaking/colors2.input.tsx +++ /dev/null @@ -1,716 +0,0 @@ -/* eslint-disable */ -import { ComponentProps, useCallback, useState } from 'react' -import { - InstUISettingsProvider, - canvas, - View, - Text, - Link, - AppNav, - ScreenReaderContent, - Popover, - Flex, - Button, - Drilldown, - Modal, - Heading, - CloseButton, - Avatar, - withStyle, - IconButton, - IconSearchLine, - IconArrowOpenDownLine, - IconQuestionLine, - IconBulletListSolid, - IconTextLine, - IconUserLine, - IconHamburgerLine, - IconInfoLine, - IconArrowOpenEndSolid -} from '@instructure/ui' -import { useMutation } from 'react-query' -import KBar from '../KBar/KBar' -import StaticSearch from '../common/components/StaticSearch' -import ApiSearch from '../common/components/ApiSearch' -import useMediaQuery from '../utils/useMediaQuery' -import { generateStyle, generateComponentTheme } from './styles' -import { apiClient } from '../api' - -export type MenuItem = { - key: string - label: string - href: string - showForUsers: boolean - showForAdmins: boolean -} -export type ItemBank = { id: string | number; name: string; item_count: number } -export type Client = { - id: string | number - name: string - icon: string - itemBanks: Array -} - -const defaultMenuItems: Array = [ - { - key: 'items', - label: 'Items', - href: '/items', - showForUsers: true, - showForAdmins: false - }, - { - key: 'tests', - label: 'Assessments', - href: '/tests', - showForUsers: true, - showForAdmins: false - }, - { - key: 'reports', - label: 'Reports', - href: '/reports', - showForUsers: true, - showForAdmins: false - }, - { - key: 'graphics_orders', - label: 'Media', - href: '/gfxorders', - showForUsers: true, - showForAdmins: false - }, - { - key: 'exports', - label: 'Export', - href: '/exports', - showForUsers: true, - showForAdmins: true - }, - { - key: 'users', - label: 'Users', - href: '/users', - showForUsers: false, - showForAdmins: true - }, - { - key: 'clients', - label: 'Clients', - href: '/clients', - showForUsers: false, - showForAdmins: true - } -] - -interface HeaderProps { - user?: { id: string; name: string; email: string; avatar: string } - isAdmin: boolean - menuItems: Array - clients: Array - activeMenuItem: string - activeClient: string | number - styles: Record -} - -const Header: React.FC = ({ - user, - isAdmin = false, - menuItems = defaultMenuItems, - clients = [], - activeMenuItem = 'dashboard', - activeClient, - styles -}) => { - const menuItemsToRender = !user - ? [] - : menuItems.filter( - ({ showForUsers, showForAdmins }) => - (isAdmin && showForAdmins) || (!isAdmin && showForUsers) - ) - const currentClient = clients.find((c) => c.id + '' === activeClient + '') - - const [visibleItemsCount, setVisibleItemsCount] = useState( - menuItemsToRender.length - ) - const [searchVisible, setSearchVisible] = useState(false) - const [contextModalOpen, setContextModalOpen] = useState(false) - const [selectedBank, setSelectedBank] = useState() - const isSmall = useMediaQuery('(max-width: 414px)') - - const { mutateAsync: switchCtx } = useMutation((bank: ItemBank) => { - const client = clients.find((c) => c.itemBanks.includes(bank)) - return apiClient.get(`/users/context?id=${client?.id}`) - }) - - return ( - - {user ? : null} - - - - - - - {user && !isAdmin ? ( - - - - {currentClient?.name} - - - - - - } - > - - - (window.location.href = `/users/context?id=${props.id}`) - } - > - {clients.map((client) => ( - - {client.name} - - ))} - - - - - ) : null} - - - - = 2 ? visibleItemsCount : 0} - onUpdate={(data) => setVisibleItemsCount(data.visibleItemsCount)} - margin="0 0 0 small" - renderBeforeItems={ - - - - - {isSmall ? 'IL' : 'ItemLogic'} - - {isSmall ? null : ( - - - By Instructure - - - )} - - - - {!user || isAdmin ? null : ( - } - > - - {clients.map((client) => ( - ( - - - {client.name} - - )} - > - {client.itemBanks.length ? ( - client.itemBanks.map((bank) => ( - { - if (activeClient + '' !== client.id + '') { - setSelectedBank(bank) - setContextModalOpen(true) - return - } - - window.location.href = `/banks/view/${bank.id}/items` - }} - renderLabelInfo={({ variant }) => ( - - {bank.item_count} - - )} - > - {bank.name} - - )) - ) : ( - - No Item Banks - - )} - - ))} - - - )} - - } - renderAfterItems={ - - {user ? ( - <> - - - - } - isShowingContent={!isSmall && searchVisible} - onShowContent={() => setSearchVisible((s) => !s)} - onHideContent={() => setSearchVisible(false)} - on="click" - screenReaderLabel="Search" - shouldContainFocus - shouldReturnFocus - shouldCloseOnDocumentClick - offsetY="15px" - placement="bottom end" - > - - - - - - - } - > - - - Standards browser - - - - Prompts - - - - Help - - - - - - - - } - > - - ( - - )} - href="/account" - themeOverride={{ padding: '0.75rem' }} - > - {(props) => ( - - - - - - - {user.name} - - {user.email} - - - - )} - - - - - Jobs Statistic - - - - { - return { color: currentTheme.colors.textDanger } - }} - > - Logout - - - - - - ) : null} - - } - renderTruncateLabel={function () { - const hiddenItemsCount = - menuItemsToRender.length - visibleItemsCount - if (visibleItemsCount >= 2) { - return `${hiddenItemsCount} More` - } else { - return ( - - - {`${hiddenItemsCount} More`} - - ) - } - }} - > - {menuItemsToRender.map(({ key, label, href }) => ( - - ))} - - - - {isSmall && searchVisible ? ( - - - - ) : null} - - setContextModalOpen(false)} - label="Switching the context" - shouldCloseOnDocumentClick - > - - setContextModalOpen(false)} - screenReaderLabel="Close" - /> - - Switching the context - - - - - - You selected a bank that belongs to{' '} - {selectedBank - ? clients.find((c) => c.itemBanks.includes(selectedBank))?.name - : null} - . By proceeding, the context will be switched as well. - - - - - - - - The active context is visible in the header. - - - - - - - - - - - - ) -} - -interface HeaderSearchProps - extends Omit>, 'styles'> { - styles: Record -} - -const HeaderSearch: React.FC = ({ styles, ...rest }) => { - return ( - - ({ q: params.q || 'last_searches' })} - transformOptions={(data) => - data.json.map((r: any) => ({ - ...r, - id: r?.Item?.id || r?.Resource?.id, - label: r?.Item?.title || r?.Resource?.title - })) - } - renderLabel={() => Search} - placeholder="Search items by ID, title..." - optionsMaxHeight={8 * 61 + 'px'} - renderOption={(option, isHighlighted) => ( - - )} - {...rest} - /> - - ) -} - -interface HeaderSearchItemProps { - styles: Record - option: any - isHighlighted: boolean -} - -const HeaderSearchItem = React.memo( - ({ styles, option, isHighlighted }) => { - const onClick = useCallback(() => { - if (option.type === 'ITEM') { - window.location.href = `/items/view/${option.id}` - } else { - window.location.href = `/banks/view/${option.Bank.id}/resources/${option.Resource.id}` - } - }, [option]) - - return ( -
-
- {option.type === 'ITEM' ? ( - - ) : ( - - )} -
- - - - {option.label || 'Untitled Item'} - - -
- - {option.Bank.title} - - - - {' '} - |{' '} - - - - {option.type === 'ITEM' - ? `Item: ${option.Item.id_persistent} (v${option.Item.id_version})` - : `Resource: ${option.Resource.id}`} - -
-
-
- ) - } -) -HeaderSearchItem.displayName = 'HeaderSearchItem' - -export default withStyle(generateStyle, generateComponentTheme)(Header as any) diff --git a/packages/ui-codemods/__testfixtures__/updateV10Breaking/colors2.output.tsx b/packages/ui-codemods/__testfixtures__/updateV10Breaking/colors2.output.tsx deleted file mode 100644 index 670659e052..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateV10Breaking/colors2.output.tsx +++ /dev/null @@ -1,734 +0,0 @@ -/* eslint-disable */ -import { ComponentProps, useCallback, useState } from 'react' -import { - InstUISettingsProvider, - canvas, - View, - Text, - Link, - AppNav, - ScreenReaderContent, - Popover, - Flex, - Button, - Drilldown, - Modal, - Heading, - CloseButton, - Avatar, - withStyle, - IconButton, - IconSearchLine, - IconArrowOpenDownLine, - IconQuestionLine, - IconBulletListSolid, - IconTextLine, - IconUserLine, - IconHamburgerLine, - IconInfoLine, - IconArrowOpenEndSolid -} from '@instructure/ui' -import { useMutation } from 'react-query' -import KBar from '../KBar/KBar' -import StaticSearch from '../common/components/StaticSearch' -import ApiSearch from '../common/components/ApiSearch' -import useMediaQuery from '../utils/useMediaQuery' -import { generateStyle, generateComponentTheme } from './styles' -import { apiClient } from '../api' - -export type MenuItem = { - key: string - label: string - href: string - showForUsers: boolean - showForAdmins: boolean -} -export type ItemBank = { id: string | number; name: string; item_count: number } -export type Client = { - id: string | number - name: string - icon: string - itemBanks: Array -} - -const defaultMenuItems: Array = [ - { - key: 'items', - label: 'Items', - href: '/items', - showForUsers: true, - showForAdmins: false - }, - { - key: 'tests', - label: 'Assessments', - href: '/tests', - showForUsers: true, - showForAdmins: false - }, - { - key: 'reports', - label: 'Reports', - href: '/reports', - showForUsers: true, - showForAdmins: false - }, - { - key: 'graphics_orders', - label: 'Media', - href: '/gfxorders', - showForUsers: true, - showForAdmins: false - }, - { - key: 'exports', - label: 'Export', - href: '/exports', - showForUsers: true, - showForAdmins: true - }, - { - key: 'users', - label: 'Users', - href: '/users', - showForUsers: false, - showForAdmins: true - }, - { - key: 'clients', - label: 'Clients', - href: '/clients', - showForUsers: false, - showForAdmins: true - } -] - -interface HeaderProps { - user?: { id: string; name: string; email: string; avatar: string } - isAdmin: boolean - menuItems: Array - clients: Array - activeMenuItem: string - activeClient: string | number - styles: Record -} - -const Header: React.FC = ({ - user, - isAdmin = false, - menuItems = defaultMenuItems, - clients = [], - activeMenuItem = 'dashboard', - activeClient, - styles -}) => { - const menuItemsToRender = !user - ? [] - : menuItems.filter( - ({ showForUsers, showForAdmins }) => - (isAdmin && showForAdmins) || (!isAdmin && showForUsers) - ) - const currentClient = clients.find((c) => c.id + '' === activeClient + '') - - const [visibleItemsCount, setVisibleItemsCount] = useState( - menuItemsToRender.length - ) - const [searchVisible, setSearchVisible] = useState(false) - const [contextModalOpen, setContextModalOpen] = useState(false) - const [selectedBank, setSelectedBank] = useState() - const isSmall = useMediaQuery('(max-width: 414px)') - - const { mutateAsync: switchCtx } = useMutation((bank: ItemBank) => { - const client = clients.find((c) => c.itemBanks.includes(bank)) - return apiClient.get(`/users/context?id=${client?.id}`) - }) - - return ( - - {user ? : null} - - - - - - {user && !isAdmin ? ( - - - - {currentClient?.name} - - - - - - } - > - - - (window.location.href = `/users/context?id=${props.id}`) - } - > - {clients.map((client) => ( - - {client.name} - - ))} - - - - - ) : null} - - - - = 2 ? visibleItemsCount : 0} - onUpdate={(data) => setVisibleItemsCount(data.visibleItemsCount)} - margin="0 0 0 small" - renderBeforeItems={ - - - - - {isSmall ? 'IL' : 'ItemLogic'} - - {isSmall ? null : ( - - - By Instructure - - - )} - - - - {!user || isAdmin ? null : ( - } - > - - {clients.map((client) => ( - ( - - - {client.name} - - )} - > - {client.itemBanks.length ? ( - client.itemBanks.map((bank) => ( - { - if (activeClient + '' !== client.id + '') { - setSelectedBank(bank) - setContextModalOpen(true) - return - } - - window.location.href = `/banks/view/${bank.id}/items` - }} - renderLabelInfo={({ variant }) => ( - - {bank.item_count} - - )} - > - {bank.name} - - )) - ) : ( - - No Item Banks - - )} - - ))} - - - )} - - } - renderAfterItems={ - - {user ? ( - <> - - - - } - isShowingContent={!isSmall && searchVisible} - onShowContent={() => setSearchVisible((s) => !s)} - onHideContent={() => setSearchVisible(false)} - on="click" - screenReaderLabel="Search" - shouldContainFocus - shouldReturnFocus - shouldCloseOnDocumentClick - offsetY="15px" - placement="bottom end" - > - - - - - - - } - > - - - Standards browser - - - - Prompts - - - - Help - - - - - - - - } - > - - ( - - )} - href="/account" - themeOverride={{ padding: '0.75rem' }} - > - {(props) => ( - - - - - - - {user.name} - - {user.email} - - - - )} - - - - - Jobs Statistic - - - - { - return { color: currentTheme.colors.textDanger } - }} - > - Logout - - - - - - ) : null} - - } - renderTruncateLabel={function () { - const hiddenItemsCount = - menuItemsToRender.length - visibleItemsCount - if (visibleItemsCount >= 2) { - return `${hiddenItemsCount} More` - } else { - return ( - - - {`${hiddenItemsCount} More`} - - ) - } - }} - > - {menuItemsToRender.map(({ key, label, href }) => ( - - ))} - - - {isSmall && searchVisible ? ( - - - - ) : null} - setContextModalOpen(false)} - label="Switching the context" - shouldCloseOnDocumentClick - > - - setContextModalOpen(false)} - screenReaderLabel="Close" - /> - - Switching the context - - - - - - You selected a bank that belongs to{' '} - {selectedBank - ? clients.find((c) => c.itemBanks.includes(selectedBank))?.name - : null} - . By proceeding, the context will be switched as well. - - - - - - - - The active context is visible in the header. - - - - - - - - - - - - ) -} - -interface HeaderSearchProps - extends Omit>, 'styles'> { - styles: Record -} - -const HeaderSearch: React.FC = ({ styles, ...rest }) => { - return ( - - ({ q: params.q || 'last_searches' })} - transformOptions={(data) => - data.json.map((r: any) => ({ - ...r, - id: r?.Item?.id || r?.Resource?.id, - label: r?.Item?.title || r?.Resource?.title - })) - } - renderLabel={() => Search} - placeholder="Search items by ID, title..." - optionsMaxHeight={8 * 61 + 'px'} - renderOption={(option, isHighlighted) => ( - - )} - {...rest} - /> - - ) -} - -interface HeaderSearchItemProps { - styles: Record - option: any - isHighlighted: boolean -} - -const HeaderSearchItem = React.memo( - ({ styles, option, isHighlighted }) => { - const onClick = useCallback(() => { - if (option.type === 'ITEM') { - window.location.href = `/items/view/${option.id}` - } else { - window.location.href = `/banks/view/${option.Bank.id}/resources/${option.Resource.id}` - } - }, [option]) - - return ( -
-
- {option.type === 'ITEM' ? ( - - ) : ( - - )} -
- - - {option.label || 'Untitled Item'} - - -
- - {option.Bank.title} - - - - {' '} - |{' '} - - - - {option.type === 'ITEM' - ? `Item: ${option.Item.id_persistent} (v${option.Item.id_version})` - : `Resource: ${option.Resource.id}`} - -
-
-
- ) - } -) -HeaderSearchItem.displayName = 'HeaderSearchItem' - -export default withStyle(generateStyle, generateComponentTheme)(Header as any) diff --git a/packages/ui-codemods/__testfixtures__/updateV7Props/buttonClose.input.js b/packages/ui-codemods/__testfixtures__/updateV7Props/buttonClose.input.js deleted file mode 100644 index aee2922905..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateV7Props/buttonClose.input.js +++ /dev/null @@ -1,18 +0,0 @@ -/* eslint-disable */ -import { CloseButton } from '@instructure/ui-buttons' - -const fun = () => "asdf" -let a = ( -

- 3} /> - - - simple text message - - {fun()} - - - This cannot be updated {fun()} - -

-) diff --git a/packages/ui-codemods/__testfixtures__/updateV7Props/buttonClose.output.js b/packages/ui-codemods/__testfixtures__/updateV7Props/buttonClose.output.js deleted file mode 100644 index 54256f47b8..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateV7Props/buttonClose.output.js +++ /dev/null @@ -1,14 +0,0 @@ -/* eslint-disable */ -import { CloseButton } from '@instructure/ui-buttons' - -const fun = () => 'asdf' -let a = ( -

- 3} /> - - - - - This cannot be updated {fun()} -

-) diff --git a/packages/ui-codemods/__testfixtures__/updateV7Props/buttonIconCircle.input.js b/packages/ui-codemods/__testfixtures__/updateV7Props/buttonIconCircle.input.js deleted file mode 100644 index 6a94d85431..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateV7Props/buttonIconCircle.input.js +++ /dev/null @@ -1,26 +0,0 @@ -/* eslint-disable */ -import { Button } from '@instructure/ui-buttons' - -const fun = () => 'test' -let a = ( -

- - - - - -

-) diff --git a/packages/ui-codemods/__testfixtures__/updateV7Props/buttonIconCircle.output.js b/packages/ui-codemods/__testfixtures__/updateV7Props/buttonIconCircle.output.js deleted file mode 100644 index 1768a54cb8..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateV7Props/buttonIconCircle.output.js +++ /dev/null @@ -1,37 +0,0 @@ -/* eslint-disable */ -import { Button, IconButton } from '@instructure/ui-buttons' - -const fun = () => 'test' -let a = ( -

- - - - - - - - - - -

-) diff --git a/packages/ui-codemods/__testfixtures__/updateV7Props/buttonLink.input.js b/packages/ui-codemods/__testfixtures__/updateV7Props/buttonLink.input.js deleted file mode 100644 index 96ccaf611e..0000000000 --- a/packages/ui-codemods/__testfixtures__/updateV7Props/buttonLink.input.js +++ /dev/null @@ -1,11 +0,0 @@ -/* eslint-disable */ -import { Button } from '@instructure/ui-buttons' - -let a = ( -

- }) - const button = screen.getByRole('button') - - expect(button).toBeInTheDocument() - expect(button).toHaveTextContent('hello world') - }) - - it('should call children function with focused when element receives focus', async () => { - const renderSpy = vi.fn() - render( - - {(args) => { - renderSpy(args) - return - }} - - ) - const focusable = screen.getByRole('button') - - await waitFor(() => { - const args = renderSpy.mock.lastCall![0] - - expect(args).toHaveProperty('focused', false) - expect(args).toHaveProperty('focusable', focusable) - expect(args).toHaveProperty('focusVisible', false) - }) - - await userEvent.type(focusable, '{enter}') - await focusable.focus() - - await waitFor(() => { - const args = renderSpy.mock.lastCall![0] - - expect(document.activeElement).toBe(focusable) - expect(args).toHaveProperty('focused', true) - expect(args).toHaveProperty('focusable', focusable) - expect(args).toHaveProperty('focusVisible', true) - }) - - await focusable.blur() - - await waitFor(() => { - const args = renderSpy.mock.lastCall![0] - - expect(document.activeElement).not.toBe(focusable) - expect(args).toHaveProperty('focused', false) - expect(args).toHaveProperty('focusable', focusable) - expect(args).toHaveProperty('focusVisible', false) - }) - }) - - it('should handle conditionally rendered focus elements', async () => { - const renderSpy = vi.fn(({ focused }) => ( -

- )) - - render() - const firstFocusable = screen.getByText('Click') - - expect(firstFocusable.tagName).toBe('A') - expect(firstFocusable).not.toHaveFocus() - - await waitFor(() => { - const args = renderSpy.mock.lastCall![0] - - expect(args.focused).toBe(false) - expect(args.focusable).toBe(firstFocusable) - }) - - await firstFocusable.focus() - - const nextFocusable = screen.getByRole('textbox') - - expect(nextFocusable.tagName).toBe('INPUT') - expect(nextFocusable).toHaveFocus() - - await waitFor(() => { - const args = renderSpy.mock.lastCall![0] - expect(args.focused).toBe(true) - expect(args.focusable).toBe(nextFocusable) - }) - - await nextFocusable.blur() - - const lastFocusable = screen.getByText('Click') - - expect(lastFocusable.tagName).toBe('A') - expect(lastFocusable).not.toHaveFocus() - - await waitFor(() => { - const args = renderSpy.mock.lastCall![0] - expect(args.focused).toBe(false) - expect(args.focusable).toBe(lastFocusable) - }) - }) - - it('should maintain focus when the focus element changes', async () => { - const renderSpy = vi.fn(() => Click) - - const { rerender } = render() - const firstFocusable = screen.getByText('Click') - - await firstFocusable.focus() - - await waitFor(() => { - const lastCall = renderSpy.mock.lastCall as - | [{ focused: boolean; focusable: HTMLElement }] - | undefined - const args = lastCall?.[0] - - expect(firstFocusable).toHaveFocus() - expect(args?.focused).toBe(true) - expect(args?.focusable).toBe(firstFocusable) - }) - - // Set prop: render - const nextRenderSpy = vi.fn(() => ) - rerender() - - const nextFocusable = screen.getByText('Click') - - expect(nextFocusable.tagName).toBe('BUTTON') - expect(nextFocusable).toHaveFocus() - - await waitFor(() => { - const nextLastCall = nextRenderSpy.mock.lastCall as - | [{ focused: boolean; focusable: HTMLElement }] - | undefined - const nextArgs = nextLastCall?.[0] - - expect(nextFocusable).toHaveFocus() - expect(nextArgs?.focused).toBe(true) - expect(nextArgs?.focusable).toBe(nextFocusable) - }) - }) - - it('should update the focus element correctly', async () => { - const renderSpy = vi.fn() - - const { rerender } = render( - - {(args) => { - renderSpy(args) - return - }} - - ) - - const firstButton = screen.getByText('foo') - - await firstButton.focus() - - await waitFor(() => { - const args = renderSpy.mock.lastCall![0] - - expect(args.focused).toBe(true) - }) - - await firstButton.blur() - - await waitFor(() => { - const args = renderSpy.mock.lastCall![0] - - expect(args.focused).toBe(false) - }) - - // Set child - rerender( - - {(args: FocusableRenderOptions) => { - renderSpy(args) - return ( - - some content text - - ) - }} - - ) - const secondButton = screen.getByText('bar') - - await secondButton.focus() - - await waitFor(() => { - const args = renderSpy.mock.lastCall![0] - - expect(args.focused).toBe(true) - }) - }) - - it('should warn when there is more than one focusable descendant', async () => { - render( - - {() => { - return ( - - - - - - - ) - }} - - ) - - const expectedWarningMessage = - 'Warning: [Focusable] Exactly one focusable child is required (2 found).' - - expect(consoleWarningMock).toHaveBeenCalledWith( - expect.stringContaining(expectedWarningMessage), - expect.any(String) - ) - }) - - it('should warn when there are no focusable descendants', async () => { - render( - - {() => { - return hello! - }} - - ) - - const expectedWarningMessage = - 'Warning: [Focusable] Exactly one focusable child is required (0 found).' - - expect(consoleWarningMock).toHaveBeenCalledWith( - expect.stringContaining(expectedWarningMessage), - expect.any(String) - ) - }) - - it('should attach event listener correctly even when the focusable element is not the root', async () => { - const renderSpy = vi.fn() - - render( - - {(args) => { - renderSpy(args) - return ( - -

hello world

-

some content

- - - -
- ) - }} -
- ) - - const button = screen.getByRole('button') - - await waitFor(() => { - const args = renderSpy.mock.lastCall![0] - - expect(args.focused).toBe(false) - }) - - await button.focus() - - await waitFor(() => { - const args = renderSpy.mock.lastCall![0] - - expect(args.focused).toBe(true) - }) - }) - - it('should provide a focus method', async () => { - let focusable: Focusable - render( - { - focusable = el - }} - > - {() => } - - ) - - await focusable!.focus() - - const button = screen.getByText('hello world') - - expect(button).toHaveFocus() - }) - - it('should provide a focused getter', async () => { - let focusableInstance: any - - render( - - {(args) => { - focusableInstance = args - return - }} - - ) - const button = screen.getByText('Click me') - - expect(focusableInstance?.focused).toBe(false) - - await button.focus() - - await waitFor(() => { - expect(focusableInstance?.focused).toBe(true) - expect(button).toHaveFocus() - }) - }) - - it('should properly restore the event handlers', async () => { - let inputRef: HTMLInputElement | null = null - class TestComponent extends Component<{ changeValue: string }> { - render() { - const { changeValue } = this.props - - return ( - - {({ focusVisible }) => { - return ( - { - inputRef = el - }} - value={`${focusVisible}_${changeValue}`} - /> - ) - }} - - ) - } - } - const { rerender, container } = render() - const initialInput = container.querySelector('input') - - await waitFor(() => { - expect(initialInput).toHaveValue('false_A') - }) - - // Set Prop: changeValue - rerender() - - await inputRef!.focus() - - await waitFor(() => { - expect(inputRef).toHaveValue('true_B') - }) - }) - - it('should properly clear the focusable / focused state when focus is unexpectedly lost', async () => { - let buttonRef: HTMLButtonElement | null - let focusableRef: Focusable | null - let labelRef: HTMLLabelElement | null - - class TestComponent extends Component { - state = { - checked: false, - disabled: false - } - - render() { - const { checked, disabled } = this.state - - return ( -
- { - focusableRef = el - }} - > - {() => { - return ( - - ) - }} - - -
- ) - } - } - - const { container } = render() - const input = container.querySelector('input') - - await waitFor(() => { - expect(focusableRef!.focused).toBe(false) - }) - - await userEvent.click(labelRef!) - - await waitFor(() => { - expect(input).toHaveFocus() - }) - - await userEvent.click(buttonRef!) - - await waitFor(() => { - expect(input).not.toHaveFocus() - }) - }) -}) diff --git a/packages/ui-focusable/src/Focusable/__tests__/Focusable.test.tsx b/packages/ui-focusable/src/Focusable/__tests__/Focusable.test.tsx index fbd403dbcd..454dd5a540 100644 --- a/packages/ui-focusable/src/Focusable/__tests__/Focusable.test.tsx +++ b/packages/ui-focusable/src/Focusable/__tests__/Focusable.test.tsx @@ -23,32 +23,46 @@ */ import { Component } from 'react' - -import { - expect, - find, - mount, - spy, - stub, - wait -} from '@instructure/ui-test-utils' +import { render, screen, waitFor } from '@testing-library/react' +import userEvent from '@testing-library/user-event' +import { vi } from 'vitest' +import type { MockInstance } from 'vitest' +import '@testing-library/jest-dom' import { Focusable } from '../index' import type { FocusableRenderOptions } from '../props' -describe('', async () => { - const lastCall = (spy: any) => spy.lastCall.args[0] +describe('', () => { + let consoleWarningMock: ReturnType + let consoleErrorMock: ReturnType + + beforeEach(() => { + // Mocking console to prevent test output pollution and expect for messages + consoleWarningMock = vi + .spyOn(console, 'warn') + .mockImplementation(() => {}) as MockInstance + + consoleErrorMock = vi + .spyOn(console, 'error') + .mockImplementation(() => {}) as MockInstance + }) + + afterEach(() => { + consoleWarningMock.mockRestore() + consoleErrorMock.mockRestore() + }) it('should render', async () => { - const subject = await mount( - {() => } - ) - expect(subject.getDOMNode()).to.exist() + render({() => }) + const button = screen.getByRole('button') + + expect(button).toBeInTheDocument() + expect(button).toHaveTextContent('hello world') }) it('should call children function with focused when element receives focus', async () => { - const renderSpy = spy() - await mount( + const renderSpy = vi.fn() + render( {(args) => { renderSpy(args) @@ -56,160 +70,131 @@ describe('', async () => { }} ) + const focusable = screen.getByRole('button') - const focusable = await find(':focusable') + await waitFor(() => { + const args = renderSpy.mock.lastCall![0] - await wait(() => { - expect(lastCall(renderSpy).focused).to.be.false() - expect(lastCall(renderSpy).focusable).to.equal(focusable.getDOMNode()) - expect(lastCall(renderSpy).focusVisible).to.be.false() + expect(args).toHaveProperty('focused', false) + expect(args).toHaveProperty('focusable', focusable) + expect(args).toHaveProperty('focusVisible', false) }) - await focusable.keyDown() // make sure we're back in keyboard mode + await userEvent.type(focusable, '{enter}') await focusable.focus() - await wait(() => { - expect(focusable.focused()).to.be.true() - expect(lastCall(renderSpy).focused).to.be.true() - expect(lastCall(renderSpy).focusable).to.equal(focusable.getDOMNode()) - - expect(lastCall(renderSpy).focusVisible).to.be.true() - }) - - await focusable.blur({}, { simulate: true }) + await waitFor(() => { + const args = renderSpy.mock.lastCall![0] - await wait(() => { - expect(focusable.focused()).to.be.false() - expect(lastCall(renderSpy).focused).to.equal(false) - expect(lastCall(renderSpy).focusable).to.equal(focusable.getDOMNode()) - expect(lastCall(renderSpy).focusVisible).to.equal(false) + expect(document.activeElement).toBe(focusable) + expect(args).toHaveProperty('focused', true) + expect(args).toHaveProperty('focusable', focusable) + expect(args).toHaveProperty('focusVisible', true) }) - }) - - it('should populate the focusVisible argument', async () => { - const renderSpy = spy() - - await mount( - - {(args) => { - renderSpy(args) - return - }} - - ) - const focusable = await find(':focusable') + await focusable.blur() - await focusable.mouseDown() - await focusable.focus() + await waitFor(() => { + const args = renderSpy.mock.lastCall![0] - await wait(() => { - expect(lastCall(renderSpy).focused).to.equal(true) - expect(lastCall(renderSpy).focusVisible).to.equal(false) + expect(document.activeElement).not.toBe(focusable) + expect(args).toHaveProperty('focused', false) + expect(args).toHaveProperty('focusable', focusable) + expect(args).toHaveProperty('focusVisible', false) }) }) it('should handle conditionally rendered focus elements', async () => { - const props = { - render: ({ focused }: { focused: boolean }) => { - return ( -
- {focused ? ( - - ) : ( - Click - )} -
- ) - } - } + const renderSpy = vi.fn(({ focused }) => ( +
+ {focused ? : Click} +
+ )) - const renderSpy = spy(props, 'render') + render() + const firstFocusable = screen.getByText('Click') - await mount() + expect(firstFocusable.tagName).toBe('A') + expect(firstFocusable).not.toHaveFocus() - const firstFocusable = await find(':focusable') + await waitFor(() => { + const args = renderSpy.mock.lastCall![0] - expect(firstFocusable.getTagName()).to.equal('a') - expect(firstFocusable.focused()).to.be.false() - - await wait(() => { - expect(lastCall(renderSpy).focused).to.be.false() - expect(lastCall(renderSpy).focusable).to.equal( - firstFocusable.getDOMNode() - ) + expect(args.focused).toBe(false) + expect(args.focusable).toBe(firstFocusable) }) await firstFocusable.focus() - const nextFocusable = await find(':focusable') + const nextFocusable = screen.getByRole('textbox') - expect(nextFocusable.getTagName()).to.equal('input') - expect(nextFocusable.focused()).to.be.true() + expect(nextFocusable.tagName).toBe('INPUT') + expect(nextFocusable).toHaveFocus() - await wait(() => { - expect(lastCall(renderSpy).focused).to.be.true() - expect(lastCall(renderSpy).focusable).to.equal(nextFocusable.getDOMNode()) + await waitFor(() => { + const args = renderSpy.mock.lastCall![0] + expect(args.focused).toBe(true) + expect(args.focusable).toBe(nextFocusable) }) - await nextFocusable.blur({}, { simulate: true }) + await nextFocusable.blur() - const lastFocusable = await find(':focusable') + const lastFocusable = screen.getByText('Click') - expect(lastFocusable.getTagName()).to.equal('a') - expect(lastFocusable.focused()).to.be.false() + expect(lastFocusable.tagName).toBe('A') + expect(lastFocusable).not.toHaveFocus() - await wait(() => { - expect(lastCall(renderSpy).focused).to.be.false() - expect(lastCall(renderSpy).focusable).to.equal(lastFocusable.getDOMNode()) + await waitFor(() => { + const args = renderSpy.mock.lastCall![0] + expect(args.focused).toBe(false) + expect(args.focusable).toBe(lastFocusable) }) }) it('should maintain focus when the focus element changes', async () => { - const props = { - render: () => { - return Click - } - } - - const renderSpy = spy(props, 'render') + const renderSpy = vi.fn(() => Click) - const subject = await mount() + const { rerender } = render() + const firstFocusable = screen.getByText('Click') - const firstFocusable = await find(':focusable') await firstFocusable.focus() - await wait(() => { - expect(firstFocusable.focused()).to.be.true() - expect(lastCall(renderSpy).focused).to.be.true() - expect(lastCall(renderSpy).focusable).to.equal( - firstFocusable.getDOMNode() - ) + await waitFor(() => { + const lastCall = renderSpy.mock.lastCall as + | [{ focused: boolean; focusable: HTMLElement }] + | undefined + const args = lastCall?.[0] + + expect(firstFocusable).toHaveFocus() + expect(args?.focused).toBe(true) + expect(args?.focusable).toBe(firstFocusable) }) - const nextProps = { - render: () => - } + // Set prop: render + const nextRenderSpy = vi.fn(() => ) + rerender() + + const nextFocusable = screen.getByText('Click') - const nextRenderSpy = spy(nextProps, 'render') - await subject.setProps(nextProps) + expect(nextFocusable.tagName).toBe('BUTTON') + expect(nextFocusable).toHaveFocus() - const nextFocusable = await find(':focusable') - expect(nextFocusable.getTagName()).to.equal('button') - expect(nextFocusable.focused()).to.be.true() + await waitFor(() => { + const nextLastCall = nextRenderSpy.mock.lastCall as + | [{ focused: boolean; focusable: HTMLElement }] + | undefined + const nextArgs = nextLastCall?.[0] - await wait(() => { - expect(lastCall(nextRenderSpy).focused).to.be.true() - expect(lastCall(nextRenderSpy).focusable).to.equal( - nextFocusable.getDOMNode() - ) + expect(nextFocusable).toHaveFocus() + expect(nextArgs?.focused).toBe(true) + expect(nextArgs?.focusable).toBe(nextFocusable) }) }) it('should update the focus element correctly', async () => { - const renderSpy = spy() + const renderSpy = vi.fn() - const subject = await mount( + const { rerender } = render( {(args) => { renderSpy(args) @@ -218,45 +203,50 @@ describe('', async () => { ) - const firstButton = await find('button:label(foo)') + const firstButton = screen.getByText('foo') await firstButton.focus() - await wait(() => { - expect(lastCall(renderSpy).focused).to.equal(true) + await waitFor(() => { + const args = renderSpy.mock.lastCall![0] + + expect(args.focused).toBe(true) }) - await firstButton.blur({}, { simulate: true }) + await firstButton.blur() - await wait(() => { - expect(lastCall(renderSpy).focused).to.equal(false) - }) + await waitFor(() => { + const args = renderSpy.mock.lastCall![0] - await subject.setProps({ - children: (args: FocusableRenderOptions) => { - renderSpy(args) - return ( - - some content text - - ) - } + expect(args.focused).toBe(false) }) - const secondButton = await find('button:label(bar)') + // Set child + rerender( + + {(args: FocusableRenderOptions) => { + renderSpy(args) + return ( + + some content text + + ) + }} + + ) + const secondButton = screen.getByText('bar') await secondButton.focus() - await wait(() => { - expect(lastCall(renderSpy).focused).to.equal(true) + await waitFor(() => { + const args = renderSpy.mock.lastCall![0] + + expect(args.focused).toBe(true) }) }) it('should warn when there is more than one focusable descendant', async () => { - const consoleWarn = stub(console, 'warn') - const warning = - 'Warning: [Focusable] Exactly one focusable child is required (2 found).' - await mount( + render( {() => { return ( @@ -270,27 +260,38 @@ describe('', async () => { }} ) - expect(consoleWarn).to.be.calledWith(warning) + + const expectedWarningMessage = + 'Warning: [Focusable] Exactly one focusable child is required (2 found).' + + expect(consoleWarningMock).toHaveBeenCalledWith( + expect.stringContaining(expectedWarningMessage), + expect.any(String) + ) }) it('should warn when there are no focusable descendants', async () => { - const consoleWarn = stub(console, 'warn') - const warning = - 'Warning: [Focusable] Exactly one focusable child is required (0 found).' - await mount( + render( {() => { return hello! }} ) - expect(consoleWarn).to.be.calledWith(warning) + + const expectedWarningMessage = + 'Warning: [Focusable] Exactly one focusable child is required (0 found).' + + expect(consoleWarningMock).toHaveBeenCalledWith( + expect.stringContaining(expectedWarningMessage), + expect.any(String) + ) }) it('should attach event listener correctly even when the focusable element is not the root', async () => { - const renderSpy = spy() + const renderSpy = vi.fn() - await mount( + render( {(args) => { renderSpy(args) @@ -307,22 +308,28 @@ describe('', async () => { ) - expect(lastCall(renderSpy).focused).to.equal(false) + const button = screen.getByRole('button') + + await waitFor(() => { + const args = renderSpy.mock.lastCall![0] + + expect(args.focused).toBe(false) + }) - const button = await find('button:label(foo)') await button.focus() - await wait(() => { - expect(lastCall(renderSpy).focused).to.equal(true) + await waitFor(() => { + const args = renderSpy.mock.lastCall![0] + + expect(args.focused).toBe(true) }) }) it('should provide a focus method', async () => { let focusable: Focusable - await mount( + render( { + ref={(el: Focusable) => { focusable = el }} > @@ -332,33 +339,36 @@ describe('', async () => { await focusable!.focus() - const button = await find('button:label(hello world)') + const button = screen.getByText('hello world') - expect(button.getDOMNode()).to.equal(document.activeElement) + expect(button).toHaveFocus() }) it('should provide a focused getter', async () => { - let focusable: Focusable + let focusableInstance: any - await mount( - { - focusable = el + render( + + {(args) => { + focusableInstance = args + return }} - > - {() => } ) + const button = screen.getByText('Click me') - await focusable!.focus() + expect(focusableInstance?.focused).toBe(false) - expect(focusable!.focused).to.equal(true) + await button.focus() + + await waitFor(() => { + expect(focusableInstance?.focused).toBe(true) + expect(button).toHaveFocus() + }) }) it('should properly restore the event handlers', async () => { - let inputRef: HTMLInputElement | null - + let inputRef: HTMLInputElement | null = null class TestComponent extends Component<{ changeValue: string }> { render() { const { changeValue } = this.props @@ -380,20 +390,20 @@ describe('', async () => { ) } } + const { rerender, container } = render() + const initialInput = container.querySelector('input') - const subject = await mount() - await wait(() => { - expect(inputRef!.value).to.equal('false_A') + await waitFor(() => { + expect(initialInput).toHaveValue('false_A') }) - await subject.setProps({ - changeValue: 'B' - }) + // Set Prop: changeValue + rerender() await inputRef!.focus() - await wait(() => { - expect(inputRef!.value).to.equal('true_B') + await waitFor(() => { + expect(inputRef).toHaveValue('true_B') }) }) @@ -453,21 +463,23 @@ describe('', async () => { } } - await mount() - await wait(() => { - expect(focusableRef!.focused).to.equal(false) + const { container } = render() + const input = container.querySelector('input') + + await waitFor(() => { + expect(focusableRef!.focused).toBe(false) }) - const input = await find('input[type="checkbox"]') + await userEvent.click(labelRef!) - await labelRef!.click() - await wait(() => { - expect(input.focused()).to.equal(true) + await waitFor(() => { + expect(input).toHaveFocus() }) - await buttonRef!.click() - await wait(() => { - expect(input.focused()).to.equal(false) + await userEvent.click(buttonRef!) + + await waitFor(() => { + expect(input).not.toHaveFocus() }) }) }) diff --git a/packages/ui-form-field/src/FormField/__new-tests__/FormField.test.tsx b/packages/ui-form-field/src/FormField/__tests__/FormField.test.tsx similarity index 100% rename from packages/ui-form-field/src/FormField/__new-tests__/FormField.test.tsx rename to packages/ui-form-field/src/FormField/__tests__/FormField.test.tsx diff --git a/packages/ui-form-field/src/FormFieldGroup/__new-tests__/FormFieldGroup.test.tsx b/packages/ui-form-field/src/FormFieldGroup/__tests__/FormFieldGroup.test.tsx similarity index 100% rename from packages/ui-form-field/src/FormFieldGroup/__new-tests__/FormFieldGroup.test.tsx rename to packages/ui-form-field/src/FormFieldGroup/__tests__/FormFieldGroup.test.tsx diff --git a/packages/ui-form-field/src/FormFieldLabel/__new-tests__/FormFieldLabel.test.tsx b/packages/ui-form-field/src/FormFieldLabel/__tests__/FormFieldLabel.test.tsx similarity index 100% rename from packages/ui-form-field/src/FormFieldLabel/__new-tests__/FormFieldLabel.test.tsx rename to packages/ui-form-field/src/FormFieldLabel/__tests__/FormFieldLabel.test.tsx diff --git a/packages/ui-form-field/src/FormFieldLayout/__new-tests__/FormFieldLayout.test.tsx b/packages/ui-form-field/src/FormFieldLayout/__tests__/FormFieldLayout.test.tsx similarity index 100% rename from packages/ui-form-field/src/FormFieldLayout/__new-tests__/FormFieldLayout.test.tsx rename to packages/ui-form-field/src/FormFieldLayout/__tests__/FormFieldLayout.test.tsx diff --git a/packages/ui-form-field/src/FormFieldMessage/__new-tests__/FormFieldMessage.test.tsx b/packages/ui-form-field/src/FormFieldMessage/__tests__/FormFieldMessage.test.tsx similarity index 100% rename from packages/ui-form-field/src/FormFieldMessage/__new-tests__/FormFieldMessage.test.tsx rename to packages/ui-form-field/src/FormFieldMessage/__tests__/FormFieldMessage.test.tsx diff --git a/packages/ui-form-field/src/FormFieldMessages/__new-tests__/FormFieldMessages.test.tsx b/packages/ui-form-field/src/FormFieldMessages/__tests__/FormFieldMessages.test.tsx similarity index 100% rename from packages/ui-form-field/src/FormFieldMessages/__new-tests__/FormFieldMessages.test.tsx rename to packages/ui-form-field/src/FormFieldMessages/__tests__/FormFieldMessages.test.tsx diff --git a/packages/ui-grid/src/Grid/__new-tests__/Grid.test.tsx b/packages/ui-grid/src/Grid/__tests__/Grid.test.tsx similarity index 100% rename from packages/ui-grid/src/Grid/__new-tests__/Grid.test.tsx rename to packages/ui-grid/src/Grid/__tests__/Grid.test.tsx diff --git a/packages/ui-grid/src/GridCol/__new-tests__/Grid.test.tsx b/packages/ui-grid/src/GridCol/__tests__/Grid.test.tsx similarity index 100% rename from packages/ui-grid/src/GridCol/__new-tests__/Grid.test.tsx rename to packages/ui-grid/src/GridCol/__tests__/Grid.test.tsx diff --git a/packages/ui-heading/src/Heading/__new-tests__/Heading.test.tsx b/packages/ui-heading/src/Heading/__tests__/Heading.test.tsx similarity index 100% rename from packages/ui-heading/src/Heading/__new-tests__/Heading.test.tsx rename to packages/ui-heading/src/Heading/__tests__/Heading.test.tsx diff --git a/packages/ui-i18n/src/ApplyLocale/__new-tests__/ApplyLocale.test.tsx b/packages/ui-i18n/src/ApplyLocale/__tests__/ApplyLocale.test.tsx similarity index 100% rename from packages/ui-i18n/src/ApplyLocale/__new-tests__/ApplyLocale.test.tsx rename to packages/ui-i18n/src/ApplyLocale/__tests__/ApplyLocale.test.tsx diff --git a/packages/ui-i18n/src/__new-tests__/DateTime.test.tsx b/packages/ui-i18n/src/__tests__/DateTime.test.tsx similarity index 100% rename from packages/ui-i18n/src/__new-tests__/DateTime.test.tsx rename to packages/ui-i18n/src/__tests__/DateTime.test.tsx diff --git a/packages/ui-i18n/src/__new-tests__/I18nPropTypes.test.tsx b/packages/ui-i18n/src/__tests__/I18nPropTypes.test.tsx similarity index 100% rename from packages/ui-i18n/src/__new-tests__/I18nPropTypes.test.tsx rename to packages/ui-i18n/src/__tests__/I18nPropTypes.test.tsx diff --git a/packages/ui-i18n/src/__new-tests__/Locale.test.tsx b/packages/ui-i18n/src/__tests__/Locale.test.tsx similarity index 100% rename from packages/ui-i18n/src/__new-tests__/Locale.test.tsx rename to packages/ui-i18n/src/__tests__/Locale.test.tsx diff --git a/packages/ui-i18n/src/__new-tests__/textDirectionContextConsumer.test.tsx b/packages/ui-i18n/src/__tests__/textDirectionContextConsumer.test.tsx similarity index 100% rename from packages/ui-i18n/src/__new-tests__/textDirectionContextConsumer.test.tsx rename to packages/ui-i18n/src/__tests__/textDirectionContextConsumer.test.tsx diff --git a/packages/ui-img/src/Img/__new-tests__/Img.test.tsx b/packages/ui-img/src/Img/__tests__/Img.test.tsx similarity index 100% rename from packages/ui-img/src/Img/__new-tests__/Img.test.tsx rename to packages/ui-img/src/Img/__tests__/Img.test.tsx diff --git a/packages/ui-link/src/Link/__new-tests__/Link.test.tsx b/packages/ui-link/src/Link/__tests__/Link.test.tsx similarity index 100% rename from packages/ui-link/src/Link/__new-tests__/Link.test.tsx rename to packages/ui-link/src/Link/__tests__/Link.test.tsx diff --git a/packages/ui-list/src/InlineList/InlineListItem/__new-tests__/InlineListItem.test.tsx b/packages/ui-list/src/InlineList/InlineListItem/__tests__/InlineListItem.test.tsx similarity index 100% rename from packages/ui-list/src/InlineList/InlineListItem/__new-tests__/InlineListItem.test.tsx rename to packages/ui-list/src/InlineList/InlineListItem/__tests__/InlineListItem.test.tsx diff --git a/packages/ui-list/src/InlineList/__new-tests__/InlineList.test.tsx b/packages/ui-list/src/InlineList/__tests__/InlineList.test.tsx similarity index 100% rename from packages/ui-list/src/InlineList/__new-tests__/InlineList.test.tsx rename to packages/ui-list/src/InlineList/__tests__/InlineList.test.tsx diff --git a/packages/ui-list/src/List/ListItem/__new-tests__/ListItem.test.tsx b/packages/ui-list/src/List/ListItem/__tests__/ListItem.test.tsx similarity index 100% rename from packages/ui-list/src/List/ListItem/__new-tests__/ListItem.test.tsx rename to packages/ui-list/src/List/ListItem/__tests__/ListItem.test.tsx diff --git a/packages/ui-list/src/List/__new-tests__/List.test.tsx b/packages/ui-list/src/List/__tests__/List.test.tsx similarity index 100% rename from packages/ui-list/src/List/__new-tests__/List.test.tsx rename to packages/ui-list/src/List/__tests__/List.test.tsx diff --git a/packages/ui-menu/src/Menu/MenuItem/__new-tests__/MenuItem.test.tsx b/packages/ui-menu/src/Menu/MenuItem/__tests__/MenuItem.test.tsx similarity index 100% rename from packages/ui-menu/src/Menu/MenuItem/__new-tests__/MenuItem.test.tsx rename to packages/ui-menu/src/Menu/MenuItem/__tests__/MenuItem.test.tsx diff --git a/packages/ui-menu/src/Menu/MenuItem/__tests__/theme.test.ts b/packages/ui-menu/src/Menu/MenuItem/__tests__/theme.test.ts deleted file mode 100644 index 66942a6b76..0000000000 --- a/packages/ui-menu/src/Menu/MenuItem/__tests__/theme.test.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('MenuItem.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - it('should ensure label color and icon color meet 3:1 contrast with background', () => { - expect(contrast(variables.background, variables.labelColor)).to.be.above( - 3 - ) - expect(contrast(variables.background, variables.iconColor)).to.be.above(3) - }) - it('should ensure label and icon active colors meet 3:1 contrast with active background', () => { - expect( - contrast(variables.activeBackground, variables.activeLabelColor) - ).to.be.above(3) - expect( - contrast(variables.activeBackground, variables.activeIconColor) - ).to.be.above(3) - }) - }) - - describe('with the "canvas-high-contrast" theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - it('should ensure label color and icon color meet 4.5:1 contrast with background', () => { - expect(contrast(variables.background, variables.labelColor)).to.be.above( - 4.5 - ) - expect(contrast(variables.background, variables.iconColor)).to.be.above( - 4.5 - ) - }) - it('should ensure label and icon active colors meet 4.5:1 contrast with active background', () => { - expect( - contrast(variables.activeBackground, variables.activeLabelColor) - ).to.be.above(4.5) - expect( - contrast(variables.activeBackground, variables.activeIconColor) - ).to.be.above(4.5) - }) - }) -}) diff --git a/packages/ui-menu/src/Menu/MenuItemGroup/__new-tests__/MenuItemGroup.test.tsx b/packages/ui-menu/src/Menu/MenuItemGroup/__tests__/MenuItemGroup.test.tsx similarity index 100% rename from packages/ui-menu/src/Menu/MenuItemGroup/__new-tests__/MenuItemGroup.test.tsx rename to packages/ui-menu/src/Menu/MenuItemGroup/__tests__/MenuItemGroup.test.tsx diff --git a/packages/ui-menu/src/Menu/MenuItemGroup/__tests__/theme.test.ts b/packages/ui-menu/src/Menu/MenuItemGroup/__tests__/theme.test.ts deleted file mode 100644 index d644e69b3a..0000000000 --- a/packages/ui-menu/src/Menu/MenuItemGroup/__tests__/theme.test.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('MenuItemGroup.theme', () => { - describe('with the canvas theme', () => { - const variables = generateComponentTheme(canvas) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect(contrast(variables.background, variables.color)).to.be.above(3) - }) - }) - - describe('with the high contrast canvas theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect(contrast(variables.background, variables.color)).to.be.above(4.5) - }) - }) -}) diff --git a/packages/ui-menu/src/Menu/__new-tests__/Menu.test.tsx b/packages/ui-menu/src/Menu/__tests__/Menu.test.tsx similarity index 100% rename from packages/ui-menu/src/Menu/__new-tests__/Menu.test.tsx rename to packages/ui-menu/src/Menu/__tests__/Menu.test.tsx diff --git a/packages/ui-metric/src/Metric/__new-tests__/Metric.test.tsx b/packages/ui-metric/src/Metric/__tests__/Metric.test.tsx similarity index 100% rename from packages/ui-metric/src/Metric/__new-tests__/Metric.test.tsx rename to packages/ui-metric/src/Metric/__tests__/Metric.test.tsx diff --git a/packages/ui-metric/src/MetricGroup/__new-tests__/MetricGroup.test.tsx b/packages/ui-metric/src/MetricGroup/__tests__/MetricGroup.test.tsx similarity index 100% rename from packages/ui-metric/src/MetricGroup/__new-tests__/MetricGroup.test.tsx rename to packages/ui-metric/src/MetricGroup/__tests__/MetricGroup.test.tsx diff --git a/packages/ui-modal/src/Modal/ModalBody/__new-tests__/ModalBody.test.tsx b/packages/ui-modal/src/Modal/ModalBody/__tests__/ModalBody.test.tsx similarity index 100% rename from packages/ui-modal/src/Modal/ModalBody/__new-tests__/ModalBody.test.tsx rename to packages/ui-modal/src/Modal/ModalBody/__tests__/ModalBody.test.tsx diff --git a/packages/ui-modal/src/Modal/ModalFooter/__new-tests__/ModalFooter.test.tsx b/packages/ui-modal/src/Modal/ModalFooter/__tests__/ModalFooter.test.tsx similarity index 100% rename from packages/ui-modal/src/Modal/ModalFooter/__new-tests__/ModalFooter.test.tsx rename to packages/ui-modal/src/Modal/ModalFooter/__tests__/ModalFooter.test.tsx diff --git a/packages/ui-modal/src/Modal/ModalHeader/__new-tests__/ModalHeader.test.tsx b/packages/ui-modal/src/Modal/ModalHeader/__tests__/ModalHeader.test.tsx similarity index 100% rename from packages/ui-modal/src/Modal/ModalHeader/__new-tests__/ModalHeader.test.tsx rename to packages/ui-modal/src/Modal/ModalHeader/__tests__/ModalHeader.test.tsx diff --git a/packages/ui-modal/src/Modal/__new-tests__/Modal.test.tsx b/packages/ui-modal/src/Modal/__tests__/Modal.test.tsx similarity index 100% rename from packages/ui-modal/src/Modal/__new-tests__/Modal.test.tsx rename to packages/ui-modal/src/Modal/__tests__/Modal.test.tsx diff --git a/packages/ui-motion/src/Transition/__new-tests__/Transition.test.tsx b/packages/ui-motion/src/Transition/__tests__/Transition.test.tsx similarity index 100% rename from packages/ui-motion/src/Transition/__new-tests__/Transition.test.tsx rename to packages/ui-motion/src/Transition/__tests__/Transition.test.tsx diff --git a/packages/ui-navigation/src/AppNav/Item/__new-tests__/Item.test.tsx b/packages/ui-navigation/src/AppNav/Item/__tests__/Item.test.tsx similarity index 100% rename from packages/ui-navigation/src/AppNav/Item/__new-tests__/Item.test.tsx rename to packages/ui-navigation/src/AppNav/Item/__tests__/Item.test.tsx diff --git a/packages/ui-navigation/src/AppNav/Item/__tests__/theme.test.ts b/packages/ui-navigation/src/AppNav/Item/__tests__/theme.test.ts deleted file mode 100644 index f36468f07c..0000000000 --- a/packages/ui-navigation/src/AppNav/Item/__tests__/theme.test.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { contrast } from '@instructure/ui-color-utils' -import { expect } from '@instructure/ui-test-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('AppNav.Item.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - it('should have a background and text color that meets 3:1 contrast', () => { - expect( - contrast(variables.backgroundColor, variables.textColor) - ).to.be.above(3) - }) - - it('should have a background and selected item text color that meets 3:1 contrast', () => { - expect( - contrast(variables.backgroundColor, variables.textColorSelected) - ).to.be.above(3) - }) - }) - - describe('with the high contrast canvas theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - it('should have a background and text color that meets 4.5:1 contrast', () => { - expect( - contrast(variables.backgroundColor, variables.textColor) - ).to.be.above(4.5) - }) - - it('should have a background and selected item text color that meets 4.5:1 contrast', () => { - expect( - contrast(variables.backgroundColor, variables.textColorSelected) - ).to.be.above(4.5) - }) - }) -}) diff --git a/packages/ui-navigation/src/AppNav/__new-tests__/AppNav.test.tsx b/packages/ui-navigation/src/AppNav/__tests__/AppNav.test.tsx similarity index 100% rename from packages/ui-navigation/src/AppNav/__new-tests__/AppNav.test.tsx rename to packages/ui-navigation/src/AppNav/__tests__/AppNav.test.tsx diff --git a/packages/ui-number-input/src/NumberInput/__new-tests__/NumberInput.test.tsx b/packages/ui-number-input/src/NumberInput/__tests__/NumberInput.test.tsx similarity index 100% rename from packages/ui-number-input/src/NumberInput/__new-tests__/NumberInput.test.tsx rename to packages/ui-number-input/src/NumberInput/__tests__/NumberInput.test.tsx diff --git a/packages/ui-options/src/Options/Item/__new-tests__/Item.test.tsx b/packages/ui-options/src/Options/Item/__tests__/Item.test.tsx similarity index 100% rename from packages/ui-options/src/Options/Item/__new-tests__/Item.test.tsx rename to packages/ui-options/src/Options/Item/__tests__/Item.test.tsx diff --git a/packages/ui-options/src/Options/Item/__tests__/theme.test.ts b/packages/ui-options/src/Options/Item/__tests__/theme.test.ts deleted file mode 100644 index 546eb11e09..0000000000 --- a/packages/ui-options/src/Options/Item/__tests__/theme.test.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { contrast } from '@instructure/ui-color-utils' -import { expect } from '@instructure/ui-test-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('Item.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - it('should have default background and text colors that meet 3:1 contrast', () => { - expect(contrast(variables.background, variables.color)).to.be.above(3) - }) - - it('should have default background and description text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.background, variables.descriptionColor) - ).to.be.above(3) - }) - - it('should have highlighted background and text colors that meet 3:1 contrast', () => { - expect( - contrast( - variables.highlightedBackground, - variables.highlightedLabelColor - ) - ).to.be.above(3) - }) - - it('should have selected background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.selectedBackground, variables.selectedLabelColor) - ).to.be.above(3) - }) - }) - - describe('with the high contrast canvas theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - it('should have default background and text colors that meet 4.5:1 contrast', () => { - expect(contrast(variables.background, variables.color)).to.be.above(4.5) - }) - - it('should have default background and description text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.background, variables.descriptionColor) - ).to.be.above(4.5) - }) - - it('should have highlighted background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast( - variables.highlightedBackground, - variables.highlightedLabelColor - ) - ).to.be.above(4.5) - }) - - it('should have selected background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.selectedBackground, variables.selectedLabelColor) - ).to.be.above(4.5) - }) - }) -}) diff --git a/packages/ui-options/src/Options/__new-tests__/Options.test.tsx b/packages/ui-options/src/Options/__tests__/Options.test.tsx similarity index 100% rename from packages/ui-options/src/Options/__new-tests__/Options.test.tsx rename to packages/ui-options/src/Options/__tests__/Options.test.tsx diff --git a/packages/ui-options/src/Options/__tests__/theme.test.ts b/packages/ui-options/src/Options/__tests__/theme.test.ts deleted file mode 100644 index 707d0a60f9..0000000000 --- a/packages/ui-options/src/Options/__tests__/theme.test.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { contrast } from '@instructure/ui-color-utils' -import { expect } from '@instructure/ui-test-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('Options.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect(contrast(variables.background, variables.labelColor)).to.be.above( - 3 - ) - }) - }) - - describe('with the high contrast canvas theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect(contrast(variables.background, variables.labelColor)).to.be.above( - 4.5 - ) - }) - }) -}) diff --git a/packages/ui-overlays/src/Mask/__new-tests__/Mask.test.tsx b/packages/ui-overlays/src/Mask/__tests__/Mask.test.tsx similarity index 100% rename from packages/ui-overlays/src/Mask/__new-tests__/Mask.test.tsx rename to packages/ui-overlays/src/Mask/__tests__/Mask.test.tsx diff --git a/packages/ui-overlays/src/Overlay/__new-tests__/Overlay.test.tsx b/packages/ui-overlays/src/Overlay/__tests__/Overlay.test.tsx similarity index 100% rename from packages/ui-overlays/src/Overlay/__new-tests__/Overlay.test.tsx rename to packages/ui-overlays/src/Overlay/__tests__/Overlay.test.tsx diff --git a/packages/ui-pages/src/Pages/Page/__new-tests__/Page.test.tsx b/packages/ui-pages/src/Pages/Page/__tests__/Page.test.tsx similarity index 100% rename from packages/ui-pages/src/Pages/Page/__new-tests__/Page.test.tsx rename to packages/ui-pages/src/Pages/Page/__tests__/Page.test.tsx diff --git a/packages/ui-pages/src/Pages/__new-tests__/Pages.test.tsx b/packages/ui-pages/src/Pages/__tests__/Pages.test.tsx similarity index 100% rename from packages/ui-pages/src/Pages/__new-tests__/Pages.test.tsx rename to packages/ui-pages/src/Pages/__tests__/Pages.test.tsx diff --git a/packages/ui-pages/src/Pages/__tests__/theme.test.ts b/packages/ui-pages/src/Pages/__tests__/theme.test.ts deleted file mode 100644 index ded7565cd3..0000000000 --- a/packages/ui-pages/src/Pages/__tests__/theme.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' -import generateComponentTheme from '../theme' -import { canvas, canvasHighContrast } from '@instructure/ui-themes' - -describe('Pages.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect(contrast(variables.background, variables.color)).to.be.above(3) - }) - }) - - describe('with the high contrast canvas theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect(contrast(variables.background, variables.color)).to.be.above(4.5) - }) - }) -}) diff --git a/packages/ui-pagination/src/Pagination/PaginationArrowButton/__new-tests__/PaginationArrowButton.test.tsx b/packages/ui-pagination/src/Pagination/PaginationArrowButton/__tests__/PaginationArrowButton.test.tsx similarity index 100% rename from packages/ui-pagination/src/Pagination/PaginationArrowButton/__new-tests__/PaginationArrowButton.test.tsx rename to packages/ui-pagination/src/Pagination/PaginationArrowButton/__tests__/PaginationArrowButton.test.tsx diff --git a/packages/ui-pagination/src/Pagination/PaginationButton/__new-tests__/PaginationButton.test.tsx b/packages/ui-pagination/src/Pagination/PaginationButton/__tests__/PaginationButton.test.tsx similarity index 100% rename from packages/ui-pagination/src/Pagination/PaginationButton/__new-tests__/PaginationButton.test.tsx rename to packages/ui-pagination/src/Pagination/PaginationButton/__tests__/PaginationButton.test.tsx diff --git a/packages/ui-pagination/src/Pagination/PaginationPageInput/__new-tests__/PaginationPageInput.test.tsx b/packages/ui-pagination/src/Pagination/PaginationPageInput/__tests__/PaginationPageInput.test.tsx similarity index 100% rename from packages/ui-pagination/src/Pagination/PaginationPageInput/__new-tests__/PaginationPageInput.test.tsx rename to packages/ui-pagination/src/Pagination/PaginationPageInput/__tests__/PaginationPageInput.test.tsx diff --git a/packages/ui-pagination/src/Pagination/__new-tests__/Pagination.test.tsx b/packages/ui-pagination/src/Pagination/__tests__/Pagination.test.tsx similarity index 100% rename from packages/ui-pagination/src/Pagination/__new-tests__/Pagination.test.tsx rename to packages/ui-pagination/src/Pagination/__tests__/Pagination.test.tsx diff --git a/packages/ui-pill/package.json b/packages/ui-pill/package.json index 8a1940aaf0..7d38bbc08d 100644 --- a/packages/ui-pill/package.json +++ b/packages/ui-pill/package.json @@ -41,8 +41,6 @@ "@instructure/ui-color-utils": "10.19.1", "@instructure/ui-icons": "10.19.1", "@instructure/ui-scripts": "10.19.1", - "@instructure/ui-test-locator": "10.19.1", - "@instructure/ui-test-queries": "10.19.1", "@instructure/ui-test-utils": "10.19.1", "@instructure/ui-themes": "10.19.1", "@testing-library/jest-dom": "^6.6.3", diff --git a/packages/ui-pill/src/Pill/PillLocator.ts b/packages/ui-pill/src/Pill/PillLocator.ts deleted file mode 100644 index 556f0ccba8..0000000000 --- a/packages/ui-pill/src/Pill/PillLocator.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { locator } from '@instructure/ui-test-locator' -import { parseQueryArguments } from '@instructure/ui-test-queries' -// @ts-ignore: Cannot find module -// eslint-disable-next-line no-restricted-imports -import { TooltipLocator } from '@instructure/ui-tooltip/es/Tooltip/TooltipLocator' - -import { Pill } from './index' - -// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message -export const PillLocator = locator(Pill.selector, { - findTooltipContent: async (...args: any[]) => { - const { element, selector, options } = parseQueryArguments(...args) - const tooltip = await TooltipLocator.find(element, options) - return tooltip ? tooltip.findContent(selector, options) : null - } -}) diff --git a/packages/ui-pill/src/Pill/__new-tests__/Pill.test.tsx b/packages/ui-pill/src/Pill/__tests__/Pill.test.tsx similarity index 100% rename from packages/ui-pill/src/Pill/__new-tests__/Pill.test.tsx rename to packages/ui-pill/src/Pill/__tests__/Pill.test.tsx diff --git a/packages/ui-pill/src/Pill/__tests__/theme.test.ts b/packages/ui-pill/src/Pill/__tests__/theme.test.ts deleted file mode 100644 index 2b0763c935..0000000000 --- a/packages/ui-pill/src/Pill/__tests__/theme.test.ts +++ /dev/null @@ -1,108 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('Pill.theme', () => { - describe('with the canvas theme', () => { - const variables = generateComponentTheme(canvas) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.background, variables.primaryColor) - ).to.be.above(3) - }) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect(contrast(variables.background, variables.infoColor)).to.be.above(3) - }) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect(contrast(variables.background, variables.dangerColor)).to.be.above( - 3 - ) - }) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.background, variables.successColor) - ).to.be.above(3) - }) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.background, variables.warningColor) - ).to.be.above(3) - }) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect(contrast(variables.background, variables.alertColor)).to.be.above( - 3 - ) - }) - }) - - describe('with the high contrast canvas theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.background, variables.primaryColor) - ).to.be.above(3) - }) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect(contrast(variables.background, variables.infoColor)).to.be.above( - 4.5 - ) - }) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect(contrast(variables.background, variables.dangerColor)).to.be.above( - 3 - ) - }) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.background, variables.successColor) - ).to.be.above(3) - }) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.background, variables.warningColor) - ).to.be.above(3) - }) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect(contrast(variables.background, variables.alertColor)).to.be.above( - 3 - ) - }) - }) -}) diff --git a/packages/ui-pill/src/Pill/locator.ts b/packages/ui-pill/src/Pill/locator.ts deleted file mode 100644 index 1b034c0752..0000000000 --- a/packages/ui-pill/src/Pill/locator.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { PillLocator } from './PillLocator' - -export { PillLocator } -export default PillLocator diff --git a/packages/ui-pill/tsconfig.build.json b/packages/ui-pill/tsconfig.build.json index 6f9eb69f8f..fb18ebd4d3 100644 --- a/packages/ui-pill/tsconfig.build.json +++ b/packages/ui-pill/tsconfig.build.json @@ -18,8 +18,6 @@ { "path": "../ui-view/tsconfig.build.json" }, { "path": "../ui-babel-preset/tsconfig.build.json" }, { "path": "../ui-color-utils/tsconfig.build.json" }, - { "path": "../ui-test-locator/tsconfig.build.json" }, - { "path": "../ui-test-queries/tsconfig.build.json" }, { "path": "../ui-test-utils/tsconfig.build.json" }, { "path": "../ui-axe-check/tsconfig.build.json" }, { "path": "../ui-scripts/tsconfig.build.json" }, diff --git a/packages/ui-popover/package.json b/packages/ui-popover/package.json index 1949ed5d90..765c24be5a 100644 --- a/packages/ui-popover/package.json +++ b/packages/ui-popover/package.json @@ -44,8 +44,6 @@ "devDependencies": { "@instructure/ui-babel-preset": "10.19.1", "@instructure/ui-color-utils": "10.19.1", - "@instructure/ui-test-locator": "10.19.1", - "@instructure/ui-test-queries": "10.19.1", "@instructure/ui-test-utils": "10.19.1", "@testing-library/jest-dom": "^6.6.3", "@testing-library/react": "^16.0.1", diff --git a/packages/ui-popover/src/Popover/PopoverLocator.ts b/packages/ui-popover/src/Popover/PopoverLocator.ts deleted file mode 100644 index 2c7e1d7910..0000000000 --- a/packages/ui-popover/src/Popover/PopoverLocator.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { locator } from '@instructure/ui-test-locator' -// @ts-ignore: Cannot find module -// eslint-disable-next-line no-restricted-imports -import { PositionLocator } from '@instructure/ui-position/es/Position/PositionLocator' - -import { Popover } from './index' -import { PopoverTriggerLocator } from './PopoverTriggerLocator' - -export const customMethods = { - findContent: (...args: any[]) => PositionLocator.findContent(...args), - findPositionTarget: (...args: any[]) => PositionLocator.findTarget(...args), - findTrigger: (...args: any[]) => PopoverTriggerLocator.find(...args) -} - -export { PopoverTriggerLocator } -// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message -export const PopoverLocator = locator(Popover.selector, customMethods) diff --git a/packages/ui-popover/src/Popover/PopoverTriggerLocator.ts b/packages/ui-popover/src/Popover/PopoverTriggerLocator.ts deleted file mode 100644 index 010c1443d4..0000000000 --- a/packages/ui-popover/src/Popover/PopoverTriggerLocator.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { locator } from '@instructure/ui-test-locator' - -export const PopoverTriggerLocator = locator('[data-popover-trigger]') diff --git a/packages/ui-popover/src/Popover/__new-tests__/Popover.test.tsx b/packages/ui-popover/src/Popover/__tests__/Popover.test.tsx similarity index 100% rename from packages/ui-popover/src/Popover/__new-tests__/Popover.test.tsx rename to packages/ui-popover/src/Popover/__tests__/Popover.test.tsx diff --git a/packages/ui-popover/src/Popover/locator.ts b/packages/ui-popover/src/Popover/locator.ts deleted file mode 100644 index 3ae708a71c..0000000000 --- a/packages/ui-popover/src/Popover/locator.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { PopoverLocator } from './PopoverLocator' - -export { PopoverTriggerLocator, customMethods } from './PopoverLocator' -export { PopoverLocator } -export default PopoverLocator diff --git a/packages/ui-popover/tsconfig.build.json b/packages/ui-popover/tsconfig.build.json index ed305ce490..a6135cc8af 100644 --- a/packages/ui-popover/tsconfig.build.json +++ b/packages/ui-popover/tsconfig.build.json @@ -23,8 +23,6 @@ { "path": "../uid/tsconfig.build.json" }, { "path": "../ui-babel-preset/tsconfig.build.json" }, { "path": "../ui-color-utils/tsconfig.build.json" }, - { "path": "../ui-test-locator/tsconfig.build.json" }, - { "path": "../ui-test-queries/tsconfig.build.json" }, { "path": "../ui-test-utils/tsconfig.build.json" } ] } diff --git a/packages/ui-portal/src/Portal/__new-tests__/Portal.test.tsx b/packages/ui-portal/src/Portal/__tests__/Portal.test.tsx similarity index 100% rename from packages/ui-portal/src/Portal/__new-tests__/Portal.test.tsx rename to packages/ui-portal/src/Portal/__tests__/Portal.test.tsx diff --git a/packages/ui-position/package.json b/packages/ui-position/package.json index cfe20d52fd..2c5d13011e 100644 --- a/packages/ui-position/package.json +++ b/packages/ui-position/package.json @@ -39,7 +39,6 @@ "devDependencies": { "@instructure/ui-babel-preset": "10.19.1", "@instructure/ui-color-utils": "10.19.1", - "@instructure/ui-test-locator": "10.19.1", "@instructure/ui-test-utils": "10.19.1", "@instructure/ui-themes": "10.19.1", "@testing-library/jest-dom": "^6.6.3", diff --git a/packages/ui-position/src/Position/PositionContentLocator.ts b/packages/ui-position/src/Position/PositionContentLocator.ts deleted file mode 100644 index 6d59d8951a..0000000000 --- a/packages/ui-position/src/Position/PositionContentLocator.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { locator } from '@instructure/ui-test-locator' -import { Position } from './index' - -export const PositionContentLocator = locator( - `[${Position.contentLocatorAttribute}]` -) diff --git a/packages/ui-position/src/Position/PositionLocator.ts b/packages/ui-position/src/Position/PositionLocator.ts deleted file mode 100644 index c1b8fa1f5b..0000000000 --- a/packages/ui-position/src/Position/PositionLocator.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -import { locator } from '@instructure/ui-test-locator' -import { Position } from './index' - -import { PositionContentLocator } from './PositionContentLocator' -import { PositionTargetLocator } from './PositionTargetLocator' - -export const customMethods = { - findTarget: (element: Element, ...args: any) => { - if (element && element.getAttribute) { - const id = element.getAttribute(Position.locatorAttribute) - return locator(`[${Position.targetLocatorAttribute}="${id}"]`).find( - ...args - ) - } - throw new Error('Element ' + element + ' not found') - }, - findContent: (element: Element, ...args: any) => { - if (element && element.getAttribute) { - const id = element.getAttribute(Position.locatorAttribute) - return locator(`[${Position.contentLocatorAttribute}="${id}"]`).find( - ...args - ) - } - throw new Error('Element ' + element + ' not found') - } -} - -export { PositionContentLocator } -export { PositionTargetLocator } - -// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message -export const PositionLocator = locator(Position.selector, customMethods) diff --git a/packages/ui-position/src/Position/PositionTargetLocator.ts b/packages/ui-position/src/Position/PositionTargetLocator.ts deleted file mode 100644 index 158b6d9467..0000000000 --- a/packages/ui-position/src/Position/PositionTargetLocator.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { Position } from './index' -import { locator } from '@instructure/ui-test-locator' - -export const PositionTargetLocator = locator( - `[${Position.targetLocatorAttribute}]` -) diff --git a/packages/ui-position/src/Position/__new-tests__/Position.test.tsx b/packages/ui-position/src/Position/__tests__/Position.test.tsx similarity index 100% rename from packages/ui-position/src/Position/__new-tests__/Position.test.tsx rename to packages/ui-position/src/Position/__tests__/Position.test.tsx diff --git a/packages/ui-position/src/Position/locator.ts b/packages/ui-position/src/Position/locator.ts deleted file mode 100644 index c550dff4f6..0000000000 --- a/packages/ui-position/src/Position/locator.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { PositionLocator } from './PositionLocator' - -export { - PositionContentLocator, - PositionTargetLocator, - customMethods -} from './PositionLocator' - -export { PositionLocator } -export default PositionLocator diff --git a/packages/ui-position/src/__new-tests__/mirrorHorizontalPlacement.test.tsx b/packages/ui-position/src/__tests__/mirrorHorizontalPlacement.test.tsx similarity index 100% rename from packages/ui-position/src/__new-tests__/mirrorHorizontalPlacement.test.tsx rename to packages/ui-position/src/__tests__/mirrorHorizontalPlacement.test.tsx diff --git a/packages/ui-position/src/__new-tests__/mirrorPlacement.test.tsx b/packages/ui-position/src/__tests__/mirrorPlacement.test.tsx similarity index 100% rename from packages/ui-position/src/__new-tests__/mirrorPlacement.test.tsx rename to packages/ui-position/src/__tests__/mirrorPlacement.test.tsx diff --git a/packages/ui-position/tsconfig.build.json b/packages/ui-position/tsconfig.build.json index 25d47a52fb..a2710743e0 100644 --- a/packages/ui-position/tsconfig.build.json +++ b/packages/ui-position/tsconfig.build.json @@ -43,9 +43,6 @@ { "path": "../ui-color-utils/tsconfig.build.json" }, - { - "path": "../ui-test-locator/tsconfig.build.json" - }, { "path": "../ui-test-utils/tsconfig.build.json" }, diff --git a/packages/ui-progress/src/ProgressBar/__new-tests__/ProgressBar.test.tsx b/packages/ui-progress/src/ProgressBar/__tests__/ProgressBar.test.tsx similarity index 100% rename from packages/ui-progress/src/ProgressBar/__new-tests__/ProgressBar.test.tsx rename to packages/ui-progress/src/ProgressBar/__tests__/ProgressBar.test.tsx diff --git a/packages/ui-progress/src/ProgressBar/__tests__/theme.test.ts b/packages/ui-progress/src/ProgressBar/__tests__/theme.test.ts deleted file mode 100644 index 485b5c1f72..0000000000 --- a/packages/ui-progress/src/ProgressBar/__tests__/theme.test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('ProgressBar.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - it('should ensure brand meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorBrand, variables.trackColor) - ).to.be.above(3) - }) - it('should ensure info meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorInfo, variables.trackColor) - ).to.be.above(3) - }) - it('should ensure success meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorSuccess, variables.trackColor) - ).to.be.above(3) - }) - it('should ensure danger meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorDanger, variables.trackColor) - ).to.be.above(3) - }) - it('should ensure warning meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorWarning, variables.trackColor) - ).to.be.above(3) - }) - it('should ensure alert meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorAlert, variables.trackColor) - ).to.be.above(3) - }) - }) - - describe('with the "canvas-high-contrast" theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - it('should ensure brand meter color and track color meet 4.5:1 contrast', () => { - expect( - contrast(variables.meterColorBrand, variables.trackColor) - ).to.be.above(4.5) - }) - it('should ensure info meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorInfo, variables.trackColor) - ).to.be.above(4.5) - }) - it('should ensure success meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorSuccess, variables.trackColor) - ).to.be.above(4.5) - }) - it('should ensure danger meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorDanger, variables.trackColor) - ).to.be.above(4.5) - }) - it('should ensure warning meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorWarning, variables.trackColor) - ).to.be.above(4.5) - }) - it('should ensure alert meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorAlert, variables.trackColor) - ).to.be.above(4.5) - }) - }) -}) diff --git a/packages/ui-progress/src/ProgressCircle/__new-tests__/ProgressCircle.test.tsx b/packages/ui-progress/src/ProgressCircle/__tests__/ProgressCircle.test.tsx similarity index 100% rename from packages/ui-progress/src/ProgressCircle/__new-tests__/ProgressCircle.test.tsx rename to packages/ui-progress/src/ProgressCircle/__tests__/ProgressCircle.test.tsx diff --git a/packages/ui-progress/src/ProgressCircle/__tests__/theme.test.ts b/packages/ui-progress/src/ProgressCircle/__tests__/theme.test.ts deleted file mode 100644 index 5b1a19bbcc..0000000000 --- a/packages/ui-progress/src/ProgressCircle/__tests__/theme.test.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('ProgressCircle.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - describe('default', () => { - it('should ensure brand meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorBrand, variables.trackColor) - ).to.be.above(3) - }) - it('should ensure info meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorInfo, variables.trackColor) - ).to.be.above(3) - }) - it('should ensure success meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorSuccess, variables.trackColor) - ).to.be.above(3) - }) - it('should ensure danger meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorDanger, variables.trackColor) - ).to.be.above(3) - }) - it('should ensure warning meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorWarning, variables.trackColor) - ).to.be.above(3) - }) - it('should ensure alert meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorAlert, variables.trackColor) - ).to.be.above(3) - }) - }) - }) - - describe('with the "canvas-high-contrast" theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - describe('default', () => { - it('should ensure brand meter color and track color meet 4.5:1 contrast', () => { - expect( - contrast(variables.meterColorBrand, variables.trackColor) - ).to.be.above(4.5) - }) - it('should ensure info meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorInfo, variables.trackColor) - ).to.be.above(4.5) - }) - it('should ensure success meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorSuccess, variables.trackColor) - ).to.be.above(4.5) - }) - it('should ensure danger meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorDanger, variables.trackColor) - ).to.be.above(4.5) - }) - it('should ensure warning meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorWarning, variables.trackColor) - ).to.be.above(4.5) - }) - it('should ensure alert meter color and track color meet 3:1 contrast', () => { - expect( - contrast(variables.meterColorAlert, variables.trackColor) - ).to.be.above(4.5) - }) - }) - }) -}) diff --git a/packages/ui-prop-types/src/__new-tests__/children.test.tsx b/packages/ui-prop-types/src/__tests__/children.test.tsx similarity index 100% rename from packages/ui-prop-types/src/__new-tests__/children.test.tsx rename to packages/ui-prop-types/src/__tests__/children.test.tsx diff --git a/packages/ui-prop-types/src/__new-tests__/childrenOrValue.test.tsx b/packages/ui-prop-types/src/__tests__/childrenOrValue.test.tsx similarity index 100% rename from packages/ui-prop-types/src/__new-tests__/childrenOrValue.test.tsx rename to packages/ui-prop-types/src/__tests__/childrenOrValue.test.tsx diff --git a/packages/ui-prop-types/src/__new-tests__/controllable.test.tsx b/packages/ui-prop-types/src/__tests__/controllable.test.tsx similarity index 100% rename from packages/ui-prop-types/src/__new-tests__/controllable.test.tsx rename to packages/ui-prop-types/src/__tests__/controllable.test.tsx diff --git a/packages/ui-prop-types/src/__new-tests__/makeRequirable.test.tsx b/packages/ui-prop-types/src/__tests__/makeRequirable.test.tsx similarity index 100% rename from packages/ui-prop-types/src/__new-tests__/makeRequirable.test.tsx rename to packages/ui-prop-types/src/__tests__/makeRequirable.test.tsx diff --git a/packages/ui-prop-types/src/__new-tests__/xor.test.tsx b/packages/ui-prop-types/src/__tests__/xor.test.tsx similarity index 100% rename from packages/ui-prop-types/src/__new-tests__/xor.test.tsx rename to packages/ui-prop-types/src/__tests__/xor.test.tsx diff --git a/packages/ui-radio-input/src/RadioInput/__new-tests__/RadioInput.test.tsx b/packages/ui-radio-input/src/RadioInput/__tests__/RadioInput.test.tsx similarity index 100% rename from packages/ui-radio-input/src/RadioInput/__new-tests__/RadioInput.test.tsx rename to packages/ui-radio-input/src/RadioInput/__tests__/RadioInput.test.tsx diff --git a/packages/ui-radio-input/src/RadioInput/__tests__/theme.test.ts b/packages/ui-radio-input/src/RadioInput/__tests__/theme.test.ts deleted file mode 100644 index 2572d100ed..0000000000 --- a/packages/ui-radio-input/src/RadioInput/__tests__/theme.test.ts +++ /dev/null @@ -1,81 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('RadioInput.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - it('should ensure toggle text meets 3:1 contrast with success-state background', () => { - expect( - contrast(variables.toggleBackgroundSuccess, variables.toggleHandleText) - ).to.be.above(3) - }) - it('should ensure toggle text meets 3:1 contrast with off-state background', () => { - expect( - contrast(variables.toggleBackgroundOff, variables.toggleHandleText) - ).to.be.above(3) - }) - it('should ensure toggle text meets 3:1 contrast with warning-state background', () => { - expect( - contrast(variables.toggleBackgroundWarning, variables.toggleHandleText) - ).to.be.above(3) - }) - it('should ensure toggle text meets 3:1 contrast with danger-state background', () => { - expect( - contrast(variables.toggleBackgroundDanger, variables.toggleHandleText) - ).to.be.above(3) - }) - }) - - describe('with the "canvas-high-contrast" theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - it('should ensure toggle text meets 4.5:1 contrast with success-state background', () => { - expect( - contrast(variables.toggleBackgroundSuccess, variables.toggleHandleText) - ).to.be.above(4.5) - }) - it('should ensure toggle text meets 4.5:1 contrast with off-state background', () => { - expect( - contrast(variables.toggleBackgroundOff, variables.toggleHandleText) - ).to.be.above(4.5) - }) - it('should ensure toggle text meets 4.5:1 contrast with warning-state background', () => { - expect( - contrast(variables.toggleBackgroundWarning, variables.toggleHandleText) - ).to.be.above(4.5) - }) - it('should ensure toggle text meets 4.5:1 contrast with danger-state background', () => { - expect( - contrast(variables.toggleBackgroundDanger, variables.toggleHandleText) - ).to.be.above(4.5) - }) - }) -}) diff --git a/packages/ui-radio-input/src/RadioInputGroup/__new-tests__/RadioInputGroup.test.tsx b/packages/ui-radio-input/src/RadioInputGroup/__tests__/RadioInputGroup.test.tsx similarity index 100% rename from packages/ui-radio-input/src/RadioInputGroup/__new-tests__/RadioInputGroup.test.tsx rename to packages/ui-radio-input/src/RadioInputGroup/__tests__/RadioInputGroup.test.tsx diff --git a/packages/ui-range-input/src/RangeInput/__new-tests__/RangeInput.test.tsx b/packages/ui-range-input/src/RangeInput/__tests__/RangeInput.test.tsx similarity index 100% rename from packages/ui-range-input/src/RangeInput/__new-tests__/RangeInput.test.tsx rename to packages/ui-range-input/src/RangeInput/__tests__/RangeInput.test.tsx diff --git a/packages/ui-rating/src/Rating/__new-tests__/Rating.test.tsx b/packages/ui-rating/src/Rating/__tests__/Rating.test.tsx similarity index 100% rename from packages/ui-rating/src/Rating/__new-tests__/Rating.test.tsx rename to packages/ui-rating/src/Rating/__tests__/Rating.test.tsx diff --git a/packages/ui-rating/src/RatingIcon/__new-tests__/RatingIcon.test.tsx b/packages/ui-rating/src/RatingIcon/__tests__/RatingIcon.test.tsx similarity index 100% rename from packages/ui-rating/src/RatingIcon/__new-tests__/RatingIcon.test.tsx rename to packages/ui-rating/src/RatingIcon/__tests__/RatingIcon.test.tsx diff --git a/packages/ui-react-utils/src/__new-tests__/DeterministicIdContext.test.tsx b/packages/ui-react-utils/src/__tests__/DeterministicIdContext.test.tsx similarity index 100% rename from packages/ui-react-utils/src/__new-tests__/DeterministicIdContext.test.tsx rename to packages/ui-react-utils/src/__tests__/DeterministicIdContext.test.tsx diff --git a/packages/ui-react-utils/src/__new-tests__/callRenderProp.test.tsx b/packages/ui-react-utils/src/__tests__/callRenderProp.test.tsx similarity index 100% rename from packages/ui-react-utils/src/__new-tests__/callRenderProp.test.tsx rename to packages/ui-react-utils/src/__tests__/callRenderProp.test.tsx diff --git a/packages/ui-react-utils/src/__new-tests__/deprecated.test.tsx b/packages/ui-react-utils/src/__tests__/deprecated.test.tsx similarity index 100% rename from packages/ui-react-utils/src/__new-tests__/deprecated.test.tsx rename to packages/ui-react-utils/src/__tests__/deprecated.test.tsx diff --git a/packages/ui-react-utils/src/__new-tests__/experimental.test.tsx b/packages/ui-react-utils/src/__tests__/experimental.test.tsx similarity index 100% rename from packages/ui-react-utils/src/__new-tests__/experimental.test.tsx rename to packages/ui-react-utils/src/__tests__/experimental.test.tsx diff --git a/packages/ui-react-utils/src/__new-tests__/getInteraction.test.tsx b/packages/ui-react-utils/src/__tests__/getInteraction.test.tsx similarity index 100% rename from packages/ui-react-utils/src/__new-tests__/getInteraction.test.tsx rename to packages/ui-react-utils/src/__tests__/getInteraction.test.tsx diff --git a/packages/ui-react-utils/src/__new-tests__/hack.test.tsx b/packages/ui-react-utils/src/__tests__/hack.test.tsx similarity index 100% rename from packages/ui-react-utils/src/__new-tests__/hack.test.tsx rename to packages/ui-react-utils/src/__tests__/hack.test.tsx diff --git a/packages/ui-react-utils/src/__new-tests__/omitProps.test.tsx b/packages/ui-react-utils/src/__tests__/omitProps.test.tsx similarity index 100% rename from packages/ui-react-utils/src/__new-tests__/omitProps.test.tsx rename to packages/ui-react-utils/src/__tests__/omitProps.test.tsx diff --git a/packages/ui-react-utils/src/__new-tests__/passthroughProps.test.tsx b/packages/ui-react-utils/src/__tests__/passthroughProps.test.tsx similarity index 100% rename from packages/ui-react-utils/src/__new-tests__/passthroughProps.test.tsx rename to packages/ui-react-utils/src/__tests__/passthroughProps.test.tsx diff --git a/packages/ui-react-utils/src/__new-tests__/pickProps.test.tsx b/packages/ui-react-utils/src/__tests__/pickProps.test.tsx similarity index 100% rename from packages/ui-react-utils/src/__new-tests__/pickProps.test.tsx rename to packages/ui-react-utils/src/__tests__/pickProps.test.tsx diff --git a/packages/ui-react-utils/src/__new-tests__/safeCloneElement.test.tsx b/packages/ui-react-utils/src/__tests__/safeCloneElement.test.tsx similarity index 100% rename from packages/ui-react-utils/src/__new-tests__/safeCloneElement.test.tsx rename to packages/ui-react-utils/src/__tests__/safeCloneElement.test.tsx diff --git a/packages/ui-responsive/src/Responsive/__new-tests__/Responsive.test.tsx b/packages/ui-responsive/src/Responsive/__tests__/Responsive.test.tsx similarity index 100% rename from packages/ui-responsive/src/Responsive/__new-tests__/Responsive.test.tsx rename to packages/ui-responsive/src/Responsive/__tests__/Responsive.test.tsx diff --git a/packages/ui-select/src/Select/__new-tests__/Select.test.tsx b/packages/ui-select/src/Select/__tests__/Select.test.tsx similarity index 100% rename from packages/ui-select/src/Select/__new-tests__/Select.test.tsx rename to packages/ui-select/src/Select/__tests__/Select.test.tsx diff --git a/packages/ui-select/src/Select/__tests__/theme.test.ts b/packages/ui-select/src/Select/__tests__/theme.test.ts deleted file mode 100644 index ea6db987d4..0000000000 --- a/packages/ui-select/src/Select/__tests__/theme.test.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('Select.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect(contrast(variables.background, variables.color)).to.be.above(3) - }) - }) - - describe('with the high contrast canvas theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect(contrast(variables.background, variables.color)).to.be.above(4.5) - }) - }) -}) diff --git a/packages/ui-selectable/src/Selectable/__new-tests__/Selectable.test.tsx b/packages/ui-selectable/src/Selectable/__tests__/Selectable.test.tsx similarity index 100% rename from packages/ui-selectable/src/Selectable/__new-tests__/Selectable.test.tsx rename to packages/ui-selectable/src/Selectable/__tests__/Selectable.test.tsx diff --git a/packages/ui-side-nav-bar/src/SideNavBar/SideNavBarItem/__new-tests__/NavigationItem.test.tsx b/packages/ui-side-nav-bar/src/SideNavBar/SideNavBarItem/__tests__/NavigationItem.test.tsx similarity index 100% rename from packages/ui-side-nav-bar/src/SideNavBar/SideNavBarItem/__new-tests__/NavigationItem.test.tsx rename to packages/ui-side-nav-bar/src/SideNavBar/SideNavBarItem/__tests__/NavigationItem.test.tsx diff --git a/packages/ui-side-nav-bar/src/SideNavBar/SideNavBarItem/__tests__/theme.test.ts b/packages/ui-side-nav-bar/src/SideNavBar/SideNavBarItem/__tests__/theme.test.ts deleted file mode 100644 index fc7e567c3b..0000000000 --- a/packages/ui-side-nav-bar/src/SideNavBar/SideNavBarItem/__tests__/theme.test.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { contrast } from '@instructure/ui-color-utils' -import { expect } from '@instructure/ui-test-utils' -import { canvas, canvasHighContrast } from '@instructure/ui-themes' - -import generateComponentTheme from '../theme' - -describe('SideNavBarItem.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.backgroundColor, variables.fontColor) - ).to.be.above(3) - }) - }) - - describe('with the high contrast canvas theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.backgroundColor, variables.fontColor) - ).to.be.above(4.5) - }) - }) -}) diff --git a/packages/ui-side-nav-bar/src/SideNavBar/__new-tests__/SideNavBar.test.tsx b/packages/ui-side-nav-bar/src/SideNavBar/__tests__/SideNavBar.test.tsx similarity index 100% rename from packages/ui-side-nav-bar/src/SideNavBar/__new-tests__/SideNavBar.test.tsx rename to packages/ui-side-nav-bar/src/SideNavBar/__tests__/SideNavBar.test.tsx diff --git a/packages/ui-side-nav-bar/src/SideNavBar/__tests__/theme.test.ts b/packages/ui-side-nav-bar/src/SideNavBar/__tests__/theme.test.ts deleted file mode 100644 index 809de5fc6d..0000000000 --- a/packages/ui-side-nav-bar/src/SideNavBar/__tests__/theme.test.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { contrast } from '@instructure/ui-color-utils' -import { expect } from '@instructure/ui-test-utils' -import { canvas, canvasHighContrast } from '@instructure/ui-themes' - -import generateComponentTheme from '../theme' - -describe('SideNavBar.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.backgroundColor, variables.fontColor) - ).to.be.above(3) - }) - }) - - describe('with the high contrast canvas theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.backgroundColor, variables.fontColor) - ).to.be.above(4.5) - }) - }) -}) diff --git a/packages/ui-simple-select/src/SimpleSelect/__new-tests__/SimpleSelect.test.tsx b/packages/ui-simple-select/src/SimpleSelect/__tests__/SimpleSelect.test.tsx similarity index 100% rename from packages/ui-simple-select/src/SimpleSelect/__new-tests__/SimpleSelect.test.tsx rename to packages/ui-simple-select/src/SimpleSelect/__tests__/SimpleSelect.test.tsx diff --git a/packages/ui-source-code-editor/src/SourceCodeEditor/__new-tests__/SourceCodeEditor.test.tsx b/packages/ui-source-code-editor/src/SourceCodeEditor/__tests__/SourceCodeEditor.test.tsx similarity index 100% rename from packages/ui-source-code-editor/src/SourceCodeEditor/__new-tests__/SourceCodeEditor.test.tsx rename to packages/ui-source-code-editor/src/SourceCodeEditor/__tests__/SourceCodeEditor.test.tsx diff --git a/packages/ui-spinner/src/Spinner/__new-tests__/Spinner.test.tsx b/packages/ui-spinner/src/Spinner/__tests__/Spinner.test.tsx similarity index 100% rename from packages/ui-spinner/src/Spinner/__new-tests__/Spinner.test.tsx rename to packages/ui-spinner/src/Spinner/__tests__/Spinner.test.tsx diff --git a/packages/ui-spinner/src/Spinner/__tests__/theme.test.ts b/packages/ui-spinner/src/Spinner/__tests__/theme.test.ts deleted file mode 100644 index 7affdd1ae5..0000000000 --- a/packages/ui-spinner/src/Spinner/__tests__/theme.test.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('Spinner.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - describe('default', () => { - it('should ensure meter color and track color meet 3:1 contrast', () => { - expect(contrast(variables.color, variables.trackColor)).to.be.above(3) - }) - }) - - describe('inverse', () => { - it('should ensure meter color and track color meet 3:1 contrast', () => { - expect(contrast(variables.color, variables.trackColor)).to.be.above(3) - }) - }) - }) - - describe('with the "canvas-high-contrast" theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - describe('default', () => { - it('should ensure meter color and track color meet 4.5:1 contrast', () => { - expect(contrast(variables.color, variables.trackColor)).to.be.above(4.5) - }) - }) - - describe('inverse', () => { - it('should ensure meter color and track color meet 4.5:1 contrast', () => { - expect(contrast(variables.color, variables.trackColor)).to.be.above(4.5) - }) - }) - }) -}) diff --git a/packages/ui-svg-images/src/InlineSVG/__new-tests__/InlineSVG.test.tsx b/packages/ui-svg-images/src/InlineSVG/__tests__/InlineSVG.test.tsx similarity index 100% rename from packages/ui-svg-images/src/InlineSVG/__new-tests__/InlineSVG.test.tsx rename to packages/ui-svg-images/src/InlineSVG/__tests__/InlineSVG.test.tsx diff --git a/packages/ui-svg-images/src/SVGIcon/__new-tests__/SVGIcon.test.tsx b/packages/ui-svg-images/src/SVGIcon/__tests__/SVGIcon.test.tsx similarity index 100% rename from packages/ui-svg-images/src/SVGIcon/__new-tests__/SVGIcon.test.tsx rename to packages/ui-svg-images/src/SVGIcon/__tests__/SVGIcon.test.tsx diff --git a/packages/ui-table/src/Table/__new-tests__/Table.test.tsx b/packages/ui-table/src/Table/__tests__/Table.test.tsx similarity index 100% rename from packages/ui-table/src/Table/__new-tests__/Table.test.tsx rename to packages/ui-table/src/Table/__tests__/Table.test.tsx diff --git a/packages/ui-table/src/Table/__tests__/theme.test.ts b/packages/ui-table/src/Table/__tests__/theme.test.ts deleted file mode 100644 index 9406925f1f..0000000000 --- a/packages/ui-table/src/Table/__tests__/theme.test.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('Table.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect(contrast(variables.background, variables.color)).to.be.above(3) - }) - }) - - describe('with the high contrast canvas theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect(contrast(variables.background, variables.color)).to.be.above(4.5) - }) - }) -}) diff --git a/packages/ui-tabs/src/Tabs/Panel/__new-tests__/Panel.test.tsx b/packages/ui-tabs/src/Tabs/Panel/__tests__/Panel.test.tsx similarity index 100% rename from packages/ui-tabs/src/Tabs/Panel/__new-tests__/Panel.test.tsx rename to packages/ui-tabs/src/Tabs/Panel/__tests__/Panel.test.tsx diff --git a/packages/ui-tabs/src/Tabs/Panel/__tests__/theme.test.ts b/packages/ui-tabs/src/Tabs/Panel/__tests__/theme.test.ts deleted file mode 100644 index dd32a91be7..0000000000 --- a/packages/ui-tabs/src/Tabs/Panel/__tests__/theme.test.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('Panel.theme', async () => { - describe('with the default theme', async () => { - const variables = generateComponentTheme(canvas) - - describe('secondary variant', async () => { - it('should ensure text and tab panel background meet 3:1 contrast', async () => { - expect(contrast(variables.color, variables.background)).to.be.above(3) - }) - }) - }) - - describe('with the "canvas-high-contrast" theme', async () => { - const variables = generateComponentTheme(canvasHighContrast) - - describe('secondary variant', async () => { - it('should ensure text and tab panel background meet 4.5:1 contrast', async () => { - expect(contrast(variables.color, variables.background)).to.be.above(4.5) - }) - }) - }) -}) diff --git a/packages/ui-tabs/src/Tabs/Tab/__new-tests__/Tab.test.tsx b/packages/ui-tabs/src/Tabs/Tab/__tests__/Tab.test.tsx similarity index 100% rename from packages/ui-tabs/src/Tabs/Tab/__new-tests__/Tab.test.tsx rename to packages/ui-tabs/src/Tabs/Tab/__tests__/Tab.test.tsx diff --git a/packages/ui-tabs/src/Tabs/Tab/__tests__/theme.test.ts b/packages/ui-tabs/src/Tabs/Tab/__tests__/theme.test.ts deleted file mode 100644 index 24e7e073ce..0000000000 --- a/packages/ui-tabs/src/Tabs/Tab/__tests__/theme.test.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' - -import { canvas, canvasHighContrast } from '@instructure/ui-themes' -import generateComponentTheme from '../theme' - -describe('Tab.theme', async () => { - describe('with the default theme', async () => { - const variables = generateComponentTheme(canvas) - - describe('secondary variant', async () => { - it('should ensure text and tab background meet 3:1 contrast', async () => { - expect( - contrast( - variables.secondaryColor, - variables.secondarySelectedBackground - ) - ).to.be.above(3) - }) - }) - }) - - describe('with the "canvas-high-contrast" theme', async () => { - const variables = generateComponentTheme(canvasHighContrast) - - describe('secondary variant', async () => { - it('should ensure text and tab background meet 4.5:1 contrast', async () => { - expect( - contrast( - variables.secondaryColor, - variables.secondarySelectedBackground - ) - ).to.be.above(4.5) - }) - }) - }) -}) diff --git a/packages/ui-tabs/src/Tabs/__new-tests__/Tabs.test.tsx b/packages/ui-tabs/src/Tabs/__tests__/Tabs.test.tsx similarity index 100% rename from packages/ui-tabs/src/Tabs/__new-tests__/Tabs.test.tsx rename to packages/ui-tabs/src/Tabs/__tests__/Tabs.test.tsx diff --git a/packages/ui-tag/src/Tag/__new-tests__/Tag.test.tsx b/packages/ui-tag/src/Tag/__tests__/Tag.test.tsx similarity index 100% rename from packages/ui-tag/src/Tag/__new-tests__/Tag.test.tsx rename to packages/ui-tag/src/Tag/__tests__/Tag.test.tsx diff --git a/packages/ui-tag/src/Tag/__tests__/theme.test.ts b/packages/ui-tag/src/Tag/__tests__/theme.test.ts deleted file mode 100644 index d41188072d..0000000000 --- a/packages/ui-tag/src/Tag/__tests__/theme.test.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' - -import generateComponentTheme from '../theme' -import { canvas, canvasHighContrast } from '@instructure/ui-themes' - -type Background = 'defaultBackground' | 'inlineBackground' -type TextColor = 'defaultColor' | 'inlineColor' - -describe('Tag.theme', () => { - const variants = ['default', 'inline'] as const - - context('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - variants.forEach((variant) => { - context(`with the ${variant} variant`, () => { - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast( - variables[`${variant}Background` as Background], - variables[`${variant}Color` as TextColor] - ) - ).to.be.above(3) - }) - }) - }) - }) - - describe('with the accessible canvas theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - variants.forEach((variant) => { - context(`with the ${variant} variant`, () => { - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast( - variables[`${variant}Background` as Background], - variables[`${variant}TextColor` as TextColor] - ) - ).to.be.above(4.5) - }) - }) - }) - }) -}) diff --git a/packages/ui-test-utils/src/__tests__/assertions.test.tsx b/packages/ui-test-utils/src/__old-tests__/assertions.test.tsx similarity index 100% rename from packages/ui-test-utils/src/__tests__/assertions.test.tsx rename to packages/ui-test-utils/src/__old-tests__/assertions.test.tsx diff --git a/packages/ui-test-utils/src/__tests__/generateComponentExamples.test.tsx b/packages/ui-test-utils/src/__old-tests__/generateComponentExamples.test.tsx similarity index 99% rename from packages/ui-test-utils/src/__tests__/generateComponentExamples.test.tsx rename to packages/ui-test-utils/src/__old-tests__/generateComponentExamples.test.tsx index 43f3b5e529..78497f08a1 100644 --- a/packages/ui-test-utils/src/__tests__/generateComponentExamples.test.tsx +++ b/packages/ui-test-utils/src/__old-tests__/generateComponentExamples.test.tsx @@ -22,7 +22,7 @@ * SOFTWARE. */ -import { Component } from 'react' +import React, { Component } from 'react' import PropTypes from 'prop-types' import { expect, StoryConfig } from '..' diff --git a/packages/ui-test-utils/src/__tests__/generatePropCombinations.test.ts b/packages/ui-test-utils/src/__old-tests__/generatePropCombinations.test.ts similarity index 100% rename from packages/ui-test-utils/src/__tests__/generatePropCombinations.test.ts rename to packages/ui-test-utils/src/__old-tests__/generatePropCombinations.test.ts diff --git a/packages/ui-test-utils/src/__tests__/locator.test.tsx b/packages/ui-test-utils/src/__old-tests__/locator.test.tsx similarity index 99% rename from packages/ui-test-utils/src/__tests__/locator.test.tsx rename to packages/ui-test-utils/src/__old-tests__/locator.test.tsx index 36cc22b8d5..e3ac43f4fe 100644 --- a/packages/ui-test-utils/src/__tests__/locator.test.tsx +++ b/packages/ui-test-utils/src/__old-tests__/locator.test.tsx @@ -22,6 +22,8 @@ * SOFTWARE. */ +//TODO uncomment if needed +/* import { Component as ReactComponent } from 'react' import PropTypes from 'prop-types' @@ -114,3 +116,4 @@ describe('locator', async () => { ) }) }) +*/ \ No newline at end of file diff --git a/packages/ui-test-utils/src/__tests__/queries.test.tsx b/packages/ui-test-utils/src/__old-tests__/queries.test.tsx similarity index 100% rename from packages/ui-test-utils/src/__tests__/queries.test.tsx rename to packages/ui-test-utils/src/__old-tests__/queries.test.tsx diff --git a/packages/ui-test-utils/src/__tests__/reactComponentWrapper.test.tsx b/packages/ui-test-utils/src/__old-tests__/reactComponentWrapper.test.tsx similarity index 100% rename from packages/ui-test-utils/src/__tests__/reactComponentWrapper.test.tsx rename to packages/ui-test-utils/src/__old-tests__/reactComponentWrapper.test.tsx diff --git a/packages/ui-testable/src/__tests__/testable.test.tsx b/packages/ui-testable/src/__old-tests__/testable.test.tsx similarity index 100% rename from packages/ui-testable/src/__tests__/testable.test.tsx rename to packages/ui-testable/src/__old-tests__/testable.test.tsx diff --git a/packages/ui-text-area/src/TextArea/__new-tests__/TextArea.test.tsx b/packages/ui-text-area/src/TextArea/__tests__/TextArea.test.tsx similarity index 100% rename from packages/ui-text-area/src/TextArea/__new-tests__/TextArea.test.tsx rename to packages/ui-text-area/src/TextArea/__tests__/TextArea.test.tsx diff --git a/packages/ui-text-area/src/TextArea/__tests__/theme.test.ts b/packages/ui-text-area/src/TextArea/__tests__/theme.test.ts deleted file mode 100644 index 409686011d..0000000000 --- a/packages/ui-text-area/src/TextArea/__tests__/theme.test.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' -import generateComponentTheme from '../theme' -import { canvas, canvasHighContrast } from '@instructure/ui-themes' - -describe('TextArea.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - describe('default', () => { - it('should ensure focus color and background color meet 3:1 contrast', () => { - expect( - contrast(variables.background, variables.focusOutlineColor) - ).to.be.above(3) - }) - - it('should ensure text color and background color meet 3:1 contrast', () => { - expect(contrast(variables.color, variables.background)).to.be.above(3) - }) - }) - }) - - describe('with the high contrast canvas theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - describe('default', () => { - it('should ensure focus color and background color meet 4.5:1 contrast', () => { - expect( - contrast(variables.background, variables.focusOutlineColor) - ).to.be.above(4.5) - }) - - it('should ensure text color and background color meet 3:1 contrast', () => { - expect(contrast(variables.color, variables.background)).to.be.above(4.5) - }) - }) - }) -}) diff --git a/packages/ui-text-input/src/TextInput/__new-tests__/TextInput.test.tsx b/packages/ui-text-input/src/TextInput/__tests__/TextInput.test.tsx similarity index 100% rename from packages/ui-text-input/src/TextInput/__new-tests__/TextInput.test.tsx rename to packages/ui-text-input/src/TextInput/__tests__/TextInput.test.tsx diff --git a/packages/ui-text-input/src/TextInput/__tests__/theme.test.ts b/packages/ui-text-input/src/TextInput/__tests__/theme.test.ts deleted file mode 100644 index b65dbca328..0000000000 --- a/packages/ui-text-input/src/TextInput/__tests__/theme.test.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' -import generateComponentTheme from '../theme' -import { canvas, canvasHighContrast } from '@instructure/ui-themes' - -describe('TextInput.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - describe('default', () => { - it('should ensure focus color and background color meet 3:1 contrast', () => { - expect( - contrast(variables.background, variables.focusOutlineColor) - ).to.be.above(3) - }) - - it('should ensure text color and background color meet 3:1 contrast', () => { - expect(contrast(variables.color, variables.background)).to.be.above(3) - }) - }) - }) - - describe('with the high contrast canvas theme', () => { - const variables = generateComponentTheme(canvasHighContrast) - - describe('default', () => { - it('should ensure focus color and background color meet 4.5:1 contrast', () => { - expect( - contrast(variables.background, variables.focusOutlineColor) - ).to.be.above(4.5) - }) - - it('should ensure text color and background color meet 3:1 contrast', () => { - expect(contrast(variables.color, variables.background)).to.be.above(4.5) - }) - }) - }) -}) diff --git a/packages/ui-text/src/Text/__new-tests__/Text.test.tsx b/packages/ui-text/src/Text/__tests__/Text.test.tsx similarity index 100% rename from packages/ui-text/src/Text/__new-tests__/Text.test.tsx rename to packages/ui-text/src/Text/__tests__/Text.test.tsx diff --git a/packages/ui-themes/src/__new-tests__/themes.test.tsx b/packages/ui-themes/src/__tests__/themes.test.tsx similarity index 100% rename from packages/ui-themes/src/__new-tests__/themes.test.tsx rename to packages/ui-themes/src/__tests__/themes.test.tsx diff --git a/packages/ui-time-select/src/TimeSelect/__new-tests__/TimeSelect.test.tsx b/packages/ui-time-select/src/TimeSelect/__tests__/TimeSelect.test.tsx similarity index 100% rename from packages/ui-time-select/src/TimeSelect/__new-tests__/TimeSelect.test.tsx rename to packages/ui-time-select/src/TimeSelect/__tests__/TimeSelect.test.tsx diff --git a/packages/ui-toggle-details/src/ToggleDetails/__new-tests__/ToggleDetails.test.tsx b/packages/ui-toggle-details/src/ToggleDetails/__tests__/ToggleDetails.test.tsx similarity index 100% rename from packages/ui-toggle-details/src/ToggleDetails/__new-tests__/ToggleDetails.test.tsx rename to packages/ui-toggle-details/src/ToggleDetails/__tests__/ToggleDetails.test.tsx diff --git a/packages/ui-toggle-details/src/ToggleGroup/__new-tests__/ToggleGroup.test.tsx b/packages/ui-toggle-details/src/ToggleGroup/__tests__/ToggleGroup.test.tsx similarity index 100% rename from packages/ui-toggle-details/src/ToggleGroup/__new-tests__/ToggleGroup.test.tsx rename to packages/ui-toggle-details/src/ToggleGroup/__tests__/ToggleGroup.test.tsx diff --git a/packages/ui-tooltip/package.json b/packages/ui-tooltip/package.json index d36d82c2aa..fba112a6e6 100644 --- a/packages/ui-tooltip/package.json +++ b/packages/ui-tooltip/package.json @@ -39,8 +39,6 @@ "@instructure/ui-babel-preset": "10.19.1", "@instructure/ui-color-utils": "10.19.1", "@instructure/ui-scripts": "10.19.1", - "@instructure/ui-test-locator": "10.19.1", - "@instructure/ui-test-queries": "10.19.1", "@instructure/ui-test-utils": "10.19.1", "@instructure/ui-themes": "10.19.1", "@testing-library/jest-dom": "^6.6.3", diff --git a/packages/ui-tooltip/src/Tooltip/TooltipLocator.ts b/packages/ui-tooltip/src/Tooltip/TooltipLocator.ts deleted file mode 100644 index 0fd83a4ea7..0000000000 --- a/packages/ui-tooltip/src/Tooltip/TooltipLocator.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { locator } from '@instructure/ui-test-locator' -import { parseQueryArguments } from '@instructure/ui-test-queries' -// @ts-ignore: Cannot find module -// eslint-disable-next-line no-restricted-imports -import { PopoverLocator } from '@instructure/ui-popover/es/Popover/PopoverLocator' -import { Tooltip } from './index' - -export const customMethods = { - findTrigger: (...args: any[]) => { - const { element, options } = parseQueryArguments(...args) - return PopoverLocator.findTrigger(element, '[aria-describedby]', options) - }, - findContent: (...args: any[]) => { - const { element, options } = parseQueryArguments(...args) - return PopoverLocator.findContent(element, '[role="tooltip"]', options) - } -} -// @ts-ignore: Property 'selector' does not exist type Tooltip -export const TooltipLocator = locator(Tooltip.selector, customMethods) diff --git a/packages/ui-tooltip/src/Tooltip/__new-tests__/Tooltip.test.tsx b/packages/ui-tooltip/src/Tooltip/__tests__/Tooltip.test.tsx similarity index 100% rename from packages/ui-tooltip/src/Tooltip/__new-tests__/Tooltip.test.tsx rename to packages/ui-tooltip/src/Tooltip/__tests__/Tooltip.test.tsx diff --git a/packages/ui-tooltip/src/Tooltip/locator.ts b/packages/ui-tooltip/src/Tooltip/locator.ts deleted file mode 100644 index 2c24ce038a..0000000000 --- a/packages/ui-tooltip/src/Tooltip/locator.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { TooltipLocator } from './TooltipLocator' - -export { customMethods } from './TooltipLocator' - -export { TooltipLocator } -export default TooltipLocator diff --git a/packages/ui-tooltip/tsconfig.build.json b/packages/ui-tooltip/tsconfig.build.json index cd9ee4e767..98130dbc0b 100644 --- a/packages/ui-tooltip/tsconfig.build.json +++ b/packages/ui-tooltip/tsconfig.build.json @@ -17,8 +17,6 @@ { "path": "../ui-testable/tsconfig.build.json" }, { "path": "../ui-babel-preset/tsconfig.build.json" }, { "path": "../ui-color-utils/tsconfig.build.json" }, - { "path": "../ui-test-locator/tsconfig.build.json" }, - { "path": "../ui-test-queries/tsconfig.build.json" }, { "path": "../ui-test-utils/tsconfig.build.json" }, { "path": "../ui-utils/tsconfig.build.json" }, { "path": "../ui-themes/tsconfig.build.json" }, diff --git a/packages/ui-top-nav-bar/package.json b/packages/ui-top-nav-bar/package.json index 9018138076..60283122a1 100644 --- a/packages/ui-top-nav-bar/package.json +++ b/packages/ui-top-nav-bar/package.json @@ -53,7 +53,6 @@ "@instructure/ui-babel-preset": "10.19.1", "@instructure/ui-color-utils": "10.19.1", "@instructure/ui-scripts": "10.19.1", - "@instructure/ui-test-locator": "10.19.1", "@instructure/ui-test-utils": "10.19.1", "@instructure/ui-themes": "10.19.1", "@testing-library/jest-dom": "^6.6.3", diff --git a/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarActionItems/__new-tests__/TopNavBarActionItems.test.tsx b/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarActionItems/__tests__/TopNavBarActionItems.test.tsx similarity index 100% rename from packages/ui-top-nav-bar/src/TopNavBar/TopNavBarActionItems/__new-tests__/TopNavBarActionItems.test.tsx rename to packages/ui-top-nav-bar/src/TopNavBar/TopNavBarActionItems/__tests__/TopNavBarActionItems.test.tsx diff --git a/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.ts b/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.ts deleted file mode 100644 index 9fd8216fc4..0000000000 --- a/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { locator } from '@instructure/ui-test-locator' -import { find } from '@instructure/ui-test-utils' - -import { TopNavBarBrand } from './index' - -// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message -export const TopNavBarBrandLocator = locator(TopNavBarBrand.selector, { - findContainer: (...args: any[]) => { - return find('[class$="-topNavBarBrand__container"]', ...args) - }, - findBrandIconContainer: (...args: any[]) => { - return find('[class$="-topNavBarBrand__iconContainer"]', ...args) - }, - findScreenReaderLabel: (...args: any[]) => { - return find('[class$="-screenReaderContent"]', ...args) - } -}) diff --git a/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarBrand/__examples__/TopNavBarBrand.examples.tsx b/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarBrand/__examples__/TopNavBarBrand.examples.tsx deleted file mode 100644 index 2e0bf5e003..0000000000 --- a/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarBrand/__examples__/TopNavBarBrand.examples.tsx +++ /dev/null @@ -1,54 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import type { StoryConfig } from '@instructure/ui-test-utils' - -import { elevateIconInverse } from '../../utils/exampleSvgFiles' -import type { TopNavBarBrandProps } from '../props' - -export default { - propValues: { - renderIcon: [undefined, 'Logo', elevateIconInverse], - iconBackground: [undefined, '#ddd'], - href: [undefined, '/#home'], - onClick: [undefined, () => {}] - }, - getComponentProps: () => { - return { - screenReaderLabel: 'Brand name' - } - }, - filter: (props) => { - if (props.iconBackground && !props.renderIcon) { - return true - } - if ( - (props.href || props.onClick) && - !(typeof props.renderIcon === 'object' && props.iconBackground) - ) { - return true - } - return false - } -} as StoryConfig diff --git a/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarBrand/__tests__/TopNavBarBrand.test.tsx b/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarBrand/__tests__/TopNavBarBrand.test.tsx deleted file mode 100644 index 1ecc0ea443..0000000000 --- a/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarBrand/__tests__/TopNavBarBrand.test.tsx +++ /dev/null @@ -1,191 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { getComputedStyle } from '@instructure/ui-dom-utils' -import { - expect, - mount, - generateA11yTests, - stub -} from '@instructure/ui-test-utils' - -import { getBrand, SmallViewportModeWrapper } from '../../utils/exampleHelpers' -import { elevateIcon } from '../../utils/exampleSvgFiles' - -import { TopNavBarBrand } from '../index' -import { TopNavBarBrandLocator } from '../TopNavBarBrandLocator' -import TopNavBarBrandExamples from '../__examples__/TopNavBarBrand.examples' - -describe('', async () => { - it('should render', async () => { - await mount(getBrand({})) - const component = await TopNavBarBrandLocator.find() - - expect(component).to.exist() - }) - - describe('elementRef prop should return a ref to the root element', async () => { - it('should return root element', async () => { - const elementRef = stub() - await mount( - getBrand({ - brandProps: { elementRef } - }) - ) - const component = await TopNavBarBrandLocator.find() - - expect(elementRef).to.have.been.calledWith(component.getDOMNode()) - }) - }) - - describe('screenReaderLabel prop', async () => { - it('should render label for SR', async () => { - await mount( - getBrand({ - brandProps: { screenReaderLabel: 'Test label' } - }) - ) - const component = await TopNavBarBrandLocator.find() - const screenReaderLabel = await component.findScreenReaderLabel() - - expect(screenReaderLabel).to.have.text('Test label') - }) - }) - - describe('renderIcon prop', async () => { - it('should render name in desktop mode', async () => { - await mount(getBrand({ brandProps: { renderIcon: elevateIcon } })) - const component = await TopNavBarBrandLocator.find() - const iconContainer = await component.findBrandIconContainer() - const icon = await iconContainer.find('svg') - - expect(iconContainer).to.be.visible() - expect(icon).to.be.visible() - expect(icon).to.have.id('elevateIcon') - }) - - it('should not render name in smallViewport mode', async () => { - await mount( - - {getBrand({ brandProps: { renderIcon: elevateIcon } })} - - ) - const component = await TopNavBarBrandLocator.find() - const iconContainer = await component.findBrandIconContainer({ - expectEmpty: true - }) - - expect(iconContainer).to.not.exist() - }) - }) - - describe('iconBackground prop', async () => { - it('should be visible in desktop mode', async () => { - await mount(getBrand({ brandProps: { iconBackground: 'blue' } })) - const component = await TopNavBarBrandLocator.find() - const iconContainer = await component.findBrandIconContainer() - - expect( - getComputedStyle(iconContainer.getDOMNode()).backgroundColor - ).to.equal('rgb(0, 0, 255)') - }) - - it('should not be visible in smallViewport mode', async () => { - await mount( - - {getBrand({ brandProps: { iconBackground: 'blue' } })} - - ) - const component = await TopNavBarBrandLocator.find() - const iconContainer = await component.findBrandIconContainer({ - expectEmpty: true - }) - - expect(iconContainer).to.not.exist() - }) - }) - - describe('href prop', async () => { - it('should render component as link', async () => { - await mount( - getBrand({ - brandProps: { href: '/#TestHref' } - }) - ) - const component = await TopNavBarBrandLocator.find() - const container = await component.findContainer() - - expect(container).to.have.tagName('a') - expect(container).to.have.attribute('href', '/#TestHref') - }) - }) - - describe('onClick prop', async () => { - it('should render component button', async () => { - const onClick = stub() - await mount( - getBrand({ - brandProps: { href: undefined, onClick } - }) - ) - const component = await TopNavBarBrandLocator.find() - const container = await component.findContainer() - - expect(container).to.have.tagName('button') - - await container.click() - - expect(onClick).to.have.been.called() - }) - }) - - describe('as prop', async () => { - it('should render component as passed element', async () => { - const onClick = stub() - await mount( - getBrand({ - brandProps: { href: '/#TestHref', onClick, as: 'button' } - }) - ) - const component = await TopNavBarBrandLocator.find() - const container = await component.findContainer() - - expect(container).to.have.tagName('button') - - await container.click() - - expect(onClick).to.have.been.called() - }) - }) - - describe('should be accessible', async () => { - generateA11yTests(TopNavBarBrand, TopNavBarBrandExamples) - - it('a11y', async () => { - await mount(getBrand({})) - const topNavBarBrand = await TopNavBarBrandLocator.find() - expect(await topNavBarBrand.accessible()).to.be.true() - }) - }) -}) diff --git a/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarBreadcrumb/__new-tests__/TopNavBarBreadcrumb.test.tsx b/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarBreadcrumb/__tests__/TopNavBarBreadcrumb.test.tsx similarity index 100% rename from packages/ui-top-nav-bar/src/TopNavBar/TopNavBarBreadcrumb/__new-tests__/TopNavBarBreadcrumb.test.tsx rename to packages/ui-top-nav-bar/src/TopNavBar/TopNavBarBreadcrumb/__tests__/TopNavBarBreadcrumb.test.tsx diff --git a/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarItem/__new-tests__/TopNavBarItem.test.tsx b/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarItem/__tests__/TopNavBarItem.test.tsx similarity index 100% rename from packages/ui-top-nav-bar/src/TopNavBar/TopNavBarItem/__new-tests__/TopNavBarItem.test.tsx rename to packages/ui-top-nav-bar/src/TopNavBar/TopNavBarItem/__tests__/TopNavBarItem.test.tsx diff --git a/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarLayout/DesktopLayout/__new-tests__/TopNavBarDesktopLayout.test.tsx b/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarLayout/DesktopLayout/__tests__/TopNavBarDesktopLayout.test.tsx similarity index 100% rename from packages/ui-top-nav-bar/src/TopNavBar/TopNavBarLayout/DesktopLayout/__new-tests__/TopNavBarDesktopLayout.test.tsx rename to packages/ui-top-nav-bar/src/TopNavBar/TopNavBarLayout/DesktopLayout/__tests__/TopNavBarDesktopLayout.test.tsx diff --git a/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/__new-tests__/TopNavBarSmallViewportLayout.test.tsx b/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/__tests__/TopNavBarSmallViewportLayout.test.tsx similarity index 100% rename from packages/ui-top-nav-bar/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/__new-tests__/TopNavBarSmallViewportLayout.test.tsx rename to packages/ui-top-nav-bar/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/__tests__/TopNavBarSmallViewportLayout.test.tsx diff --git a/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarLayout/__new-tests__/TopNavBarLayout.test.tsx b/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarLayout/__tests__/TopNavBarLayout.test.tsx similarity index 100% rename from packages/ui-top-nav-bar/src/TopNavBar/TopNavBarLayout/__new-tests__/TopNavBarLayout.test.tsx rename to packages/ui-top-nav-bar/src/TopNavBar/TopNavBarLayout/__tests__/TopNavBarLayout.test.tsx diff --git a/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarMenuItems/__new-tests__/TopNavBarMenuItems.test.tsx b/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarMenuItems/__tests__/TopNavBarMenuItems.test.tsx similarity index 100% rename from packages/ui-top-nav-bar/src/TopNavBar/TopNavBarMenuItems/__new-tests__/TopNavBarMenuItems.test.tsx rename to packages/ui-top-nav-bar/src/TopNavBar/TopNavBarMenuItems/__tests__/TopNavBarMenuItems.test.tsx diff --git a/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarUser/__new-tests__/TopNavBarUser.test.tsx b/packages/ui-top-nav-bar/src/TopNavBar/TopNavBarUser/__tests__/TopNavBarUser.test.tsx similarity index 100% rename from packages/ui-top-nav-bar/src/TopNavBar/TopNavBarUser/__new-tests__/TopNavBarUser.test.tsx rename to packages/ui-top-nav-bar/src/TopNavBar/TopNavBarUser/__tests__/TopNavBarUser.test.tsx diff --git a/packages/ui-top-nav-bar/src/TopNavBar/__new-tests__/TopNavBar.test.tsx b/packages/ui-top-nav-bar/src/TopNavBar/__tests__/TopNavBar.test.tsx similarity index 100% rename from packages/ui-top-nav-bar/src/TopNavBar/__new-tests__/TopNavBar.test.tsx rename to packages/ui-top-nav-bar/src/TopNavBar/__tests__/TopNavBar.test.tsx diff --git a/packages/ui-top-nav-bar/tsconfig.build.json b/packages/ui-top-nav-bar/tsconfig.build.json index f6fc8d6b67..c5851724f8 100644 --- a/packages/ui-top-nav-bar/tsconfig.build.json +++ b/packages/ui-top-nav-bar/tsconfig.build.json @@ -31,7 +31,6 @@ { "path": "../ui-view/tsconfig.build.json" }, { "path": "../ui-babel-preset/tsconfig.build.json" }, { "path": "../ui-color-utils/tsconfig.build.json" }, - { "path": "../ui-test-locator/tsconfig.build.json" }, { "path": "../ui-test-utils/tsconfig.build.json" }, { "path": "../ui-themes/tsconfig.build.json" }, { "path": "../ui-axe-check/tsconfig.build.json" }, diff --git a/packages/ui-tray/src/Tray/__new-tests__/Tray.test.tsx b/packages/ui-tray/src/Tray/__tests__/Tray.test.tsx similarity index 100% rename from packages/ui-tray/src/Tray/__new-tests__/Tray.test.tsx rename to packages/ui-tray/src/Tray/__tests__/Tray.test.tsx diff --git a/packages/ui-tree-browser/src/TreeBrowser/TreeButton/__new-tests__/TreeButton.test.tsx b/packages/ui-tree-browser/src/TreeBrowser/TreeButton/__tests__/TreeButton.test.tsx similarity index 100% rename from packages/ui-tree-browser/src/TreeBrowser/TreeButton/__new-tests__/TreeButton.test.tsx rename to packages/ui-tree-browser/src/TreeBrowser/TreeButton/__tests__/TreeButton.test.tsx diff --git a/packages/ui-tree-browser/src/TreeBrowser/TreeCollection/__new-tests__/TreeCollection.test.tsx b/packages/ui-tree-browser/src/TreeBrowser/TreeCollection/__tests__/TreeCollection.test.tsx similarity index 100% rename from packages/ui-tree-browser/src/TreeBrowser/TreeCollection/__new-tests__/TreeCollection.test.tsx rename to packages/ui-tree-browser/src/TreeBrowser/TreeCollection/__tests__/TreeCollection.test.tsx diff --git a/packages/ui-tree-browser/src/TreeBrowser/TreeNode/__new-tests__/TreeNode.test.tsx b/packages/ui-tree-browser/src/TreeBrowser/TreeNode/__tests__/TreeNode.test.tsx similarity index 100% rename from packages/ui-tree-browser/src/TreeBrowser/TreeNode/__new-tests__/TreeNode.test.tsx rename to packages/ui-tree-browser/src/TreeBrowser/TreeNode/__tests__/TreeNode.test.tsx diff --git a/packages/ui-tree-browser/src/TreeBrowser/__new-tests__/TreeBrowser.test.tsx b/packages/ui-tree-browser/src/TreeBrowser/__tests__/TreeBrowser.test.tsx similarity index 100% rename from packages/ui-tree-browser/src/TreeBrowser/__new-tests__/TreeBrowser.test.tsx rename to packages/ui-tree-browser/src/TreeBrowser/__tests__/TreeBrowser.test.tsx diff --git a/packages/ui-truncate-list/package.json b/packages/ui-truncate-list/package.json index 8640e16f5f..f89008411a 100644 --- a/packages/ui-truncate-list/package.json +++ b/packages/ui-truncate-list/package.json @@ -38,7 +38,6 @@ "@instructure/ui-axe-check": "10.19.1", "@instructure/ui-babel-preset": "10.19.1", "@instructure/ui-color-utils": "10.19.1", - "@instructure/ui-test-queries": "10.19.1", "@instructure/ui-test-utils": "10.19.1", "@instructure/ui-themes": "10.19.1", "@testing-library/jest-dom": "^6.6.3", diff --git a/packages/ui-truncate-list/src/TruncateList/__new-tests__/TruncateList.test.tsx b/packages/ui-truncate-list/src/TruncateList/__tests__/TruncateList.test.tsx similarity index 100% rename from packages/ui-truncate-list/src/TruncateList/__new-tests__/TruncateList.test.tsx rename to packages/ui-truncate-list/src/TruncateList/__tests__/TruncateList.test.tsx diff --git a/packages/ui-truncate-list/tsconfig.build.json b/packages/ui-truncate-list/tsconfig.build.json index df496e52d1..af90e6dc9d 100644 --- a/packages/ui-truncate-list/tsconfig.build.json +++ b/packages/ui-truncate-list/tsconfig.build.json @@ -18,7 +18,6 @@ { "path": "../ui-utils/tsconfig.build.json" }, { "path": "../ui-babel-preset/tsconfig.build.json" }, { "path": "../ui-color-utils/tsconfig.build.json" }, - { "path": "../ui-test-queries/tsconfig.build.json" }, { "path": "../ui-test-utils/tsconfig.build.json" }, { "path": "../ui-themes/tsconfig.build.json" } ] diff --git a/packages/ui-truncate-text/src/TruncateText/__new-tests__/TruncateText.test.tsx b/packages/ui-truncate-text/src/TruncateText/__tests__/TruncateText.test.tsx similarity index 100% rename from packages/ui-truncate-text/src/TruncateText/__new-tests__/TruncateText.test.tsx rename to packages/ui-truncate-text/src/TruncateText/__tests__/TruncateText.test.tsx diff --git a/packages/ui-truncate-text/src/TruncateText/utils/__new-tests__/cleanData.test.tsx b/packages/ui-truncate-text/src/TruncateText/utils/__tests__/cleanData.test.tsx similarity index 100% rename from packages/ui-truncate-text/src/TruncateText/utils/__new-tests__/cleanData.test.tsx rename to packages/ui-truncate-text/src/TruncateText/utils/__tests__/cleanData.test.tsx diff --git a/packages/ui-truncate-text/src/TruncateText/utils/__new-tests__/cleanString.test.tsx b/packages/ui-truncate-text/src/TruncateText/utils/__tests__/cleanString.test.tsx similarity index 100% rename from packages/ui-truncate-text/src/TruncateText/utils/__new-tests__/cleanString.test.tsx rename to packages/ui-truncate-text/src/TruncateText/utils/__tests__/cleanString.test.tsx diff --git a/packages/ui-truncate-text/src/TruncateText/utils/__new-tests__/measureText.test.tsx b/packages/ui-truncate-text/src/TruncateText/utils/__tests__/measureText.test.tsx similarity index 100% rename from packages/ui-truncate-text/src/TruncateText/utils/__new-tests__/measureText.test.tsx rename to packages/ui-truncate-text/src/TruncateText/utils/__tests__/measureText.test.tsx diff --git a/packages/ui-utils/src/__new-tests__/camelize.test.tsx b/packages/ui-utils/src/__tests__/camelize.test.tsx similarity index 100% rename from packages/ui-utils/src/__new-tests__/camelize.test.tsx rename to packages/ui-utils/src/__tests__/camelize.test.tsx diff --git a/packages/ui-utils/src/__new-tests__/cloneArray.test.tsx b/packages/ui-utils/src/__tests__/cloneArray.test.tsx similarity index 100% rename from packages/ui-utils/src/__new-tests__/cloneArray.test.tsx rename to packages/ui-utils/src/__tests__/cloneArray.test.tsx diff --git a/packages/ui-utils/src/__new-tests__/createChainedFunction.test.tsx b/packages/ui-utils/src/__tests__/createChainedFunction.test.tsx similarity index 100% rename from packages/ui-utils/src/__new-tests__/createChainedFunction.test.tsx rename to packages/ui-utils/src/__tests__/createChainedFunction.test.tsx diff --git a/packages/ui-utils/src/__new-tests__/generateId.test.tsx b/packages/ui-utils/src/__tests__/generateId.test.tsx similarity index 100% rename from packages/ui-utils/src/__new-tests__/generateId.test.tsx rename to packages/ui-utils/src/__tests__/generateId.test.tsx diff --git a/packages/ui-utils/src/__new-tests__/hash.test.tsx b/packages/ui-utils/src/__tests__/hash.test.tsx similarity index 100% rename from packages/ui-utils/src/__new-tests__/hash.test.tsx rename to packages/ui-utils/src/__tests__/hash.test.tsx diff --git a/packages/ui-utils/src/__new-tests__/mergeDeep.test.tsx b/packages/ui-utils/src/__tests__/mergeDeep.test.tsx similarity index 100% rename from packages/ui-utils/src/__new-tests__/mergeDeep.test.tsx rename to packages/ui-utils/src/__tests__/mergeDeep.test.tsx diff --git a/packages/ui-utils/src/__new-tests__/ms.test.tsx b/packages/ui-utils/src/__tests__/ms.test.tsx similarity index 100% rename from packages/ui-utils/src/__new-tests__/ms.test.tsx rename to packages/ui-utils/src/__tests__/ms.test.tsx diff --git a/packages/ui-utils/src/__new-tests__/parseUnit.test.tsx b/packages/ui-utils/src/__tests__/parseUnit.test.tsx similarity index 100% rename from packages/ui-utils/src/__new-tests__/parseUnit.test.tsx rename to packages/ui-utils/src/__tests__/parseUnit.test.tsx diff --git a/packages/ui-utils/src/__new-tests__/pascalize.test.tsx b/packages/ui-utils/src/__tests__/pascalize.test.tsx similarity index 100% rename from packages/ui-utils/src/__new-tests__/pascalize.test.tsx rename to packages/ui-utils/src/__tests__/pascalize.test.tsx diff --git a/packages/ui-utils/src/__new-tests__/px.test.tsx b/packages/ui-utils/src/__tests__/px.test.tsx similarity index 100% rename from packages/ui-utils/src/__new-tests__/px.test.tsx rename to packages/ui-utils/src/__tests__/px.test.tsx diff --git a/packages/ui-utils/src/__new-tests__/within.test.tsx b/packages/ui-utils/src/__tests__/within.test.tsx similarity index 100% rename from packages/ui-utils/src/__new-tests__/within.test.tsx rename to packages/ui-utils/src/__tests__/within.test.tsx diff --git a/packages/ui-view/src/ContextView/__new-tests__/ContextView.test.tsx b/packages/ui-view/src/ContextView/__tests__/ContextView.test.tsx similarity index 100% rename from packages/ui-view/src/ContextView/__new-tests__/ContextView.test.tsx rename to packages/ui-view/src/ContextView/__tests__/ContextView.test.tsx diff --git a/packages/ui-view/src/View/__new-tests__/View.test.tsx b/packages/ui-view/src/View/__tests__/View.test.tsx similarity index 100% rename from packages/ui-view/src/View/__new-tests__/View.test.tsx rename to packages/ui-view/src/View/__tests__/View.test.tsx diff --git a/packages/ui-view/src/View/__tests__/theme.test.ts b/packages/ui-view/src/View/__tests__/theme.test.ts deleted file mode 100644 index 77736253b2..0000000000 --- a/packages/ui-view/src/View/__tests__/theme.test.ts +++ /dev/null @@ -1,153 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 - present Instructure, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import { expect } from '@instructure/ui-test-utils' -import { contrast } from '@instructure/ui-color-utils' -import { canvas, canvasHighContrast } from '@instructure/ui-themes' - -import generateComponentTheme from '../theme' - -describe('View.theme', () => { - describe('with the default theme', () => { - const variables = generateComponentTheme(canvas) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.backgroundPrimary, variables.color) - ).to.be.above(3) - }) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast( - variables.backgroundPrimaryInverse, - variables.colorPrimaryInverse - ) - ).to.be.above(3) - }) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.backgroundSecondary, variables.color) - ).to.be.above(3) - }) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.backgroundBrand, variables.colorPrimaryInverse) - ).to.be.above(3) - }) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.backgroundAlert, variables.colorPrimaryInverse) - ).to.be.above(3) - }) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.backgroundInfo, variables.colorPrimaryInverse) - ).to.be.above(3) - }) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.backgroundSuccess, variables.colorPrimaryInverse) - ).to.be.above(3) - }) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.backgroundDanger, variables.colorPrimaryInverse) - ).to.be.above(3) - }) - - it('should have a background and text colors that meet 3:1 contrast', () => { - expect( - contrast(variables.backgroundWarning, variables.colorPrimaryInverse) - ).to.be.above(3) - }) - }) - - describe('with the high contrast canvas theme', async () => { - const variables = generateComponentTheme(canvasHighContrast) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.backgroundPrimary, variables.color) - ).to.be.above(4.5) - }) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast( - variables.backgroundPrimaryInverse, - variables.colorPrimaryInverse - ) - ).to.be.above(4.5) - }) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.backgroundSecondary, variables.color) - ).to.be.above(4.5) - }) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.backgroundBrand, variables.colorPrimaryInverse) - ).to.be.above(4.5) - }) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.backgroundAlert, variables.colorPrimaryInverse) - ).to.be.above(4.5) - }) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.backgroundInfo, variables.colorPrimaryInverse) - ).to.be.above(4.5) - }) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.backgroundSuccess, variables.colorPrimaryInverse) - ).to.be.above(4.5) - }) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.backgroundDanger, variables.colorPrimaryInverse) - ).to.be.above(4.5) - }) - - it('should have a background and text colors that meet 4.5:1 contrast', () => { - expect( - contrast(variables.backgroundWarning, variables.colorPrimaryInverse) - ).to.be.above(4.5) - }) - }) -}) diff --git a/packages/uid/src/__new-tests__/uid.test.tsx b/packages/uid/src/__tests__/uid.test.tsx similarity index 100% rename from packages/uid/src/__new-tests__/uid.test.tsx rename to packages/uid/src/__tests__/uid.test.tsx diff --git a/vitest.config.mts b/vitest.config.mts index 4b561bf239..6fa262be5b 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -28,7 +28,7 @@ import { defineConfig } from 'vitest/config' export default defineConfig({ test: { - include: ['**/__new-tests__/**/*.test.tsx'], + include: ['**/__tests__/**/*.test.tsx'], globals: true, environment: 'jsdom', setupFiles: './vitest.setup.ts'