Skip to content

Commit

Permalink
Add data-testid to the elements missing it on Preferece pages
Browse files Browse the repository at this point in the history
  • Loading branch information
jsolovjo committed Jan 20, 2025
1 parent 28569cd commit 293308e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 7 additions & 4 deletions packages/hawtio/src/plugins/connect/ConnectPreferences.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ const JolokiaForm: React.FunctionComponent = () => {
/>
</FormGroup>
<FormGroup fieldId='jolokia-form-apply'>
<Button onClick={applyJolokia}>Apply</Button>
<Button data-testid='apply-jolokia' onClick={applyJolokia}>
Apply
</Button>
<FormHelperText>
<HelperText>
<HelperTextItem>Restart Hawtio with the new values in effect.</HelperTextItem>
Expand Down Expand Up @@ -215,16 +217,17 @@ const ResetForm: React.FunctionComponent = () => {

const ConfirmClearModal = () => (
<Modal
data-testid='clear-connections-modal'
variant={ModalVariant.small}
title='Clear saved connections'
titleIconVariant='danger'
isOpen={isConfirmModalOpen}
onClose={confirmClear}
actions={[
<Button key='reset' variant='danger' onClick={clear}>
<Button key='reset' data-testid='clear-btn' variant='danger' onClick={clear}>
Clear
</Button>,
<Button key='cancel' variant='link' onClick={confirmClear}>
<Button key='cancel' data-testid='cancel-btn' variant='link' onClick={confirmClear}>
Cancel
</Button>,
]}
Expand All @@ -236,7 +239,7 @@ const ResetForm: React.FunctionComponent = () => {
return (
<FormSection title='Reset' titleElement='h2'>
<FormGroup label='Clear saved connections' fieldId='reset-form-clear'>
<Button variant='danger' onClick={confirmClear}>
<Button data-testid='clear-btn' variant='danger' onClick={confirmClear}>
Clear
</Button>
<ConfirmClearModal />
Expand Down
8 changes: 5 additions & 3 deletions packages/hawtio/src/preferences/HomePreferences.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const UIForm: React.FunctionComponent = () => {
return (
<FormGroup label='Default vertical nav state' fieldId='ui-form-vertical-nav-switch'>
<Switch
data-testid='switch-vertical-nav-state'
label='Show vertical navigation'
labelOff='Hide vertical navigation'
isChecked={showVerticalNav}
Expand All @@ -65,16 +66,17 @@ const ResetForm: React.FunctionComponent = () => {

const ConfirmResetModal = () => (
<Modal
data-testid='reset-settings-modal'
variant={ModalVariant.small}
title='Reset settings'
titleIconVariant='danger'
isOpen={isConfirmResetOpen}
onClose={confirmReset}
actions={[
<Button key='reset' variant='danger' onClick={reset}>
<Button key='reset' data-testid='reset-btn' variant='danger' onClick={reset}>
Reset
</Button>,
<Button key='cancel' variant='link' onClick={confirmReset}>
<Button key='cancel' data-testid='cancel-btn' variant='link' onClick={confirmReset}>
Cancel
</Button>,
]}
Expand All @@ -88,7 +90,7 @@ const ResetForm: React.FunctionComponent = () => {
return (
<React.Fragment>
<FormGroup label='Reset settings' fieldId='reset-form-reset'>
<Button variant='danger' onClick={confirmReset}>
<Button data-testid='reset-btn' variant='danger' onClick={confirmReset}>
Reset
</Button>
<FormHelperText>
Expand Down

0 comments on commit 293308e

Please sign in to comment.