Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Use [the changelog guidelines](/documentation/Versioning%20and%20changelog.md) t

- Tightened up what absolute imports are allowed. Removed `baseUrl` from `tsconfig.json`. Attempting to do an absolute import from `src/X` or `components/X` now results in a error when type-checking. ([#4643](https://github.com/Shopify/polaris-react/pull/4643))
- Remove analyze custom properties check. ([#4718](https://github.com/Shopify/polaris-react/pull/4718))
- Removed support for importing from `components` as it slows tests down ([#4735](https://github.com/Shopify/polaris-react/pull/4735))

### Dependency upgrades

Expand Down
1 change: 0 additions & 1 deletion loom.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ function jestAdjustmentsPlugin() {
configuration.jestModuleNameMapper?.hook((moduleNameMapper) => ({
...moduleNameMapper,
'^tests/(.*)': '<rootDir>/tests/$1',
'^components$': '<rootDir>/src/components',
}));

// Ignore tests in the examples folder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {Avatar} from 'components';

import {Avatar} from '../../Avatar';
import {Button} from '../../Button';
import {AccountConnection} from '../AccountConnection';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {UnstyledLink} from 'components';

import {Item} from '../Item';
import {TextStyle} from '../../../../TextStyle';
import {UnstyledLink} from '../../../../UnstyledLink';

describe('<Item />', () => {
it('adds a style property when the image prop is present', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {Popover, ActionList, Button} from 'components';

import {ActionList} from '../../../../ActionList';
import {Button} from '../../../../Button';
import {Popover} from '../../../../Popover';
import {MenuGroup} from '../MenuGroup';

describe('<MenuGroup />', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import {HorizontalDotsMinor} from '@shopify/polaris-icons';
import {mountWithApp} from 'tests/utilities';
import {Button, Popover} from 'components';

import {Button} from '../../../../Button';
import {Popover} from '../../../../Popover';
// eslint-disable-next-line @shopify/strict-component-boundaries
import {
Item as ActionListItem,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Autocomplete/tests/Autocomplete.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import {mountWithApp, ReactTestingElement, CustomRoot} from 'tests/utilities';
import {KeypressListener} from 'components';

import {TextField} from '../../TextField';
import {Key, SectionDescriptor} from '../../../types';
Expand All @@ -9,6 +8,7 @@ import {ComboboxTextFieldContext} from '../../../utilities/combobox';
import {Autocomplete} from '../Autocomplete';
import {Combobox} from '../../Combobox';
import type {ComboboxProps} from '../../Combobox';
import {KeypressListener} from '../../KeypressListener';
import {Listbox} from '../../Listbox';

describe('<Autocomplete/>', () => {
Expand Down
4 changes: 3 additions & 1 deletion src/components/Avatar/tests/Avatar-ssr.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {Avatar, Image} from 'components';

import {Image} from '../../Image';
import {Avatar} from '../Avatar';

jest.mock('../../../utilities/use-is-after-initial-mount', () => {
return {
Expand Down
4 changes: 3 additions & 1 deletion src/components/Avatar/tests/Avatar.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {Avatar, Image} from 'components';

import {Image} from '../../Image';
import {Avatar} from '../Avatar';

describe('<Avatar />', () => {
describe('intials', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Badge/tests/Badge.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {VisuallyHidden} from 'components';

import {VisuallyHidden} from '../../VisuallyHidden';
import {Badge} from '../Badge';

describe('<Badge />', () => {
Expand Down
14 changes: 6 additions & 8 deletions src/components/Banner/tests/Banner.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ import {
DiamondAlertMajor,
} from '@shopify/polaris-icons';
import {mountWithApp} from 'tests/utilities';
import {
Button,
Heading,
Icon,
Spinner,
UnstyledButton,
UnstyledLink,
} from 'components';

import {Button} from '../../Button';
import {Heading} from '../../Heading';
import {Icon} from '../../Icon';
import {Spinner} from '../../Spinner';
import {UnstyledButton} from '../../UnstyledButton';
import {UnstyledLink} from '../../UnstyledLink';
import {BannerContext} from '../../../utilities/banner-context';
import {WithinContentContext} from '../../../utilities/within-content-context';
import {Banner, BannerHandles} from '../Banner';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import {Popover, ActionList} from 'components';
import {mountWithApp} from 'tests/utilities';

import {ActionList} from '../../../../ActionList';
import {Popover} from '../../../../Popover';
import {BulkActionMenu, BulkActionsMenuProps, BulkActionButton} from '../..';

const defaultProps: BulkActionsMenuProps = {
Expand Down
3 changes: 2 additions & 1 deletion src/components/BulkActions/tests/BulkActions.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react';
import {Transition, CSSTransition} from 'react-transition-group';
import {mountWithApp} from 'tests/utilities';
import {Popover, ActionList} from 'components';

import {ActionList} from '../../ActionList';
import {CheckableButton} from '../../CheckableButton';
import {Button} from '../../Button';
import {Popover} from '../../Popover';
import {
BulkActionButton,
BulkActionMenu,
Expand Down
6 changes: 5 additions & 1 deletion src/components/Button/tests/Button.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import {
SelectMinor,
} from '@shopify/polaris-icons';
import {mountWithApp} from 'tests/utilities';
import {ActionList, Icon, Popover, Spinner, UnstyledButton} from 'components';

import {ActionList} from '../../ActionList';
import {Icon} from '../../Icon';
import {Popover} from '../../Popover';
import {Spinner} from '../../Spinner';
import {UnstyledButton} from '../../UnstyledButton';
import {Button} from '../Button';
import en from '../../../../locales/en.json';
import styles from '../Button.scss';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {Button} from 'components';

import {Button} from '../../../../Button';
import {Item} from '../Item';

describe('<Item />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ButtonGroup/tests/ButtonGroup.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {Button} from 'components';

import {Button} from '../../Button';
import {Item} from '../components';
import {ButtonGroup} from '../ButtonGroup';

Expand Down
3 changes: 2 additions & 1 deletion src/components/CalloutCard/tests/CalloutCard.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {Button, ButtonGroup} from 'components';

import {Button} from '../../Button';
import {ButtonGroup} from '../../ButtonGroup';
import {CalloutCard} from '../CalloutCard';

describe('<CalloutCard />', () => {
Expand Down
4 changes: 3 additions & 1 deletion src/components/Card/components/Header/tests/Header.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {ButtonGroup, Heading, buttonsFrom} from 'components';

import {buttonsFrom} from '../../../../Button';
import {ButtonGroup} from '../../../../ButtonGroup';
import {Heading} from '../../../../Heading';
import {Header} from '../Header';

jest.mock('../../../../Button', () => ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {Badge, Subheading, ButtonGroup, Button} from 'components';

import {Badge} from '../../../../Badge';
import {Button} from '../../../../Button';
import {ButtonGroup} from '../../../../ButtonGroup';
import {Subheading} from '../../../../Subheading';
import {Section} from '../Section';

describe('<Card.Section />', () => {
Expand Down
6 changes: 5 additions & 1 deletion src/components/Card/tests/Card.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {Card, Badge, Button, Popover, ActionList} from 'components';

import {Badge} from '../../Badge';
import {Button} from '../../Button';
import {Popover} from '../../Popover';
import {ActionList} from '../../ActionList';
import {WithinContentContext} from '../../../utilities/within-content-context';
import {Card} from '../Card';
import {Section} from '../components';

describe('<Card />', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {Checkbox} from 'components';

import {Checkbox} from '../../Checkbox';
import {CheckableButton} from '../CheckableButton';

const CheckableButtonProps = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Choice/tests/Choice.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {InlineError} from 'components';

import {InlineError} from '../../InlineError';
import {Choice} from '../Choice';

describe('<Choice />', () => {
Expand Down
4 changes: 3 additions & 1 deletion src/components/ChoiceList/tests/ChoiceList.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {RadioButton, Checkbox, InlineError} from 'components';

import {Checkbox} from '../../Checkbox';
import {InlineError} from '../../InlineError';
import {RadioButton} from '../../RadioButton';
import {ChoiceList, ChoiceListProps} from '../ChoiceList';

describe('<ChoiceList />', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, {ReactElement} from 'react';
import {CaretUpMinor, CaretDownMinor} from '@shopify/polaris-icons';
import {mountWithApp} from 'tests/utilities';

import {Icon} from '../../../..';
import {Icon} from '../../../../Icon';
import {Cell} from '../Cell';

describe('<Cell />', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {Button} from 'components';

import {Button} from '../../../../Button';
import {Navigation} from '../Navigation';

describe('<Navigation />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/DataTable/tests/DataTable.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import {timer} from '@shopify/jest-dom-mocks';
import {mountWithApp} from 'tests/utilities';
import {Checkbox} from 'components';

import {Checkbox} from '../../Checkbox';
import {Cell, Navigation} from '../components';
import {DataTable, DataTableProps} from '../DataTable';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import {Caption, TextStyle} from 'components';
import {mountWithApp} from 'tests/utilities';

import {Caption} from '../../../../Caption';
import {TextStyle} from '../../../../TextStyle';
import {DropZoneContext} from '../../../context';
import {FileUpload} from '../FileUpload';
import {uploadArrow as uploadArrowImage} from '../../../images';
Expand Down
8 changes: 5 additions & 3 deletions src/components/DropZone/tests/DropZone.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React from 'react';
import {act} from 'react-dom/test-utils';
import {clock} from '@shopify/jest-dom-mocks';
import {Label, Labelled, TextStyle, Caption} from 'components';
import {mountWithApp} from 'tests/utilities';
import type {CustomRoot} from '@shopify/react-testing';
import {mountWithApp, CustomRoot} from 'tests/utilities';

import {Caption} from '../../Caption';
import {Label} from '../../Label';
import {Labelled} from '../../Labelled';
import {TextStyle} from '../../TextStyle';
import {DropZone, DropZoneFileType} from '../DropZone';
import {DropZoneContext} from '../context';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {DisplayText, TextStyle} from 'components';

import {DisplayText} from '../../DisplayText';
import {TextStyle} from '../../TextStyle';
import {EmptySearchResult} from '../EmptySearchResult';
import {emptySearch} from '../illustrations';

Expand Down
14 changes: 6 additions & 8 deletions src/components/EmptyState/tests/EmptyState.test.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {
Button,
DisplayText,
Image,
Stack,
TextContainer,
UnstyledLink,
} from 'components';

import {Button} from '../../Button';
import {DisplayText} from '../../DisplayText';
import {Image} from '../../Image';
import {Stack} from '../../Stack';
import {TextContainer} from '../../TextContainer';
import {UnstyledLink} from '../../UnstyledLink';
import {WithinContentContext} from '../../../utilities/within-content-context';
import {EmptyState} from '../EmptyState';

Expand Down
2 changes: 1 addition & 1 deletion src/components/ExceptionList/tests/ExceptionList.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import {CirclePlusMinor, NoteMinor} from '@shopify/polaris-icons';
import {mountWithApp} from 'tests/utilities';
import {Icon} from 'components';

import {ExceptionList} from '../ExceptionList';
import {Icon} from '../../Icon';
import {Truncate} from '../../Truncate';

describe('<ExceptionList />', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import {Popover, Button} from 'components';
import {mountWithApp} from 'tests/utilities';

import {Button} from '../../../../Button';
import {Popover} from '../../../../Popover';
import styles from '../ConnectedFilterControl.scss';
import {
ConnectedFilterControl,
Expand Down
Loading