feat(theme): apply Material 3 component system
This commit is contained in:
42
src/features/theme/services/MaterialYouThemeOptions.test.ts
Normal file
42
src/features/theme/services/MaterialYouThemeOptions.test.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) Contributors to the Suwayomi project
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import assert from 'node:assert/strict';
|
||||
import { describe, it } from 'node:test';
|
||||
import { createMaterialYouScheme } from '@/features/theme/services/MaterialYouPalette.ts';
|
||||
import {
|
||||
createMaterialYouThemeOptions,
|
||||
MATERIAL_YOU_MOTION,
|
||||
} from '@/features/theme/services/MaterialYouThemeOptions.ts';
|
||||
|
||||
describe('createMaterialYouThemeOptions', () => {
|
||||
const options = createMaterialYouThemeOptions(createMaterialYouScheme('#5B74EF', 'dark')) as any;
|
||||
|
||||
it('uses Material 3 geometry and readable button labels', () => {
|
||||
assert.equal(options.shape.borderRadius, 20);
|
||||
assert.equal(options.components.MuiCard.styleOverrides.root.borderRadius, 20);
|
||||
assert.equal(options.components.MuiDialog.styleOverrides.paper.borderRadius, 28);
|
||||
assert.equal(options.components.MuiButton.styleOverrides.root.borderRadius, 999);
|
||||
assert.equal(options.components.MuiButton.styleOverrides.root.textTransform, 'none');
|
||||
assert.equal(options.components.MuiChip.styleOverrides.root.borderRadius, 999);
|
||||
});
|
||||
|
||||
it('uses tonal surfaces instead of elevated app chrome', () => {
|
||||
assert.equal(options.components.MuiAppBar.defaultProps.elevation, 0);
|
||||
assert.equal(options.components.MuiDrawer.styleOverrides.paper.boxShadow, 'none');
|
||||
assert.equal(options.palette.background.default, '#11131A');
|
||||
assert.equal(options.palette.background.paper, '#191B23');
|
||||
});
|
||||
|
||||
it('provides focus and reduced-motion tokens', () => {
|
||||
assert.equal(options.focusRing, '0 0 0 3px rgba(183, 194, 255, 0.72)');
|
||||
assert.equal(MATERIAL_YOU_MOTION.standard, '180ms cubic-bezier(0.2, 0, 0, 1)');
|
||||
assert.match(options.components.MuiCssBaseline.styleOverrides, /prefers-reduced-motion/);
|
||||
assert.match(options.components.MuiCssBaseline.styleOverrides, /focus-visible/);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user