Skip to content

Commit b954f00

Browse files
[DDW-880] Forward data attributes to input field components (#2841)
Co-authored-by: Daniel Main <[email protected]>
1 parent 49fd654 commit b954f00

File tree

4 files changed

+24
-17
lines changed

4 files changed

+24
-17
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@
248248
"react-intl": "2.7.2",
249249
"react-lottie": "1.2.3",
250250
"react-markdown": "4.3.1",
251-
"react-polymorph": "1.0.1",
251+
"react-polymorph": "1.0.2",
252252
"react-router": "5.2.0",
253253
"react-router-dom": "5.2.0",
254254
"react-svg-inline": "2.1.1",

source/renderer/app/components/wallet/WalletSendForm.spec.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,11 @@ describe('wallet/Wallet Send Form', () => {
108108
}
109109

110110
function getInput(label: string) {
111-
return screen
112-
.getByText(label)
113-
.closest('label')
114-
.parentElement.querySelector('input');
111+
return screen.getByLabelText(label);
115112
}
116113

117114
async function findInput(label: string) {
118-
await screen.findByText(label);
119-
return getInput(label);
115+
return screen.findByLabelText(label);
120116
}
121117

122118
async function addToken(value = 1, tokenIndex = 0) {
@@ -129,7 +125,10 @@ describe('wallet/Wallet Send Form', () => {
129125
fireEvent.click(tokenCheckbox);
130126
const addTokenPickerButton = await screen.findByText('Add');
131127
fireEvent.click(addTokenPickerButton);
132-
const token = await findInput(assets[tokenIndex].metadata.name);
128+
129+
const { uniqueId } = assets[tokenIndex];
130+
131+
const token = await screen.findByTestId(`assetInput:${uniqueId}`);
133132
fireEvent.change(token, {
134133
target: {
135134
value,
@@ -138,7 +137,7 @@ describe('wallet/Wallet Send Form', () => {
138137
return async () => {
139138
fireEvent.mouseEnter(token);
140139
const removeTokenButton = await screen.findByTestId(
141-
`remove-asset-${assets[tokenIndex].uniqueId}`
140+
`removeAsset:${uniqueId}`
142141
);
143142
fireEvent.click(removeTokenButton);
144143
};

source/renderer/app/components/wallet/send-form/AssetInput.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ class AssetInput extends Component<Props> {
121121
small
122122
/>
123123
}
124+
data-testid={`assetInput:${uniqueId}`}
124125
bigNumberFormat={decimals ? currentNumberFormat : null}
125126
decimalPlaces={decimals}
126127
numberLocaleOptions={{
@@ -182,7 +183,7 @@ class AssetInput extends Component<Props> {
182183
<span
183184
className={classNames([styles.removeAssetButton, 'flat'])}
184185
onClick={() => removeAssetRow(uniqueId)}
185-
data-testid={`remove-asset-${uniqueId}`}
186+
data-testid={`removeAsset:${uniqueId}`}
186187
>
187188
<SVGInline svg={removeIcon} className={styles.removeIcon} />
188189
</span>

yarn.lock

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8315,9 +8315,11 @@ fill-range@^4.0.0:
83158315
repeat-string "^1.6.1"
83168316
to-regex-range "^2.1.0"
83178317

8318-
8319-
version "0.0.2"
8320-
resolved "https://registry.yarnpkg.com/filter-react-dom-props/-/filter-react-dom-props-0.0.2.tgz#d5c1e5a89c13534cebe3930a22afa9ae3238813b"
8318+
8319+
version "2.1.0"
8320+
resolved "https://registry.yarnpkg.com/filter-invalid-dom-props/-/filter-invalid-dom-props-2.1.0.tgz#7690bb72e9213a09e8429c07f3aea21468f43ee5"
8321+
dependencies:
8322+
html-attributes "1.1.0"
83218323

83228324
finalhandler@~1.1.2:
83238325
version "1.1.2"
@@ -9406,6 +9408,10 @@ hosted-git-info@^2.1.4:
94069408
version "2.8.8"
94079409
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.8.tgz#7539bd4bc1e0e0a895815a2e0262420b12858488"
94089410

9411+
9412+
version "1.1.0"
9413+
resolved "https://registry.yarnpkg.com/html-attributes/-/html-attributes-1.1.0.tgz#82027a4fac7a6070ea6c18cc3886aea18d6dea09"
9414+
94099415
html-encoding-sniffer@^2.0.1:
94109416
version "2.0.1"
94119417
resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz#42a6dc4fd33f00281176e8b23759ca4e4fa185f3"
@@ -14139,14 +14145,15 @@ [email protected]:
1413914145
prop-types "^15.5.10"
1414014146
warning "^3.0.0"
1414114147

14142-
14143-
version "1.0.1"
14144-
resolved "https://registry.yarnpkg.com/react-polymorph/-/react-polymorph-1.0.1.tgz#94e664e173b3b4a32c13953291e92fa34a05c8a7"
14148+
14149+
version "1.0.2"
14150+
resolved "https://registry.yarnpkg.com/react-polymorph/-/react-polymorph-1.0.2.tgz#c4a36e32744fa7c2c0cfbf78aff02382cece3017"
1414514151
dependencies:
1414614152
"@tippyjs/react" "4.2.1"
1414714153
create-react-context "0.2.2"
1414814154
fast-password-entropy "1.1.1"
14149-
filter-react-dom-props "0.0.2"
14155+
filter-invalid-dom-props "2.1.0"
14156+
html-attributes "1.1.0"
1415014157
popper.js "1.16.1"
1415114158
react-modal "3.1.12"
1415214159
react-scrollbars-custom "4.0.21"

0 commit comments

Comments
 (0)