Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add data-test to modal and data elements (DHIS2-13871) #1455

Merged
merged 3 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ const CalculationModal = ({
</ModalActions>
</Modal>
{showDeletePrompt && (
<Modal small>
<Modal small dataTest="calculation-delete-modal">
<ModalTitle>{i18n.t('Delete calculation')}</ModalTitle>
<ModalContent>
{i18n.t(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ const DataElementOption = ({ label, value, onDoubleClick }) => {
ref={setNodeRef}
style={style}
>
<div className="chip" onDoubleClick={() => onDoubleClick(data)}>
<div
className="chip"
onDoubleClick={() => onDoubleClick(data)}
data-test="data-element-option"
>
<span className="icon">
{getIcon(DIMENSION_TYPE_DATA_ELEMENT)}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const GroupSelector = ({ currentValue, onChange, displayNameProp }) => {
value={defaultGroup.id}
key={defaultGroup.id}
label={defaultGroup.getName()}
dataTest={`data-element-group-select-option-${defaultGroup.id}`}
/>
) : null}
{!loading
Expand All @@ -77,6 +78,7 @@ const GroupSelector = ({ currentValue, onChange, displayNameProp }) => {
value={group.id}
key={group.id}
label={group.name}
dataTest={`data-element-group-select-option-${group.id}`}
/>
))
: null}
Expand Down Expand Up @@ -107,6 +109,7 @@ const DisaggregationSelector = ({ currentValue, onChange }) => {
value={option[0]}
key={option[0]}
label={option[1]}
dataTest={`data-element-disaggregation-select-option-${option[0]}`}
/>
))}
</SingleSelectField>
Expand Down
4 changes: 2 additions & 2 deletions src/components/DataDimension/Calculation/FormulaField.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const LAST_DROPZONE_ID = 'lastdropzone'
export const FORMULA_BOX_ID = 'formulabox'

const Placeholder = () => (
<div className="placeholder" data-test={'placeholder'}>
<div className="placeholder" data-test="placeholder">
<FormulaIcon />
<span className="help-text">
{i18n.t(
Expand Down Expand Up @@ -47,7 +47,7 @@ const FormulaField = ({
<div
className="formula-field"
ref={setLastDropzoneRef}
data-test={'formula-field'}
data-test="formula-field"
>
{loading && (
<Center>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const MathOperatorSelector = ({ onDoubleClick }) => (
<>
<div className="wrapper">
<h4 className="sub-header">{i18n.t('Math operators')}</h4>
<div className="operators">
<div className="operators" data-test="operators-list">
{getOperators().map(({ label, value, type }, index) => (
<DraggableOperator
key={`${label}-${index}`}
Expand Down
2 changes: 1 addition & 1 deletion src/components/LegendKey/LegendKey.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import styles from './styles/LegendKey.style.js'

const LegendKey = ({ legendSets }) => {
return legendSets.length ? (
<div className="container" data-test={'legend-key-container'}>
<div className="container" data-test="legend-key-container">
{legendSets.map((legendSet, index) => (
<div
key={legendSet.id}
Expand Down