Build a custom switch component to replace antd switch in Cashtab
Because implementing this switch on the Airdrop page required restyling the form, restyle it with non-antd form components.
Differential D15783
[Cashtab] Build custom switch to deprecate antd switch bytesofman on Mar 25 2024, 20:35. Authored by
Details
Build a custom switch component to replace antd switch in Cashtab Because implementing this switch on the Airdrop page required restyling the form, restyle it with non-antd form components. npm test npm start and check appearance of airdrop, configure, screens
Diff Detail
Event TimelineComment Actions Build Bitcoin ABC Diffs / Diff Testing (cashtab-tests) failed.
Failed tests logs: ====== CashTab Unit Tests: <Airdrop /> We can send a pro-rata airdrop and equal tx to a tokenId not in our cache using custom settings ====== Error: expect(element).toHaveAttribute("aria-checked", "false") // element.getAttribute("aria-checked") === "false" Expected the element to have attribute: aria-checked="false" Received: null at Object.toHaveAttribute (/work/cashtab/src/components/Airdrop/__tests__/Airdrop.test.js:150:41) ====== CashTab Unit Tests: <Airdrop /> We can ignore addresses with less than a token balance for a token with decimals ====== Error: expect(element).toHaveAttribute("aria-checked", "false") // element.getAttribute("aria-checked") === "false" Expected the element to have attribute: aria-checked="false" Received: null at Object.toHaveAttribute (/work/cashtab/src/components/Airdrop/__tests__/Airdrop.test.js:274:41) ====== CashTab Unit Tests: <App /> Setting "Send Confirmations" settings will show send confirmations ====== Error: expect(element).toHaveStyle() - Expected - background-color: rgb(189, 189, 189); + background-color: white; at Object.toHaveStyle (/work/cashtab/src/components/__tests__/App.test.js:512:41) ====== CashTab Unit Tests: <App /> Setting "ABSOLUTE MINIMUM fees" settings will reduce fees to absolute min ====== Error: expect(element).toHaveStyle() - Expected - background-color: rgb(189, 189, 189); + background-color: white; at Object.toHaveStyle (/work/cashtab/src/components/__tests__/App.test.js:655:35) ====== CashTab Unit Tests: <App /> Migrating from wallet/savedWallet keys (version < 1.6.0): A user with an invalid Cashtab wallet as the active wallet is migrated on startup ====== Error: expect(element).toHaveTextContent() Expected element to have text content: 9,513.12 XEC Received: 0.00 XEC at Object.toHaveTextContent (/work/cashtab/src/components/__tests__/App.test.js:910:58) at runNextTicks (node:internal/process/task_queues:60:5) at listOnTimeout (node:internal/timers:540:9) at processTimers (node:internal/timers:514:7) ====== CashTab Unit Tests: <App /> Migrating from wallet/savedWallet keys (version < 1.6.0): A user with pre-2.1.0 valid wallets in savedWallets has them all migrated to new storage keys and new shape ====== Error: expect(element).toHaveTextContent() Expected element to have text content: 9,513.12 XEC Received: 0.00 XEC at Object.toHaveTextContent (/work/cashtab/src/components/__tests__/App.test.js:941:58) ====== CashTab Unit Tests: <App /> Cashtab version >= 1.6.0 and < 2.1.0: A user with an invalid Cashtab wallet as the active wallet is migrated on startup ====== Error: expect(element).toHaveTextContent() Expected element to have text content: 9,513.12 XEC Received: 0.00 XEC at Object.toHaveTextContent (/work/cashtab/src/components/__tests__/App.test.js:1030:58) Each failure log is accessible here: Comment Actions Build Bitcoin ABC Diffs / Diff Testing (cashtab-tests) failed.
Failed tests logs: ====== CashTab Unit Tests: <App /> Cashtab version >= 1.6.0 and < 2.1.0: A user with an invalid Cashtab wallet as the active wallet is migrated on startup ====== Error: expect(element).toHaveTextContent() Expected element to have text content: 9,513.12 XEC Received: 0.00 XEC at Object.toHaveTextContent (/work/cashtab/src/components/__tests__/App.test.js:1005:58) at runNextTicks (node:internal/process/task_queues:60:5) at listOnTimeout (node:internal/timers:540:9) at processTimers (node:internal/timers:514:7) Each failure log is accessible here: Comment Actions Build Bitcoin ABC Diffs / Diff Testing (cashtab-tests) failed.
Failed tests logs: ====== CashTab Unit Tests: <Airdrop /> We can send a pro-rata airdrop and equal tx to a tokenId not in our cache using custom settings ====== Error: expect(element).toHaveValue(ecash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035, 555.55 ecash:qr204yfphngxthvnukyrz45u7500tf60vyqspva5a6, 1666.66 ecash:qrq64hyel9hulnl9vsk29xjnuuqlpwqpcv6mk9pqly, 555.55 ecash:qzn3gqf7vvm2qdu2rac6m6r4kgfcsyaras7jfqja3m, 2222.22) Expected the element to have value: ecash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035, 555.55 ecash:qr204yfphngxthvnukyrz45u7500tf60vyqspva5a6, 1666.66 ecash:qrq64hyel9hulnl9vsk29xjnuuqlpwqpcv6mk9pqly, 555.55 ecash:qzn3gqf7vvm2qdu2rac6m6r4kgfcsyaras7jfqja3m, 2222.22 Received: ecash:qzj5zu6fgg8v2we82gh76xnrk9njcreglum9ffspnr, 150 ecash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035, 50 ecash:qr204yfphngxthvnukyrz45u7500tf60vyqspva5a6, 150 ecash:qrq64hyel9hulnl9vsk29xjnuuqlpwqpcv6mk9pqly, 50 ecash:qzn3gqf7vvm2qdu2rac6m6r4kgfcsyaras7jfqja3m, 200 ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj, 4400 at Object.toHaveValue (/work/cashtab/src/components/Airdrop/__tests__/Airdrop.test.js:173:11) ====== CashTab Unit Tests: <Airdrop /> We can ignore addresses with less than a token balance for a token with decimals ====== Error: expect(element).toHaveValue(ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj, 500000) Expected the element to have value: ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj, 500000 Received: ecash:qp6qkpeg5xmpcqtu6uc5qkhzexg4sq009sfeekcfk2, 499905.84 ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj, 94.15 at Object.toHaveValue (/work/cashtab/src/components/Airdrop/__tests__/Airdrop.test.js:293:11) Each failure log is accessible here: Comment Actions fix airdrop formdata state initialized at false, fix airdrop test with spaces in input data csv
Comment Actions Same issue upon startup as D15804, however for reference D15748 loads fine without this issue. Comment Actions This looks related to testing this diff after testing the migration diff. Need to test this in incognito if your localhost:3000 storage has already migrated (or build and deploy to netlify, or test in a different browser). this diff is not expected to reverse migrate in general -- while I think these diffs are good to be reviewed now, I won't be landing them until after D15784 lands Comment Actions Build Bitcoin ABC Diffs / Diff Testing (cashtab-tests) failed.
Failed tests logs: ====== CashTab Unit Tests: <App /> Migrating (version < 2.9.0): A user with an invalid Cashtab wallet as the active wallet is migrated on startup ====== Error: expect(element).toHaveTextContent() Expected element to have text content: 9,513.12 XEC Received: 0.00 XEC at Object.toHaveTextContent (/work/cashtab/src/components/__tests__/App.test.js:1132:58) at runNextTicks (node:internal/process/task_queues:60:5) at listOnTimeout (node:internal/timers:540:9) at processTimers (node:internal/timers:514:7) Each failure log is accessible here: Comment Actions The switches on the airdrop screen are too large relative to the rest of the UI, should resize to match the ones on config Comment Actions eh I kind of like them. they are major form elements in Airdrop, and there are a lot of them. I think the larger size makes them less ambiguous and easier to work with for mobile users. Might bump the size in Config as well. imo the small switches are tough to hit on mobile. may also want to consider more spacing between the switches. but, imo not strictly related to this diff. |