Commit 0ba0bc1
committed
fix(#6250 round-7): anchor Inputs role attribute predicate to full parsed token
PerishCode's round-7 review pointed out that the Inputs group's
role attribute matcher still bypassed the boundary the rest of the
head establishes for other component groups: it matched attribute
values containing 'role=checkbox' text inside unrelated attributes
like [data-label="[role=checkbox]"] and did not reject
:not([role="checkbox"]) properly.
Fix: anchor the regex with ^...\]/i (same pattern that landed on
Buttons and Icons in round-6) so only complete parsed attribute
tokens with a role predicate are admitted to Inputs.
Add regression tests for three cases:
- :not([role="checkbox"]) is not admitted to Inputs
- [data-label="[role=checkbox]"] is not admitted to Inputs
- positive control: [role="checkbox"] still admits to Inputs
Validation:
pnpm exec vitest run packages/contracts/tests/components-manifest-6250-not-and-attribute-opacity.test.ts
-> 14 passed (was 11 before, +3 new)
pnpm exec vitest run (full contracts suite)
-> 298 passed (44 files)
pnpm exec tsc -p tsconfig.json --noEmit
-> clean
Signed-off-by: xxiaoxiong <2482929840@qq.com>1 parent 56bf191 commit 0ba0bc1
2 files changed
Lines changed: 32 additions & 4 deletions
File tree
- packages/contracts
- src/design-systems
- tests
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| |||
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
60 | 63 | | |
61 | 64 | | |
| 65 | + | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| |||
138 | 142 | | |
139 | 143 | | |
140 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
141 | 168 | | |
0 commit comments