mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-05 17:08:26 +00:00
feat(ui): add cross-platform window control styles
Persist automatic and explicit macOS, Windows, GNOME, and minimal control presets with localized settings and platform-aware fallback. Refs #31
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { resolveWindowControlStyle } from './windowControlStyle';
|
||||
|
||||
describe('resolveWindowControlStyle', () => {
|
||||
it('uses the platform convention for automatic style', () => {
|
||||
expect(resolveWindowControlStyle('auto', 'macos')).toBe('macos');
|
||||
expect(resolveWindowControlStyle('auto', 'windows')).toBe('windows');
|
||||
expect(resolveWindowControlStyle('auto', 'linux')).toBe('gnome');
|
||||
});
|
||||
|
||||
it('falls back to macOS styling while an unsupported platform is unresolved', () => {
|
||||
expect(resolveWindowControlStyle('auto', 'unknown')).toBe('macos');
|
||||
expect(resolveWindowControlStyle('auto', 'android')).toBe('macos');
|
||||
});
|
||||
|
||||
it('uses the desktop user agent while native platform detection is unresolved', () => {
|
||||
expect(resolveWindowControlStyle('auto', 'unknown', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)')).toBe('windows');
|
||||
expect(resolveWindowControlStyle('auto', 'unknown', 'Mozilla/5.0 (X11; Linux x86_64)')).toBe('gnome');
|
||||
expect(resolveWindowControlStyle('auto', 'unknown', 'Mozilla/5.0 (Linux; Android 14)')).toBe('macos');
|
||||
});
|
||||
|
||||
it('preserves an explicit style across platforms', () => {
|
||||
expect(resolveWindowControlStyle('macos', 'windows')).toBe('macos');
|
||||
expect(resolveWindowControlStyle('windows', 'linux')).toBe('windows');
|
||||
expect(resolveWindowControlStyle('gnome', 'macos')).toBe('gnome');
|
||||
expect(resolveWindowControlStyle('minimal', 'windows')).toBe('minimal');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user