fix: icon slight proportion change

This commit is contained in:
2026-02-17 12:52:31 +01:00
parent e62e4ac830
commit 5c0dbaff71
3 changed files with 70 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
import React from 'react';
import { describe, it, expect, beforeEach, vi } from 'vitest';
import { fireEvent, render, screen } from '@testing-library/react';
import { act, fireEvent, render, screen } from '@testing-library/react';
import { WindowTitleBar } from '../../../src/renderer/components/WindowTitleBar/WindowTitleBar';
import { useAppStore } from '../../../src/renderer/store';
@@ -64,6 +64,32 @@ describe('WindowTitleBar', () => {
expect(iconPane).toHaveAttribute('data-shape', 'bottom-half');
});
it('renders active and inactive icon states based on sidebar/panel visibility', () => {
render(<WindowTitleBar />);
const sidebarIcon = document.querySelector('.window-titlebar-sidebar-icon');
const panelIcon = document.querySelector('.window-titlebar-panel-icon');
expect(sidebarIcon).toHaveClass('is-active');
expect(sidebarIcon).not.toHaveClass('is-inactive');
expect(panelIcon).toHaveClass('is-inactive');
expect(panelIcon).not.toHaveClass('is-active');
});
it('updates icon states when visibility changes outside titlebar buttons', () => {
render(<WindowTitleBar />);
act(() => {
useAppStore.setState({ sidebarVisible: false, panelVisible: true });
});
const sidebarIcon = document.querySelector('.window-titlebar-sidebar-icon');
const panelIcon = document.querySelector('.window-titlebar-panel-icon');
expect(sidebarIcon).toHaveClass('is-inactive');
expect(panelIcon).toHaveClass('is-active');
});
it('places panel toggle to the right of sidebar toggle', () => {
render(<WindowTitleBar />);