Skip to content

Commit

Permalink
Merge branch 'master' into sergei/67781/live-chat-color
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-deriv committed Apr 7, 2023
2 parents 1dd06e6 + 9ecfe42 commit 67b1c65
Show file tree
Hide file tree
Showing 402 changed files with 27,005 additions and 10,119 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"dependencies": {
"@binary-com/binary-document-uploader": "^2.4.7",
"@deriv/api-types": "^1.0.11",
"@deriv/api-types": "^1.0.94",
"@deriv/components": "^1.0.0",
"@deriv/shared": "^1.0.0",
"@deriv/translations": "^1.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/account/src/Components/Routes/binary-routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { TBinaryRoutes, TPlatformContext, TRoute } from 'Types';
import RouteWithSubRoutes from './route-with-sub-routes';

const BinaryRoutes = (props: TBinaryRoutes) => {
const { is_pre_appstore } = props;
const { is_appstore } = React.useContext<TPlatformContext>(PlatformContext);

return (
Expand All @@ -19,7 +18,7 @@ const BinaryRoutes = (props: TBinaryRoutes) => {
}
>
<Switch>
{getRoutesConfig({ is_appstore, is_pre_appstore }).map((route: TRoute, idx: number) => (
{getRoutesConfig({ is_appstore }).map((route: TRoute, idx: number) => (
<RouteWithSubRoutes key={idx} {...route} {...props} />
))}
</Switch>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ describe('<AddressDetails/>', () => {
address_state: 'Default test state',
},
validate: jest.fn(),
disabled_items: [],
};

const svgCommonRenderCheck = () => {
Expand Down Expand Up @@ -262,4 +263,19 @@ describe('<AddressDetails/>', () => {
expect(address_state_input.value).toBe('State 1');
});
});

it('should disable the field if it is immuatble from BE', async () => {
mock_props.disabled_items = ['address_line_1', 'address_line_2'];
mock_props.value.address_state = '';

render(<AddressDetails {...mock_props} />);

expect(screen.getByPlaceholderText(address_line_1)).toBeDisabled();
expect(screen.getByPlaceholderText(address_line_2)).toBeDisabled();
await waitFor(() => {
expect(screen.getByRole('textbox', { name: 'State/Province' })).toBeEnabled();
});
expect(screen.getByPlaceholderText(address_town)).toBeEnabled();
expect(screen.getByPlaceholderText(address_postcode)).toBeEnabled();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const AddressDetails = ({
is_gb_residence,
onSubmitEnabledChange,
selected_step_ref,
disabled_items,
has_real_account,
...props
}) => {
Expand Down Expand Up @@ -159,7 +160,10 @@ const AddressDetails = ({
}
maxLength={255}
placeholder={localize('First line of address')}
disabled={props.value?.address_line_1 && has_real_account}
disabled={
disabled_items.includes('address_line_1') ||
(props.value?.address_line_1 && has_real_account)
}
/>
<InputField
name='address_line_2'
Expand All @@ -171,7 +175,10 @@ const AddressDetails = ({
}
maxLength={255}
placeholder={localize('Second line of address')}
disabled={props.value?.address_line_2 && has_real_account}
disabled={
disabled_items.includes('address_line_2') ||
(props.value?.address_line_2 && has_real_account)
}
/>
<InputField
name='address_city'
Expand All @@ -182,7 +189,10 @@ const AddressDetails = ({
: localize('Town/City')
}
placeholder={localize('Town/City')}
disabled={props.value?.address_city && has_real_account}
disabled={
disabled_items.includes('address_city') ||
(props.value?.address_city && has_real_account)
}
/>
{!has_fetched_states_list && (
<div className='details-form__loader'>
Expand Down Expand Up @@ -214,7 +224,8 @@ const AddressDetails = ({
}}
list_portal_id={is_appstore ? '' : 'modal_root'}
disabled={
props.value?.address_state && has_real_account
disabled_items.includes('address_state') ||
(props.value?.address_state && has_real_account)
}
/>
</DesktopWrapper>
Expand All @@ -234,7 +245,8 @@ const AddressDetails = ({
setAddressStateToDisplay('');
}}
disabled={
props.value?.address_state && has_real_account
disabled_items.includes('address_state') ||
(props.value?.address_state && has_real_account)
}
/>
</MobileWrapper>
Expand All @@ -247,7 +259,10 @@ const AddressDetails = ({
name='address_state'
label={localize('State/Province')}
placeholder={localize('State/Province')}
disabled={props.value?.address_state && has_real_account}
disabled={
disabled_items.includes('address_state') ||
(props.value?.address_state && has_real_account)
}
/>
)}
<InputField
Expand All @@ -261,7 +276,10 @@ const AddressDetails = ({
setFieldTouched('address_postcode', true);
handleChange(e);
}}
disabled={props.value?.address_postcode && has_real_account}
disabled={
disabled_items.includes('address_postcode') ||
(props.value?.address_postcode && has_real_account)
}
/>
</div>
</ThemedScrollbars>
Expand Down
Loading

0 comments on commit 67b1c65

Please sign in to comment.