Skip to content

Commit 96973c8

Browse files
committed
refactor: remove ambiguous tokens test
1 parent c1feb55 commit 96973c8

File tree

2 files changed

+0
-59
lines changed

2 files changed

+0
-59
lines changed

src/material/core/theming/tests/m3-theme.spec.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -167,20 +167,6 @@ describe('M3 theme', () => {
167167
expectNoWarning(/`filled-caret-color` is deprecated/);
168168
});
169169

170-
it('should allow overriding ambiguous token value without using prefix, but warn', () => {
171-
const css = transpile(`
172-
div {
173-
@include mat.form-field-overrides((caret-color: magenta));
174-
}
175-
`);
176-
177-
expect(css).toContain('--mat-form-field-filled-caret-color: magenta');
178-
expect(css).toContain('--mat-form-field-outlined-caret-color: magenta');
179-
expectWarning(
180-
/Token `caret-color` is deprecated. Please use one of the following alternatives: filled-caret-color, outlined-caret-color/,
181-
);
182-
});
183-
184170
it('should error on invalid token name', () => {
185171
expect(() =>
186172
transpile(`

src/material/core/tokens/_token-utils.scss

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ $_system-fallbacks: m3-system.create-system-fallbacks();
223223
@mixin batch-create-token-values($overrides: (), $namespace-configs...) {
224224
@include sass-utils.current-selector-or-root() {
225225
$prefixed-name-data: ();
226-
$unprefixed-name-data: ();
227226
$all-names: ();
228227

229228
@each $config in $namespace-configs {
@@ -233,29 +232,7 @@ $_system-fallbacks: m3-system.create-system-fallbacks();
233232
@each $name, $value in $tokens {
234233
$prefixed-name: $prefix + $name;
235234
$all-names: list.append($all-names, $prefixed-name, $separator: comma);
236-
@if map.has-key($prefixed-name-data, $prefixed-name) {
237-
@error #{
238-
'Error overriding token: Ambiguous token name `'
239-
}#{
240-
$prefixed-name
241-
}#{
242-
'` exists in multiple namespaces: `('
243-
}#{
244-
list.nth(map.get($prefixed-name-data, $prefixed-name), 1)
245-
}#{
246-
')` and `('
247-
}#{
248-
$namespace
249-
}#{
250-
')`'
251-
};
252-
}
253235
$prefixed-name-data: map.set($prefixed-name-data, $prefixed-name, ($namespace, $name));
254-
$unprefixed-data: map.has-key($unprefixed-name-data, $name) and
255-
map.get($unprefixed-name-data, $name) or
256-
();
257-
$unprefixed-data: list.append($unprefixed-data, ($namespace, $prefixed-name));
258-
$unprefixed-name-data: map.set($unprefixed-name-data, $name, $unprefixed-data);
259236
}
260237
}
261238

@@ -270,28 +247,6 @@ $_system-fallbacks: m3-system.create-system-fallbacks();
270247
$name: $value,
271248
)
272249
);
273-
} @else if (map.has-key($unprefixed-name-data, $name)) {
274-
$datalist: map.get($unprefixed-name-data, $name);
275-
$prefixed-names: ();
276-
@each $data in $datalist {
277-
$namespace: list.nth($data, 1);
278-
$prefixed-names: list.append($prefixed-names, list.nth($data, 2), $separator: comma);
279-
@include create-token-values(
280-
$namespace,
281-
(
282-
$name: $value,
283-
)
284-
);
285-
}
286-
@warn #{
287-
'Token `'
288-
}#{
289-
$name
290-
}#{
291-
'` is deprecated. Please use one of the following alternatives: '
292-
}#{
293-
$prefixed-names
294-
};
295250
} @else {
296251
@error #{'Invalid token name `'}#{$name}#{'`. '}#{'Valid tokens are: '}#{$all-names};
297252
}

0 commit comments

Comments
 (0)