Skip to content

Commit dd9b607

Browse files
authored
feat(data-component-name)!: deprecate data-component-name and replace with data-testid
Closes #1598. Part of #626 — Major release plan 17.0.0. ## Changes - Removes the deprecated `data-component-name` attribute from `getPrefixedDataAttributes`, which now emits only `data-testid`. This covers every component that renders test attributes through the shared utility. - Replaces the three hardcoded `data-component-name` attributes with `data-testid`: `BurgerMenuIcon` and `NavigationBarActionGroup` in `navigation-bar.tsx`, and `Dialog` in `dialog.tsx`. - Drops the redundant `data-component-name` on `FixedFooter`, which already carried a matching `data-testid`. ## Tests - No test queried by `data-component-name`; the dedicated `testid-test.tsx` and all other selectors already use `data-testid`, so no test changes were required. - Verified locally: `testid-test` (15 passed), `dialog-test` (16 passed), and `main-navigation-bar-test` (2 passed). ## Stack position — 5 of 10 This PR targets the branch from #1617 and can only be merged after #1617 lands on `master`. GitHub will retarget it to `master` automatically as the parent merges. For the full merge strategy and ordering, see #626. **Do not merge out of order.** --------- Co-authored-by: brtbrt <brtbrt@users.noreply.github.com>
1 parent 7822d16 commit dd9b607

98 files changed

Lines changed: 216 additions & 194 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ coverage/
55
.directory
66
.DS_Store
77
.idea/
8+
mistica-web.iml
89
*.js.map
910
*.orig
1011
*.rej
@@ -32,3 +33,4 @@ community.d.ts
3233
.scannerwork
3334
*storybook.log
3435
.env*.local
36+

doc/fonts.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ default serif font (Times New Roman on desktop). You must declare `@font-face` r
88

99
Each skin has a designated font family. Use the correct one for the skin your app is using:
1010

11-
| Skin | Getter function | Font family |
12-
| --------------------- | ------------------------ | ------------------- |
13-
| `movistar` _(legacy)_ | `getMovistarSkin()` | `'On Air'` |
14-
| `o2` | `getO2Skin()` | `'On Air'` |
15-
| `vivo` | `getVivoSkin()` | `'Vivo Type'` |
16-
| `vivo-evolution` | `getVivoEvolutionSkin()` | `'Vivo Type'` |
17-
| `telefonica` | `getTelefonicaSkin()` | `'Telefonica Sans'` |
18-
| `blau` | `getBlauSkin()` | `'Roboto'` |
19-
| `esimflag` | `getEsimflagSkin()` | `'On Air'` |
11+
| Skin | Getter function | Font family |
12+
| ---------------- | ------------------------ | ------------------- |
13+
| `movistar` | `getMovistarSkin()` | `'Movistar Sans'` |
14+
| `o2` | `getO2Skin()` | `'On Air'` |
15+
| `vivo` | `getVivoSkin()` | `'Vivo Type'` |
16+
| `vivo-evolution` | `getVivoEvolutionSkin()` | `'Vivo Type'` |
17+
| `telefonica` | `getTelefonicaSkin()` | `'Telefonica Sans'` |
18+
| `blau` | `getBlauSkin()` | `'Roboto'` |
19+
| `esimflag` | `getEsimflagSkin()` | `'On Air'` |
2020

2121
## Setting font-family
2222

doc/llms/agents/figma-verifier.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ rules before starting.
3737
`font-family`, composite props that don't match the non-CodeConnect DOM, spacing values absent from the
3838
DOM, mismatched semantic structure (`Stack` vs `Inline`, flat vs nested), native HTML where a Mistica
3939
primitive exists, wrong/missing skin/font/body-background for the file's brand.
40-
- **Layout primitives.** When the DOM shows `grid grid-cols-[repeat(12,…)]` with `col-[…/span_N]`
41-
children, flag any implementation that used a raw `<div style={{display:'grid'}}>`, a fixed-width flex
42-
row, `Grid`, or manual spacer columns instead of a `GridLayout` whose `template` matches the child
43-
spans. Flag a `GridLayout` that is not wrapped in a `ResponsiveLayout`, and a full-width padded section
40+
- **Layout primitives.** When the DOM shows `grid grid-cols-[repeat(12,…)]` with `col-[…/span_N]` children,
41+
flag any implementation that used a raw `<div style={{display:'grid'}}>`, a fixed-width flex row, `Grid`,
42+
or manual spacer columns instead of a `GridLayout` whose `template` matches the child spans. Flag a
43+
`GridLayout` that is not wrapped in a `ResponsiveLayout`, and a full-width padded section
4444
(`px-[48/32/16px]`) implemented without a `ResponsiveLayout`. Conversely, flag double-wrapping a
4545
component that embeds its own `ResponsiveLayout` (`MainNavigationBar`, `NavigationBar`, `Tabs`).
4646

