diff --git a/packages/dnb-eufemia/src/components/global-status/__tests__/__snapshots__/GlobalStatus.test.js.snap b/packages/dnb-eufemia/src/components/global-status/__tests__/__snapshots__/GlobalStatus.test.js.snap index f0cb49bd322..2f3a7268ecb 100644 --- a/packages/dnb-eufemia/src/components/global-status/__tests__/__snapshots__/GlobalStatus.test.js.snap +++ b/packages/dnb-eufemia/src/components/global-status/__tests__/__snapshots__/GlobalStatus.test.js.snap @@ -1569,7 +1569,6 @@ exports[`GlobalStatus snapshot have to match linked components snapshot 1`] = ` className={null} custom_element={null} custom_method={null} - default_state={null} disabled={null} global_status_id="linked" id="switch" diff --git a/packages/dnb-eufemia/src/components/switch/Switch.js b/packages/dnb-eufemia/src/components/switch/Switch.js index a31dff51eb7..e1c8bb09c82 100644 --- a/packages/dnb-eufemia/src/components/switch/Switch.js +++ b/packages/dnb-eufemia/src/components/switch/Switch.js @@ -48,7 +48,6 @@ export default class Switch extends React.PureComponent { ]), label_position: PropTypes.oneOf(['left', 'right']), title: PropTypes.string, - default_state: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]), // Deprecated checked: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]), disabled: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]), id: PropTypes.string, @@ -93,7 +92,6 @@ export default class Switch extends React.PureComponent { label: null, label_position: null, title: null, - default_state: null, // Deprecated checked: null, disabled: null, id: null, @@ -130,14 +128,7 @@ export default class Switch extends React.PureComponent { static getDerivedStateFromProps(props, state) { if (state._listenForPropChanges) { if (props.checked !== state._checked) { - if ( - props.default_state !== null && - typeof state.checked === 'undefined' - ) { - state.checked = Switch.parseChecked(props.default_state) - } else { - state.checked = Switch.parseChecked(props.checked) - } + state.checked = Switch.parseChecked(props.checked) } } state._listenForPropChanges = true diff --git a/packages/dnb-eufemia/src/components/switch/__tests__/Switch.test.js b/packages/dnb-eufemia/src/components/switch/__tests__/Switch.test.js index 8b2f51f4bb3..985aa2e0e6f 100644 --- a/packages/dnb-eufemia/src/components/switch/__tests__/Switch.test.js +++ b/packages/dnb-eufemia/src/components/switch/__tests__/Switch.test.js @@ -65,26 +65,6 @@ describe('Switch component', () => { expect(my_event.mock.calls[0][0].checked).toBe(true) }) - it('uses "default_value" as the startup state – if given', () => { - expect( - mount() - .find('input') - .instance().checked - ).toBe(true) - - expect( - mount() - .find('input') - .instance().checked - ).toBe(true) - - const Comp = mount() - expect(Comp.find('input').instance().checked).toBe(false) - - Comp.find('input').simulate('change') - expect(Comp.find('input').instance().checked).toBe(true) - }) - it('does handle controlled vs uncontrolled state properly', () => { const ControlledVsUncontrolled = () => { const [checked, setChecked] = React.useState(true) diff --git a/packages/dnb-eufemia/src/components/switch/__tests__/__snapshots__/Switch.test.js.snap b/packages/dnb-eufemia/src/components/switch/__tests__/__snapshots__/Switch.test.js.snap index 2f67a6c6763..dc0b3ddb0cb 100644 --- a/packages/dnb-eufemia/src/components/switch/__tests__/__snapshots__/Switch.test.js.snap +++ b/packages/dnb-eufemia/src/components/switch/__tests__/__snapshots__/Switch.test.js.snap @@ -8,7 +8,6 @@ exports[`Switch component have to match snapshot 1`] = ` className="className" custom_element={{}} custom_method={[Function]} - default_state="default_state" disabled="disabled" global_status_id="main" id="id" @@ -146,7 +145,6 @@ exports[`Switch component have to match snapshot 1`] = ` "className": "className", "custom_element": {}, "custom_method": [Function], - "default_state": "default_state", "disabled": "disabled", "global_status_id": "main", "id": "id",