Commit 57308b4
authored
test: color-no-hex mobile-core-ux batch (MetaMask#27152)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
Split from MetaMask#26651 to reduce CODEOWNERS fanout.
Batch: mobile-core-ux
Source branch: `origin/remove-static-hex-from-tests`
This batch removes brittle hardcoded hex theme values from
mobile-core-ux-owned tests and replaces them with `mockTheme` so the
tests follow the same token values as the components under test. It also
expands the `color-no-hex` ESLint rollout in `.eslintrc.js` to the
mobile-core-ux component and view folders from `CODEOWNERS`, so future
violations are caught at the team ownership boundary instead of only in
the few files touched by this PR.
The concrete updates are:
- `TransactionsFooter.test.tsx` and `AccountsMenu.test.tsx` now mock
`useTheme` from `jest.requireActual(...).mockTheme` instead of
hand-rolled hex values.
- `Transactions/index.test.tsx` now uses `mockTheme.colors` and
`mockTheme.typography` for the direct render-context tests, including
the remaining `CancelSpeedupModal` case.
- `.eslintrc.js` now enables `@metamask/design-tokens/color-no-hex` for
the relevant mobile-core-ux component/view CODEOWNERS folders such as
`Transactions`, `AccountsMenu`, and related mobile-core-ux UI surfaces.
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: null
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: color-no-hex lint compliance for mobile-core-ux tests
Scenario: developer validates the mobile-core-ux batch
Given the mobile-core-ux test files use theme-backed values instead of hardcoded hex literals
When the developer runs the targeted lint and unit test commands
Then no color-no-hex violations are reported for the updated scope
And the updated Transactions and AccountsMenu test suites pass
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
N/A
### **After**
N/A
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- Generated with the help of the pr-description AI skill -->
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Low risk: changes are limited to ESLint override scope and test-only
theme mocking, with no production logic changes. Main risk is unexpected
new lint failures in the newly enforced folders.
>
> **Overview**
> Expands the `.eslintrc.js` rollout of
`@metamask/design-tokens/color-no-hex` by enabling it (as `error`) for
additional mobile-core-ux-owned UI/view directories, so new static hex
colors are caught at lint time.
>
> Updates `TransactionsFooter.test.tsx`, `Transactions/index.test.tsx`,
and `AccountsMenu.test.tsx` to stop hardcoding hex theme values and
instead source colors/typography from `mockTheme` (and mock `useTheme`
accordingly), making tests consistent with design token values.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
bb033cb. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 9564fd6 commit 57308b4
4 files changed
Lines changed: 53 additions & 69 deletions
File tree
- app/components
- UI/Transactions
- Views/AccountsMenu
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
| 184 | + | |
189 | 185 | | |
| 186 | + | |
190 | 187 | | |
| 188 | + | |
191 | 189 | | |
| 190 | + | |
192 | 191 | | |
| 192 | + | |
193 | 193 | | |
| 194 | + | |
194 | 195 | | |
| 196 | + | |
195 | 197 | | |
196 | 198 | | |
197 | | - | |
| 199 | + | |
198 | 200 | | |
199 | 201 | | |
200 | 202 | | |
| |||
220 | 222 | | |
221 | 223 | | |
222 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
223 | 245 | | |
224 | 246 | | |
225 | 247 | | |
| |||
Lines changed: 6 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
22 | 13 | | |
23 | 14 | | |
24 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
1954 | 1955 | | |
1955 | 1956 | | |
1956 | 1957 | | |
1957 | | - | |
1958 | | - | |
1959 | | - | |
1960 | | - | |
1961 | | - | |
| 1958 | + | |
| 1959 | + | |
1962 | 1960 | | |
1963 | 1961 | | |
1964 | 1962 | | |
| |||
1967 | 1965 | | |
1968 | 1966 | | |
1969 | 1967 | | |
1970 | | - | |
1971 | | - | |
1972 | | - | |
1973 | | - | |
1974 | | - | |
| 1968 | + | |
| 1969 | + | |
1975 | 1970 | | |
1976 | 1971 | | |
1977 | 1972 | | |
| |||
2002 | 1997 | | |
2003 | 1998 | | |
2004 | 1999 | | |
2005 | | - | |
2006 | | - | |
2007 | | - | |
2008 | | - | |
2009 | | - | |
2010 | | - | |
2011 | | - | |
| 2000 | + | |
| 2001 | + | |
2012 | 2002 | | |
2013 | 2003 | | |
2014 | 2004 | | |
| |||
2033 | 2023 | | |
2034 | 2024 | | |
2035 | 2025 | | |
2036 | | - | |
2037 | | - | |
2038 | | - | |
2039 | | - | |
2040 | | - | |
2041 | | - | |
2042 | | - | |
| 2026 | + | |
| 2027 | + | |
2043 | 2028 | | |
2044 | 2029 | | |
2045 | 2030 | | |
| |||
2083 | 2068 | | |
2084 | 2069 | | |
2085 | 2070 | | |
2086 | | - | |
2087 | | - | |
2088 | | - | |
2089 | | - | |
2090 | | - | |
| 2071 | + | |
| 2072 | + | |
2091 | 2073 | | |
2092 | 2074 | | |
2093 | 2075 | | |
| |||
2209 | 2191 | | |
2210 | 2192 | | |
2211 | 2193 | | |
2212 | | - | |
2213 | | - | |
2214 | | - | |
2215 | | - | |
2216 | | - | |
| 2194 | + | |
| 2195 | + | |
2217 | 2196 | | |
2218 | 2197 | | |
2219 | 2198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
47 | 39 | | |
48 | 40 | | |
49 | 41 | | |
| |||
0 commit comments