Skip to content

Commit 572089f

Browse files
committed
feat(theming): rename token registry implementations
1 parent eb48c5d commit 572089f

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

packages/theming-material/src/scheme/scheme.builder.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Hct, SchemeVibrant } from '@material/material-color-utilities';
66
import { withThemeBuilder } from 'packages/theming/src/builder-composition';
77

88
import { provide } from '../../../core/src/provide';
9-
import { TestingThemeTokenRegistry } from '../../../theming/src/token';
9+
import { InMemoryThemeTokenRegistry } from '../../../theming/src/token';
1010
import {
1111
SchemeBuilder,
1212
SchemeContrastLevel,
@@ -25,14 +25,14 @@ describe('SchemeBuilder', () => {
2525
contrast: SchemeContrastLevel.Standard,
2626
}),
2727
),
28-
TestingThemeTokenRegistry,
28+
InMemoryThemeTokenRegistry,
2929
provide({
3030
token: ThemeTokenRegistry,
31-
useExisting: TestingThemeTokenRegistry,
31+
useExisting: InMemoryThemeTokenRegistry,
3232
}),
3333
],
3434
});
35-
const tokens = TestBed.inject(TestingThemeTokenRegistry).tokens;
35+
const tokens = TestBed.inject(InMemoryThemeTokenRegistry).tokens;
3636
expect(tokens['scheme-primary']).toBeDefined();
3737
expect(tokens['scheme-on-primary']).toBe('#ffffff');
3838
});

packages/theming/src/token.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface ThemeTokens {
2020
*/
2121
@Injectable({
2222
providedIn: 'root',
23-
useClass: forwardRef(() => RootElementStylePropertiesThemeTokenRegistry),
23+
useClass: forwardRef(() => RootCssVariableThemeTokenRegistry),
2424
})
2525
export abstract class ThemeTokenRegistry {
2626
/**
@@ -54,9 +54,7 @@ export class ThemeTokenNotFoundException extends Exception {
5454
* @remarks Token names can be optionally prefixed with `--`, e.g. `--primary`.
5555
*/
5656
@Injectable()
57-
export class RootElementStylePropertiesThemeTokenRegistry
58-
implements ThemeTokenRegistry
59-
{
57+
export class RootCssVariableThemeTokenRegistry implements ThemeTokenRegistry {
6058
protected document = inject(DOCUMENT);
6159
protected element = this.document.documentElement;
6260
protected styles?: CSSStyleDeclaration;
@@ -91,10 +89,10 @@ export class RootElementStylePropertiesThemeTokenRegistry
9189
}
9290

9391
/**
94-
* Implementation of `ThemeTokenRegistry` that is intended for testing purposes.
92+
* Implementation of `ThemeTokenRegistry` that stores theme tokens in memory.
9593
*/
9694
@Injectable()
97-
export class TestingThemeTokenRegistry implements ThemeTokenRegistry {
95+
export class InMemoryThemeTokenRegistry implements ThemeTokenRegistry {
9896
/**
9997
* In-memory storage of theme tokens.
10098
*/

0 commit comments

Comments
 (0)