diff --git a/packages/application-shell/src/components/menu-state-container/index.js b/packages/application-shell/src/components/menu-state-container/index.js deleted file mode 100644 index a3c882da77..0000000000 --- a/packages/application-shell/src/components/menu-state-container/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './menu-state-container'; diff --git a/packages/application-shell/src/components/menu-state-container/menu-state-container.js b/packages/application-shell/src/components/menu-state-container/menu-state-container.js deleted file mode 100644 index 5e18c69951..0000000000 --- a/packages/application-shell/src/components/menu-state-container/menu-state-container.js +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; - -class MenuStateContainer extends React.Component { - static displayName = 'MenuState'; - static propTypes = { - children: PropTypes.func.isRequired, - }; - - toggleMenu = () => - this.setState(prevState => ({ isOpen: !prevState.isOpen })); - - state = { - isOpen: false, - }; - - render() { - return this.props.children({ - isOpen: this.state.isOpen, - toggleMenu: this.toggleMenu, - }); - } -} - -export default MenuStateContainer; diff --git a/packages/application-shell/src/components/menu-state-container/menu-state-container.spec.js b/packages/application-shell/src/components/menu-state-container/menu-state-container.spec.js deleted file mode 100644 index b5c5fdf595..0000000000 --- a/packages/application-shell/src/components/menu-state-container/menu-state-container.spec.js +++ /dev/null @@ -1,66 +0,0 @@ -import React from 'react'; -import { shallow } from 'enzyme'; -import MenuStateContainer from './menu-state-container'; - -const Component = props =>
Component
; -Component.displayName = 'Component'; - -const createTestProps = props => ({ - ...props, -}); - -describe('', () => { - let wrapper; - let props; - let children; - - describe('state', () => { - describe('toggleMenu', () => { - beforeEach(() => { - props = createTestProps(); - children = jest.fn(() => ); - wrapper = shallow( - {children} - ); - - wrapper.instance().toggleMenu(); - }); - - it('should set `isOpen` to `true`', () => { - expect(wrapper).toHaveState('isOpen', true); - }); - it('should call `children` with isOpen', () => { - expect(children).toHaveBeenCalledWith( - expect.objectContaining({ - isOpen: true, - toggleMenu: wrapper.instance().toggleMenu, - }) - ); - }); - }); - }); - - describe('rendering', () => { - beforeEach(() => { - props = createTestProps(); - children = jest.fn(() => ); - wrapper = shallow( - {children} - ); - }); - it('should call `children` with isOpen', () => { - expect(children).toHaveBeenCalledWith( - expect.objectContaining({ - isOpen: false, - }) - ); - }); - it('should call `children` with toggleMenu', () => { - expect(children).toHaveBeenCalledWith( - expect.objectContaining({ - toggleMenu: wrapper.instance().toggleMenu, - }) - ); - }); - }); -}); diff --git a/packages/application-shell/src/components/password-requirement/__snapshots__/password-requirement.spec.js.snap b/packages/application-shell/src/components/password-requirement/__snapshots__/password-requirement.spec.js.snap deleted file mode 100644 index c5bbaf5a48..0000000000 --- a/packages/application-shell/src/components/password-requirement/__snapshots__/password-requirement.spec.js.snap +++ /dev/null @@ -1,21 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`rendering should match snapshot 1`] = ` -
- - - -
- Requirement #1 -
-
-`; diff --git a/packages/application-shell/src/components/password-requirement/index.js b/packages/application-shell/src/components/password-requirement/index.js deleted file mode 100644 index 7836a67afe..0000000000 --- a/packages/application-shell/src/components/password-requirement/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './password-requirement'; diff --git a/packages/application-shell/src/components/password-requirement/password-requirement.js b/packages/application-shell/src/components/password-requirement/password-requirement.js deleted file mode 100644 index 453a8628c8..0000000000 --- a/packages/application-shell/src/components/password-requirement/password-requirement.js +++ /dev/null @@ -1,34 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import classnames from 'classnames'; -import { SuccessIcon, CloseBoldIcon } from '@commercetools-frontend/ui-kit'; -import styles from './password-requirement.mod.css'; - -const PasswordRequirement = props => { - const showUnfulfilledError = - !props.isFulfilled && props.shouldShowUnfulfilledAsError; - return ( -
- - {props.isFulfilled && } - {showUnfulfilledError && } - -
- {props.children} -
-
- ); -}; - -PasswordRequirement.displayName = 'PasswordRequirement'; -PasswordRequirement.propTypes = { - children: PropTypes.node.isRequired, - isFulfilled: PropTypes.bool, - shouldShowUnfulfilledAsError: PropTypes.bool, -}; -export default PasswordRequirement; diff --git a/packages/application-shell/src/components/password-requirement/password-requirement.mod.css b/packages/application-shell/src/components/password-requirement/password-requirement.mod.css deleted file mode 100644 index 733a19fe21..0000000000 --- a/packages/application-shell/src/components/password-requirement/password-requirement.mod.css +++ /dev/null @@ -1,24 +0,0 @@ -.password-requirement { - display: flex; - flex-direction: row; - align-items: flex-end; -} - -.icon { - flex: 0 var(--spacing-24); - display: flex; - justify-content: flex-start; -} - -.requirement { - width: 100%; - color: var(--font-color-readonly); -} - -.fulfilled { - color: var(--font-color-success); -} - -.unfulfilled { - color: var(--font-color-error); -} diff --git a/packages/application-shell/src/components/password-requirement/password-requirement.spec.js b/packages/application-shell/src/components/password-requirement/password-requirement.spec.js deleted file mode 100644 index 5f513bb454..0000000000 --- a/packages/application-shell/src/components/password-requirement/password-requirement.spec.js +++ /dev/null @@ -1,87 +0,0 @@ -import React from 'react'; -import { shallow } from 'enzyme'; -import { SuccessIcon, CloseBoldIcon } from '@commercetools-frontend/ui-kit'; -import PasswordRequirement from './password-requirement'; -import styles from './password-requirement.mod.css'; - -const createTestProps = props => ({ - isFulfilled: true, - shouldShowUnfulfilledAsError: true, - ...props, -}); - -describe('rendering', () => { - let wrapper; - let props; - beforeEach(() => { - props = createTestProps(); - wrapper = shallow( - Requirement #1 - ); - }); - it('should match snapshot', () => { - expect(wrapper).toMatchSnapshot(); - }); - describe('with fulfilled requirement', () => { - describe.each([[true], [false]])( - 'when `shouldShowUnfulfilledAsError` is `%s`', - shouldShowUnfulfilledAsError => { - beforeEach(() => { - props = createTestProps({ - isFulfilled: true, - shouldShowUnfulfilledAsError, - }); - wrapper = shallow( - Requirement #1 - ); - }); - it('should have `SuccessIcon`', () => { - expect(wrapper).toRender(SuccessIcon); - }); - it('should have requirement styled as `fullfilled`', () => { - expect(wrapper.find(`.${styles.requirement}`)).toHaveClassName( - styles.fulfilled - ); - }); - } - ); - }); - describe('with un-fulfilled requirement', () => { - describe('when `shouldShowUnfulfilledAsError` is `true`', () => { - beforeEach(() => { - props = createTestProps({ - isFulfilled: false, - shouldShowUnfulfilledAsError: true, - }); - wrapper = shallow( - Requirement #1 - ); - }); - it('should have `CloseBoldIcon`', () => { - expect(wrapper).toRender(CloseBoldIcon); - }); - it('should have requirement styled as `unfulfilled`', () => { - expect(wrapper.find(`.${styles.requirement}`)).toHaveClassName( - styles.unfulfilled - ); - }); - }); - describe('when `shouldShowUnfulfilledAsError` is `false`', () => { - beforeEach(() => { - props = createTestProps({ - isFulfilled: false, - shouldShowUnfulfilledAsError: false, - }); - wrapper = shallow( - Requirement #1 - ); - }); - it('should not have `CloseBoldIcon`', () => { - expect(wrapper).not.toRender(CloseBoldIcon); - }); - it('should not have `SuccessIcon`', () => { - expect(wrapper).not.toRender(SuccessIcon); - }); - }); - }); -}); diff --git a/packages/application-shell/src/components/password-requirements/__snapshots__/password-requirements.spec.js.snap b/packages/application-shell/src/components/password-requirements/__snapshots__/password-requirements.spec.js.snap deleted file mode 100644 index 3d40d96116..0000000000 --- a/packages/application-shell/src/components/password-requirements/__snapshots__/password-requirements.spec.js.snap +++ /dev/null @@ -1,12 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`rendering should match snapshot 1`] = ` -
- -
-`; diff --git a/packages/application-shell/src/components/password-requirements/index.js b/packages/application-shell/src/components/password-requirements/index.js deleted file mode 100644 index 30982bfa95..0000000000 --- a/packages/application-shell/src/components/password-requirements/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './password-requirements'; diff --git a/packages/application-shell/src/components/password-requirements/password-requirements.js b/packages/application-shell/src/components/password-requirements/password-requirements.js deleted file mode 100644 index e82a5c82ae..0000000000 --- a/packages/application-shell/src/components/password-requirements/password-requirements.js +++ /dev/null @@ -1,30 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import classnames from 'classnames'; -import requiredIf from 'react-required-if'; -import styles from './password-requirements.mod.css'; - -const PasswordRequirements = props => ( -
- {React.Children.map(props.children, child => - React.cloneElement(child, { - shouldShowUnfulfilledAsError: props.shouldShowUnfulfilledAsError, - }) - )} -
-); - -PasswordRequirements.displayName = 'PasswordRequirements'; -PasswordRequirements.propTypes = { - children: PropTypes.node.isRequired, - isExpanded: requiredIf( - PropTypes.bool, - props => props.shouldShowUnfulfilledAsError - ), - shouldShowUnfulfilledAsError: PropTypes.bool, -}; -export default PasswordRequirements; diff --git a/packages/application-shell/src/components/password-requirements/password-requirements.mod.css b/packages/application-shell/src/components/password-requirements/password-requirements.mod.css deleted file mode 100644 index 03f899b2f1..0000000000 --- a/packages/application-shell/src/components/password-requirements/password-requirements.mod.css +++ /dev/null @@ -1,10 +0,0 @@ -.password-requirements { - overflow: hidden; - transition: max-height 0.3s ease-in-out; - max-height: 0; -} - -.expanded { - /* here we add a large height to trigger the animation */ - max-height: 600px; -} diff --git a/packages/application-shell/src/components/password-requirements/password-requirements.spec.js b/packages/application-shell/src/components/password-requirements/password-requirements.spec.js deleted file mode 100644 index da2e565a3a..0000000000 --- a/packages/application-shell/src/components/password-requirements/password-requirements.spec.js +++ /dev/null @@ -1,86 +0,0 @@ -import React from 'react'; -import { shallow } from 'enzyme'; -import PasswordRequirements from './password-requirements'; -import styles from './password-requirements.mod.css'; - -const createTestProps = props => ({ - isExpanded: true, - shouldShowUnfulfilledAsError: true, - ...props, -}); - -const Child = () =>
; - -describe('rendering', () => { - let wrapper; - let props; - beforeEach(() => { - props = createTestProps(); - wrapper = shallow( - - - - ); - }); - it('should match snapshot', () => { - expect(wrapper).toMatchSnapshot(); - }); - describe('when `shouldShowUnfulfilledAsError` is `true`', () => { - beforeEach(() => { - props = createTestProps({ shouldShowUnfulfilledAsError: true }); - wrapper = shallow( - - - - ); - }); - it('should pass on `shouldShowUnfulfilledAsError` to children', () => { - expect(wrapper.find(Child)).toHaveProp( - 'shouldShowUnfulfilledAsError', - true - ); - }); - }); - describe('when `shouldShowUnfulfilledAsError` is `false`', () => { - beforeEach(() => { - props = createTestProps({ shouldShowUnfulfilledAsError: false }); - wrapper = shallow( - - - - ); - }); - it('should pass on `shouldShowUnfulfilledAsError` to children', () => { - expect(wrapper.find(Child)).toHaveProp( - 'shouldShowUnfulfilledAsError', - false - ); - }); - }); - describe('when `isExpanded` is `true`', () => { - beforeEach(() => { - props = createTestProps({ isExpanded: true }); - wrapper = shallow( - - - - ); - }); - it('should add class `expanded`', () => { - expect(wrapper).toHaveClassName(styles.expanded); - }); - }); - describe('when `isExpanded` is `false`', () => { - beforeEach(() => { - props = createTestProps({ isExpanded: false }); - wrapper = shallow( - - - - ); - }); - it('should pass on `shouldShowUnfulfilledAsError` to children', () => { - expect(wrapper).not.toHaveClassName(styles.expanded); - }); - }); -}); diff --git a/packages/application-shell/src/components/project-without-settings/__snapshots__/project-without-settings.spec.js.snap b/packages/application-shell/src/components/project-without-settings/__snapshots__/project-without-settings.spec.js.snap deleted file mode 100644 index 01c188bf44..0000000000 --- a/packages/application-shell/src/components/project-without-settings/__snapshots__/project-without-settings.spec.js.snap +++ /dev/null @@ -1,7 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`rendering outputs correct tree 1`] = ` - - - -`; diff --git a/packages/application-shell/src/components/project-without-settings/index.js b/packages/application-shell/src/components/project-without-settings/index.js deleted file mode 100644 index 65fb5ee966..0000000000 --- a/packages/application-shell/src/components/project-without-settings/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './project-without-settings'; diff --git a/packages/application-shell/src/components/project-without-settings/project-without-settings.js b/packages/application-shell/src/components/project-without-settings/project-without-settings.js deleted file mode 100644 index bbd068b244..0000000000 --- a/packages/application-shell/src/components/project-without-settings/project-without-settings.js +++ /dev/null @@ -1,28 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { withRouter } from 'react-router'; - -// NOTE: the setting somehow is missing, the data is corrupt? -// When we refactor settings, this should not be a concern anymore. -// At the moment, settings are created for projects when the projects -// are being fetched. If for some reason the project setting is not created -// then there is a problem. -// However, the backend should not need to do this anymore. This needs to be -// investigated further when we do the refactoring. -const ProjectWithoutSettings = props => ( -
- {`Unexpected error. The project-setting is missing for project ${ - props.match.params.projectKey - }. Please contact our support.`} -
-); -ProjectWithoutSettings.displayName = 'ProjectWithoutSettings'; -ProjectWithoutSettings.propTypes = { - match: PropTypes.shape({ - params: PropTypes.shape({ - projectKey: PropTypes.string, - }).isRequired, - }).isRequired, -}; - -export default withRouter(ProjectWithoutSettings); diff --git a/packages/application-shell/src/components/project-without-settings/project-without-settings.spec.js b/packages/application-shell/src/components/project-without-settings/project-without-settings.spec.js deleted file mode 100644 index baf5b366a0..0000000000 --- a/packages/application-shell/src/components/project-without-settings/project-without-settings.spec.js +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react'; -import { shallow } from 'enzyme'; -import ProjectWithoutSettings from './project-without-settings'; - -describe('rendering', () => { - let wrapper; - beforeEach(() => { - wrapper = shallow( - - ); - }); - it('outputs correct tree', () => { - expect(wrapper).toMatchSnapshot(); - }); -}); diff --git a/packages/application-shell/src/components/version-check-subscriber/index.js b/packages/application-shell/src/components/version-check-subscriber/index.js deleted file mode 100644 index 83a4adae72..0000000000 --- a/packages/application-shell/src/components/version-check-subscriber/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './version-check-subscriber'; diff --git a/packages/application-shell/src/components/version-check-subscriber/version-check-subscriber.js b/packages/application-shell/src/components/version-check-subscriber/version-check-subscriber.js deleted file mode 100644 index 9aaf5dd397..0000000000 --- a/packages/application-shell/src/components/version-check-subscriber/version-check-subscriber.js +++ /dev/null @@ -1,70 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { compose, setDisplayName } from 'recompose'; -import { connect } from 'react-redux'; -import { actions as sdkActions } from '@commercetools-frontend/sdk'; -import { withApplicationContext } from '@commercetools-frontend/application-shell-connectors'; - -export class VersionCheckSubscriber extends React.PureComponent { - static displayName = 'VersionCheckSubscriber'; - - static propTypes = { - applicationContext: PropTypes.shape({ - environment: PropTypes.shape({ - revision: PropTypes.string, - }).isRequired, - }).isRequired, - fetchServerVersion: PropTypes.func, - }; - - componentDidMount() { - if (process.env.NODE_ENV !== 'development') - this.poll = setInterval(() => { - this.props.fetchServerVersion().then( - data => { - if ( - data.revision !== - this.props.applicationContext.environment.revision - ) - // TODO: notify the user that a new version is available - // Possible options: - // - show a notification message (global/sidebar) - // - have a "special" icon in the `TopNavigation` that indicates - // a new version is available (e.g. like Chrome does) - // eslint-disable-next-line no-console - console.info( - 'VersionCheckSubscriber: New version available, please reload the page' - ); - }, - error => { - // eslint-disable-next-line no-console - console.warn( - 'VersionCheckSubscriber: Could not fetch version.', - error - ); - } - ); - }, 1000 * 60); // 1min - } - - componentWillUnmount() { - if (process.env.NODE_ENV !== 'development') clearInterval(this.poll); - } - - render() { - return null; - } -} - -const mapDispatchToProps = dispatch => ({ - fetchServerVersion: () => dispatch(sdkActions.get({ uri: '/version' })), -}); - -export default compose( - setDisplayName('VersionCheckSubscriber'), - withApplicationContext(), - connect( - null, - mapDispatchToProps - ) -)(VersionCheckSubscriber); diff --git a/packages/application-shell/src/components/version-check-subscriber/version-check-subscriber.spec.js b/packages/application-shell/src/components/version-check-subscriber/version-check-subscriber.spec.js deleted file mode 100644 index f03750d32d..0000000000 --- a/packages/application-shell/src/components/version-check-subscriber/version-check-subscriber.spec.js +++ /dev/null @@ -1,126 +0,0 @@ -/* eslint-disable no-console */ -import React from 'react'; -import { shallow } from 'enzyme'; -import { VersionCheckSubscriber } from './version-check-subscriber'; - -const createTestProps = props => ({ - fetchServerVersion: jest.fn(), - applicationContext: { - environment: { - revision: '123', - }, - }, - ...props, -}); - -describe('rendering', () => { - let wrapper; - beforeEach(() => { - const props = createTestProps(); - wrapper = shallow(); - }); - it('should render nothing', () => { - expect(wrapper.type()).toBe(null); - }); -}); - -describe('lifecycle', () => { - let props; - let wrapper; - describe('componentDidMount', () => { - describe('if env is development', () => { - const currentEnv = process.env.NODE_ENV; - beforeEach(() => { - process.env.NODE_ENV = 'development'; - props = createTestProps(); - wrapper = shallow(); - wrapper.instance().componentDidMount(); - }); - afterEach(() => { - process.env.NODE_ENV = currentEnv; - }); - it('should do nothing', () => { - expect(props.fetchServerVersion).toHaveBeenCalledTimes(0); - }); - }); - describe('if env is not development', () => { - beforeEach(() => { - console.info = jest.fn(); - console.warn = jest.fn(); - }); - describe('if deployed version is the same as the one in the browser', () => { - beforeEach(async () => { - jest.useFakeTimers(); - const fetchServerVersionResult = Promise.resolve({ revision: '123' }); - props = createTestProps({ - fetchServerVersion: jest.fn(() => fetchServerVersionResult), - clientVersion: '123', - }); - wrapper = shallow(); - wrapper.instance().componentDidMount(); - jest.runOnlyPendingTimers(); - await fetchServerVersionResult; - }); - it('should not notify', () => { - expect(console.info).toHaveBeenCalledTimes(0); - }); - it('should assign interval reference into component instance', () => { - expect(wrapper.instance().poll).toBeDefined(); - }); - }); - describe('if deployed version is different then the one in the browser', () => { - beforeEach(async () => { - jest.useFakeTimers(); - const fetchServerVersionResult = Promise.resolve({ revision: '456' }); - props = createTestProps({ - fetchServerVersion: jest.fn(() => fetchServerVersionResult), - clientVersion: '123', - }); - wrapper = shallow(); - wrapper.instance().componentDidMount(); - jest.runOnlyPendingTimers(); - await fetchServerVersionResult; - }); - it('should notify', () => { - expect(console.info).toHaveBeenCalledWith( - 'VersionCheckSubscriber: New version available, please reload the page' - ); - }); - it('should assign interval reference into component instance', () => { - expect(wrapper.instance().poll).toBeDefined(); - }); - }); - }); - }); - describe('componentWillUnmount', () => { - describe('if env is development', () => { - const currentEnv = process.env.NODE_ENV; - beforeEach(() => { - jest.useFakeTimers(); - process.env.NODE_ENV = 'development'; - props = createTestProps(); - wrapper = shallow(); - wrapper.instance().poll = 'foo'; - wrapper.instance().componentWillUnmount(); - }); - afterEach(() => { - process.env.NODE_ENV = currentEnv; - }); - it('should do nothing', () => { - expect(clearInterval).toHaveBeenCalledTimes(0); - }); - }); - describe('if env is not development', () => { - beforeEach(() => { - jest.useFakeTimers(); - props = createTestProps(); - wrapper = shallow(); - wrapper.instance().poll = 'foo'; - wrapper.instance().componentWillUnmount(); - }); - it('should clear the interval', () => { - expect(clearInterval).toHaveBeenCalledWith('foo'); - }); - }); - }); -}); diff --git a/packages/application-shell/src/constants.js b/packages/application-shell/src/constants.js index e08f052c8f..e3fdb5be4c 100644 --- a/packages/application-shell/src/constants.js +++ b/packages/application-shell/src/constants.js @@ -1,10 +1,4 @@ // eslint-disable-next-line import/prefer-default-export -export const INTERCOM_TRACKING_STATUS = { - active: 'ACTIVE', - inactive: 'INACTIVE', - pending: 'PENDING', -}; - export const STORAGE_KEYS = { NONCE: 'nonce', IS_AUTHENTICATED: 'isAuthenticated', diff --git a/packages/application-shell/src/from-core/deprecate-component/deprecate-component.js b/packages/application-shell/src/from-core/deprecate-component/deprecate-component.js deleted file mode 100644 index 97aef9c666..0000000000 --- a/packages/application-shell/src/from-core/deprecate-component/deprecate-component.js +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import { getDisplayName } from 'recompose'; -import warning from 'warning'; - -export default function({ message = '' }) { - return Component => - class DeprecateComponent extends React.PureComponent { - static displayName = `Deprecated(${getDisplayName(Component)})`; - componentDidMount() { - const shouldSkipWarning = process.env.NODE_ENV === 'production'; - warning( - // `warning` logs the message when `NODE_ENV` is not 'production' - shouldSkipWarning, - `\`${getDisplayName(Component)}\` is no longer supported. ${message}` - ); - } - render() { - return ; - } - }; -} diff --git a/packages/application-shell/src/from-core/deprecate-component/deprecate-component.spec.js b/packages/application-shell/src/from-core/deprecate-component/deprecate-component.spec.js deleted file mode 100644 index e54edcbca8..0000000000 --- a/packages/application-shell/src/from-core/deprecate-component/deprecate-component.spec.js +++ /dev/null @@ -1,39 +0,0 @@ -import React from 'react'; -import { shallow } from 'enzyme'; -import warning from 'warning'; -import deprecateComponent from './deprecate-component'; - -jest.mock('warning', () => jest.fn()); - -const ChildComponent = () =>
; -ChildComponent.displayName = 'ChildComponent'; -const message = 'foo'; - -describe('rendering', () => { - let wrapper; - beforeEach(() => { - const DeprecatedChild = deprecateComponent({ message })(ChildComponent); - wrapper = shallow(); - }); - it('should render original component', () => { - expect(wrapper).toRender(ChildComponent); - }); -}); - -describe('lifecycle', () => { - let wrapper; - beforeEach(() => { - const DeprecatedChild = deprecateComponent({ message })(ChildComponent); - wrapper = shallow(); - wrapper.instance().componentDidMount(); - }); - it('should call `warning`', () => { - expect(warning).toHaveBeenCalled(); - }); - it('should call `warning` with `foo`', () => { - expect(warning).toHaveBeenCalledWith( - expect.any(Boolean), - expect.stringContaining(message) - ); - }); -}); diff --git a/packages/application-shell/src/from-core/deprecate-component/index.js b/packages/application-shell/src/from-core/deprecate-component/index.js deleted file mode 100644 index 597d53b9c5..0000000000 --- a/packages/application-shell/src/from-core/deprecate-component/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './deprecate-component'; diff --git a/packages/application-shell/src/from-core/label-field/index.js b/packages/application-shell/src/from-core/label-field/index.js deleted file mode 100644 index 485df57321..0000000000 --- a/packages/application-shell/src/from-core/label-field/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './label-field'; diff --git a/packages/application-shell/src/from-core/label-field/label-field.js b/packages/application-shell/src/from-core/label-field/label-field.js deleted file mode 100644 index ca66520a66..0000000000 --- a/packages/application-shell/src/from-core/label-field/label-field.js +++ /dev/null @@ -1,35 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import classnames from 'classnames'; -import RequiredIndicator from '../required-indicator'; -import styles from './label-field.mod.css'; - -export const LabelField = ({ title, subtitle, isRequired, className }) => ( -
- - {subtitle && ( -
- {subtitle} -
- )} -
-); -LabelField.displayName = 'LabelField'; -LabelField.defaultProps = { - isRequired: false, -}; -LabelField.propTypes = { - title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired, - subtitle: PropTypes.oneOfType([PropTypes.string, PropTypes.element]), - isRequired: PropTypes.bool, - - // for custom styles - className: PropTypes.string, -}; - -export default LabelField; diff --git a/packages/application-shell/src/from-core/label-field/label-field.mod.css b/packages/application-shell/src/from-core/label-field/label-field.mod.css deleted file mode 100644 index 3b1a6957f1..0000000000 --- a/packages/application-shell/src/from-core/label-field/label-field.mod.css +++ /dev/null @@ -1,23 +0,0 @@ -.text-small { - font-size: 0.923rem; - color: var(--color-black); -} - -.label-wrapper { - display: block; -} - -.label { - composes: text-small; - display: block; - font-weight: 700; - margin-bottom: var(--spacing-4); -} - -.description { - composes: text-small; - color: var(--color-gray); - font-weight: normal; - display: inline-block; - margin-bottom: var(--spacing-8); -} diff --git a/packages/application-shell/src/from-core/label-field/label-field.spec.js b/packages/application-shell/src/from-core/label-field/label-field.spec.js deleted file mode 100644 index af87f093c0..0000000000 --- a/packages/application-shell/src/from-core/label-field/label-field.spec.js +++ /dev/null @@ -1,38 +0,0 @@ -import React from 'react'; -import { shallow } from 'enzyme'; -import RequiredIndicator from '../required-indicator'; -import LabelField from './label-field'; - -const createTestProps = props => ({ - ...props, -}); - -describe('rendering', () => { - describe('non required labels', () => { - const props = createTestProps({ title: 'Title', subtitle: 'Subtitle' }); - const wrapper = shallow(); - it('contains a label field', () => { - expect(wrapper.find('label').type()).toBe('label'); - }); - - it('has two children when defining title/subtitle', () => { - expect(wrapper.children()).toHaveLength(2); - }); - - it('has the title and subtitle as text', () => { - expect(wrapper.text()).toBe(props.title + props.subtitle); - }); - }); - - describe('required labels', () => { - const props = createTestProps({ - title: 'Title', - subtitle: 'Subtitle', - isRequired: true, - }); - const wrapper = shallow(); - it('contains an * in the label when set as required', () => { - expect(wrapper).toRender(RequiredIndicator); - }); - }); -}); diff --git a/packages/application-shell/src/from-core/required-indicator/__snapshots__/required-indicator.spec.js.snap b/packages/application-shell/src/from-core/required-indicator/__snapshots__/required-indicator.spec.js.snap deleted file mode 100644 index 5f908dce83..0000000000 --- a/packages/application-shell/src/from-core/required-indicator/__snapshots__/required-indicator.spec.js.snap +++ /dev/null @@ -1,17 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`when uncolored should match snapshot 1`] = ` - - * - -`; - -exports[`with default props should match snapshot 1`] = ` - - * - -`; diff --git a/packages/application-shell/src/from-core/required-indicator/index.js b/packages/application-shell/src/from-core/required-indicator/index.js deleted file mode 100644 index 3df0ec0191..0000000000 --- a/packages/application-shell/src/from-core/required-indicator/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './required-indicator'; diff --git a/packages/application-shell/src/from-core/required-indicator/required-indicator.js b/packages/application-shell/src/from-core/required-indicator/required-indicator.js deleted file mode 100644 index 22569b7e99..0000000000 --- a/packages/application-shell/src/from-core/required-indicator/required-indicator.js +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import classnames from 'classnames'; -import styles from './required-indicator.mod.css'; - -const RequiredIndicator = ({ uncolored }) => ( - {'*'} -); -RequiredIndicator.displayName = 'RequiredIndicator'; -RequiredIndicator.propTypes = { - uncolored: PropTypes.bool, -}; - -export default RequiredIndicator; diff --git a/packages/application-shell/src/from-core/required-indicator/required-indicator.mod.css b/packages/application-shell/src/from-core/required-indicator/required-indicator.mod.css deleted file mode 100644 index 3ef192c176..0000000000 --- a/packages/application-shell/src/from-core/required-indicator/required-indicator.mod.css +++ /dev/null @@ -1,3 +0,0 @@ -.colored { - color: var(--color-orange); -} diff --git a/packages/application-shell/src/from-core/required-indicator/required-indicator.spec.js b/packages/application-shell/src/from-core/required-indicator/required-indicator.spec.js deleted file mode 100644 index 685aec1785..0000000000 --- a/packages/application-shell/src/from-core/required-indicator/required-indicator.spec.js +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react'; -import { shallow } from 'enzyme'; -import RequiredIndicator from './required-indicator'; - -describe('with default props', () => { - it('should match snapshot', () => { - expect(shallow()).toMatchSnapshot(); - }); -}); - -describe('when uncolored', () => { - it('should match snapshot', () => { - expect(shallow()).toMatchSnapshot(); - }); -}); diff --git a/packages/application-shell/src/from-core/title/index.js b/packages/application-shell/src/from-core/title/index.js deleted file mode 100644 index c13f09b866..0000000000 --- a/packages/application-shell/src/from-core/title/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './title'; diff --git a/packages/application-shell/src/from-core/title/title.js b/packages/application-shell/src/from-core/title/title.js deleted file mode 100644 index 3fa14c44c1..0000000000 --- a/packages/application-shell/src/from-core/title/title.js +++ /dev/null @@ -1,17 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import classnames from 'classnames'; -import style from './title.mod.css'; - -const Title = ({ children, className, ...rest }) => ( -

- {children} -

-); -Title.displayName = 'Title'; -Title.propTypes = { - className: PropTypes.string, - children: PropTypes.node.isRequired, -}; - -export default Title; diff --git a/packages/application-shell/src/from-core/title/title.mod.css b/packages/application-shell/src/from-core/title/title.mod.css deleted file mode 100644 index 3d7888ab16..0000000000 --- a/packages/application-shell/src/from-core/title/title.mod.css +++ /dev/null @@ -1,10 +0,0 @@ -.text-headline { - font-size: 1.846rem; - font-weight: 100; -} - -.title { - composes: text-headline; - color: var(--color-black); - display: block; -}