diff --git a/packages/design-system/src/components/Button/Button.stories.jsx b/packages/design-system/src/components/Button/Button.stories.jsx
index a36bc6c0ae..38aa08d482 100644
--- a/packages/design-system/src/components/Button/Button.stories.jsx
+++ b/packages/design-system/src/components/Button/Button.stories.jsx
@@ -13,9 +13,6 @@ export default {
control: { type: 'text' },
type: { name: 'string', required: true },
},
- component: {
- control: false,
- },
disabled: {
control: { type: 'boolean' },
},
@@ -25,6 +22,11 @@ export default {
disable: true,
},
},
+ component: {
+ table: {
+ disable: true,
+ },
+ },
// hiding deprecated opts
variation: {
options: ['primary', 'success', 'transparent'],
diff --git a/packages/design-system/src/components/Button/Button.test.tsx b/packages/design-system/src/components/Button/Button.test.tsx
index 14b1cbc70f..782ace2898 100644
--- a/packages/design-system/src/components/Button/Button.test.tsx
+++ b/packages/design-system/src/components/Button/Button.test.tsx
@@ -2,13 +2,16 @@ import Button, { ButtonProps, ButtonComponentType } from './Button';
import React from 'react';
import { shallow } from 'enzyme';
-interface LinkProps {
- children: React.ReactNode;
- type: 'submit';
- to: string;
+function mockWarn(testFunction: () => void) {
+ const original = console.warn;
+ const mock = jest.fn();
+ console.warn = mock;
+ testFunction();
+ console.warn = original;
+ return mock;
}
-const Link = (props: LinkProps) => {
+const Link = (props: any) => {
return
{props.children}
;
};
@@ -49,20 +52,21 @@ describe('Button', () => {
});
it('renders as a custom Link component', () => {
- const wrapper = shallow(
-
- );
- expect(wrapper.is('Link')).toBe(true);
- expect(wrapper.hasClass('ds-c-button')).toBe(true);
- expect(wrapper.render().text()).toBe(defaultProps.children);
- expect(wrapper).toMatchSnapshot();
+ mockWarn(() => {
+ const wrapper = shallow(
+
+ );
+ expect(wrapper.is('Link')).toBe(true);
+ expect(wrapper.hasClass('ds-c-button')).toBe(true);
+ expect(wrapper.render().text()).toBe(defaultProps.children);
+ expect(wrapper).toMatchSnapshot();
+ });
});
it('renders disabled link correctly', () => {
@@ -146,4 +150,21 @@ describe('Button', () => {
expect(wrapper.hasClass('ds-c-button--transparent')).toBe(true);
expect(wrapper).toMatchSnapshot();
});
+
+ it('prints deprecation warning for "component" prop', () => {
+ const mock = mockWarn(() => {
+ shallow(
+
+ );
+ });
+ expect(mock).toHaveBeenCalledWith(
+ "[Deprecated]: Please remove the 'component' prop in