packages/generate-design-tokens/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ console.log('Using design tokens from:', DESIGN_TOKENS_FOLDER);
2525
const SKINS_FOLDER = path.join(import.meta.dirname, '..', '..', 'src', 'skins');
2626
const CSS_FOLDER = path.join(import.meta.dirname, '..', '..', 'css');
2727

28-
const KNOWN_SKINS = ['blau', 'movistar', 'o2', 'o2-new', 'telefonica', 'vivo', 'vivo-new', 'tu', 'esimflag'];
28+
const KNOWN_SKINS = ['blau', 'movistar', 'o2', 'telefonica', 'vivo', 'vivo-evolution', 'esimflag'];
2929

3030
const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
3131
const toCamelCase = (str) => str.replace(/-([a-z])/g, (g) => g[1].toUpperCase());
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type {DataAttributes} from '../utils/types';
2+
3+
const validAttrs: DataAttributes = {
4+
testid: 'MyComponent',
5+
custom: 'value',
6+
count: 42,
7+
enabled: true,
8+
// eslint-disable-next-line object-shorthand
9+
undefined: undefined,
10+
};
11+
12+
// component-name is allowed
13+
const validAttrsWithComponentName: DataAttributes = {
14+
'component-name': 'MyComponent',
15+
testid: 'MyComponent',
16+
};

src/accordion.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ export const AccordionItem = React.forwardRef<TouchableElement, AccordionItemCon
248248
<AccordionItemContent
249249
{...props}
250250
ref={ref}
251-
dataAttributes={{'component-name': 'AccordionItem', ...dataAttributes}}
251+
dataAttributes={{testid: 'AccordionItem', ...dataAttributes}}
252252
/>
253253
</div>
254254
)
@@ -297,7 +297,7 @@ export const Accordion = ({
297297
<AccordionContext.Provider value={{index: indexList, toggle}}>
298298
<div
299299
role={role}
300-
{...getPrefixedDataAttributes({...dataAttributes, accordion: true}, 'Accordion')}
300+
{...getPrefixedDataAttributes({testid: 'Accordion', ...dataAttributes, accordion: true})}
301301
>
302302
{childrenContent.map((child, index) => (
303303
<React.Fragment key={index}>
@@ -329,7 +329,7 @@ export const BoxedAccordionItem = React.forwardRef<HTMLDivElement, BoxedAccordio
329329
className={styles.boxed}
330330
variant={variant ?? (isInverse ? 'brand' : 'default')}
331331
ref={ref}
332-
dataAttributes={{'component-name': 'BoxedAccordionItem', ...dataAttributes}}
332+
dataAttributes={{testid: 'BoxedAccordionItem', ...dataAttributes}}
333333
>
334334
<AccordionItemContent {...props} />
335335
</InternalBoxed>
@@ -357,7 +357,7 @@ export const BoxedAccordion = ({
357357
<Stack
358358
space={16}
359359
role={role}
360-
dataAttributes={{'component-name': 'BoxedAccordion', accordion: true, ...dataAttributes}}
360+
dataAttributes={{testid: 'BoxedAccordion', accordion: true, ...dataAttributes}}
361361
>
362362
{children}
363363
</Stack>

src/align.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type Props = {
1616
const Align = ({x = 'start', y = 'start', width, height, children, dataAttributes}: Props): JSX.Element => {
1717
return (
1818
<div
19-
{...getPrefixedDataAttributes(dataAttributes, 'Align')}
19+
{...getPrefixedDataAttributes({testid: 'Align', ...dataAttributes})}
2020
className={styles.container}
2121
style={{
2222
placeItems: `${y} ${x}`,

src/avatar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const Avatar = ({
9898
boxSizing: 'border-box',
9999
border,
100100
}}
101-
{...getPrefixedDataAttributes(dataAttributes, 'Avatar')}
101+
{...getPrefixedDataAttributes({testid: 'Avatar', ...dataAttributes})}
102102
>
103103
{shouldRenderImage ? (
104104
<img

src/badge.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ const Badge = ({children, value, right, top, dataAttributes}: Props): JSX.Elemen
4242
themeVariant === 'brand' || themeVariant === 'negative' || themeVariant === 'media' || !!children;
4343

4444
return (
45-
<div className={classes.container} {...getPrefixedDataAttributes(dataAttributes, 'Badge')}>
45+
<div
46+
className={classes.container}
47+
{...getPrefixedDataAttributes({testid: 'Badge', ...dataAttributes})}
48+
>
4649
{children}
4750
{value ? (
4851
<div

src/button-group.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const ButtonGroup = ({
6262
[styles.centerInMobile]: alignByBreakpoint.mobile === 'center',
6363
}
6464
)}
65-
{...getPrefixedDataAttributes(dataAttributes, 'ButtonGroup')}
65+
{...getPrefixedDataAttributes({testid: 'ButtonGroup', ...dataAttributes})}
6666
>
6767
{(primaryButton || secondaryButton) && (
6868
<div

0 commit comments

Comments
 (0)