Page MenuHomePhabricator

[Cashtab] Format XEC on send form
ClosedPublic

Authored by kieran709 on Jan 6 2022, 17:56.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Commits
rABC91273a0907ce: [Cashtab] Format XEC on send form
Summary

To avoid confusion, as the user inputs an amount into the send form, they are shown the value formatted to their locale in the space beneath the input area.

Test Plan

cd web/cashtab && npm start
navigate to send tab
input an amount with more tha 3 digits
ensure formatting is taking place
in browser settings, change preferred language
navigate to send tab
input an amount that is more than 3 digits
ensure formatting meets the requirements for your selected locale

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Failed tests logs:

====== CashTab Unit Tests:  Wallet without BCH balance ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet without BCH balance 1`

- Snapshot  - 0
+ Received  + 7

@@ -319,10 +319,17 @@
                  </div>
                </div>
              </div>
            </div>
          </div>
+         <h3
+           className="sc-iAyFgw irwSQk"
+         >
+           0
+            
+           XEC
+         </h3>
          <div
            className="sc-jKJlTe hccxef"
          >
            =
             
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:54:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Wallet with BCH balances ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances 1`

- Snapshot  - 0
+ Received  + 7

@@ -319,10 +319,17 @@
                  </div>
                </div>
              </div>
            </div>
          </div>
+         <h3
+           className="sc-iAyFgw irwSQk"
+         >
+           0
+            
+           XEC
+         </h3>
          <div
            className="sc-jKJlTe hccxef"
          >
            =
             
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:68:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Wallet with BCH balances and tokens ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens 1`

- Snapshot  - 0
+ Received  + 7

@@ -319,10 +319,17 @@
                  </div>
                </div>
              </div>
            </div>
          </div>
+         <h3
+           className="sc-iAyFgw irwSQk"
+         >
+           0
+            
+           XEC
+         </h3>
          <div
            className="sc-jKJlTe hccxef"
          >
            =
             
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:82:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Wallet with BCH balances and tokens and state field ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens and state field 1`

- Snapshot  - 0
+ Received  + 7

@@ -326,10 +326,17 @@
                  </div>
                </div>
              </div>
            </div>
          </div>
+         <h3
+           className="sc-iAyFgw irwSQk"
+         >
+           0
+            
+           XEC
+         </h3>
          <div
            className="sc-jKJlTe hccxef"
          >
            =
             
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:96:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Without wallet defined ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Without wallet defined 1`

- Snapshot  - 0
+ Received  + 7

@@ -319,10 +319,17 @@
                  </div>
                </div>
              </div>
            </div>
          </div>
+         <h3
+           className="sc-iAyFgw irwSQk"
+         >
+           0
+            
+           XEC
+         </h3>
          <div
            className="sc-jKJlTe hccxef"
          >
            =
             
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:114:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)

Each failure log is accessible here:
CashTab Unit Tests: Wallet without BCH balance
CashTab Unit Tests: Wallet with BCH balances
CashTab Unit Tests: Wallet with BCH balances and tokens
CashTab Unit Tests: Wallet with BCH balances and tokens and state field
CashTab Unit Tests: Without wallet defined

bytesofman requested changes to this revision.Jan 6 2022, 19:41

image.png (190×457 px, 7 KB)

Pass userLocale to the formatFiatBalance function as well to prevent them from being rendered in different locales.

web/cashtab/src/components/Send/Send.js
80 ↗(On Diff #31672)

This should pull from the master theme object in assets/styles/theme.js

This revision now requires changes to proceed.Jan 6 2022, 19:41

Added optional userLocale to formatFiatbalance functions throughout, and used styling from master theme.

Failed tests logs:

====== CashTab Unit Tests:  Wallet without BCH balance ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet without BCH balance 1`

- Snapshot  - 1
+ Received  + 1

@@ -320,11 +320,11 @@
                </div>
              </div>
            </div>
          </div>
          <h3
-           className="sc-iAyFgw irwSQk"
+           className="sc-iAyFgw bGmpty"
          >
            0
             
            XEC
          </h3>
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:54:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Wallet with BCH balances ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances 1`

- Snapshot  - 1
+ Received  + 1

@@ -320,11 +320,11 @@
                </div>
              </div>
            </div>
          </div>
          <h3
-           className="sc-iAyFgw irwSQk"
+           className="sc-iAyFgw bGmpty"
          >
            0
             
            XEC
          </h3>
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:68:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Wallet with BCH balances and tokens ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens 1`

- Snapshot  - 1
+ Received  + 1

@@ -320,11 +320,11 @@
                </div>
              </div>
            </div>
          </div>
          <h3
-           className="sc-iAyFgw irwSQk"
+           className="sc-iAyFgw bGmpty"
          >
            0
             
            XEC
          </h3>
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:82:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Wallet with BCH balances and tokens and state field ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens and state field 1`

- Snapshot  - 1
+ Received  + 1

@@ -327,11 +327,11 @@
                </div>
              </div>
            </div>
          </div>
          <h3
-           className="sc-iAyFgw irwSQk"
+           className="sc-iAyFgw bGmpty"
          >
            0
             
            XEC
          </h3>
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:96:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Without wallet defined ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Without wallet defined 1`

- Snapshot  - 1
+ Received  + 1

@@ -320,11 +320,11 @@
                </div>
              </div>
            </div>
          </div>
          <h3
-           className="sc-iAyFgw irwSQk"
+           className="sc-iAyFgw bGmpty"
          >
            0
             
            XEC
          </h3>
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:114:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)

Each failure log is accessible here:
CashTab Unit Tests: Wallet without BCH balance
CashTab Unit Tests: Wallet with BCH balances
CashTab Unit Tests: Wallet with BCH balances and tokens
CashTab Unit Tests: Wallet with BCH balances and tokens and state field
CashTab Unit Tests: Without wallet defined

This revision is now accepted and ready to land.Jan 10 2022, 22:28
This revision was automatically updated to reflect the committed changes.