Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/renderer/__mocks__/state-mocks.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import {
type Account,
type AppearanceSettingsState,
type AuthState,
type FilterSettingsState,
type GitifyState,
type GitifyUser,
GroupBy,
type Hostname,
type Link,
type NotificationSettingsState,
OpenPreference,
type SettingsState,
type SystemSettingsState,
Theme,
type Token,
} from '../types';
Expand Down Expand Up @@ -80,16 +84,17 @@ export const mockAuth: AuthState = {

export const mockToken = 'token-123-456' as Token;

const mockAppearanceSettings = {
const mockAppearanceSettings: AppearanceSettingsState = {
theme: Theme.SYSTEM,
zoomPercentage: 100,
detailedNotifications: true,
showPills: true,
showNumber: true,
showAccountHeader: false,
wrapNotificationTitle: false,
};

const mockNotificationSettings = {
const mockNotificationSettings: NotificationSettingsState = {
groupBy: GroupBy.REPOSITORY,
fetchAllNotifications: true,
participating: false,
Expand All @@ -98,7 +103,7 @@ const mockNotificationSettings = {
delayNotificationState: false,
};

const mockSystemSettings = {
const mockSystemSettings: SystemSettingsState = {
openLinks: OpenPreference.FOREGROUND,
keyboardShortcut: true,
showNotificationsCountInTray: true,
Expand All @@ -108,7 +113,7 @@ const mockSystemSettings = {
openAtStartup: false,
};

const mockFilters = {
const mockFilters: FilterSettingsState = {
hideBots: false,
filterReasons: [],
};
Expand Down
12 changes: 9 additions & 3 deletions src/renderer/components/notifications/NotificationRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ export const NotificationRow: FC<INotificationRow> = ({
<Stack
direction="vertical"
gap="none"
className="cursor-pointer truncate w-full"
className={cn(
'cursor-pointer text-sm w-full',
!settings.wrapNotificationTitle && 'truncate',
)}
onClick={() => handleNotification()}
>
<NotificationHeader notification={notification} />
Expand All @@ -126,10 +129,13 @@ export const NotificationRow: FC<INotificationRow> = ({
justify="space-between"
gap="condensed"
title={notificationTitle}
className="text-sm mb-0.5 truncate"
className={cn(
'mb-0.5',
!settings.wrapNotificationTitle && 'truncate',
)}
data-testid="notification-row"
>
<Text className="block truncate flex-shrink overflow-ellipsis">
<Text className={!settings.wrapNotificationTitle && 'truncate'}>
{notification.subject.title}
</Text>
<Text
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions src/renderer/components/settings/AppearanceSettings.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,29 @@ describe('renderer/routes/components/settings/AppearanceSettings.tsx', () => {
expect(updateSetting).toHaveBeenCalledTimes(1);
expect(updateSetting).toHaveBeenCalledWith('showAccountHeader', true);
});

it('should toggle wrap notification title checkbox', async () => {
await act(async () => {
render(
<AppContext.Provider
value={{
auth: {
accounts: [mockGitHubAppAccount],
},
settings: mockSettings,
updateSetting,
}}
>
<MemoryRouter>
<AppearanceSettings />
</MemoryRouter>
</AppContext.Provider>,
);
});

fireEvent.click(screen.getByTestId('checkbox-wrapNotificationTitle'));

expect(updateSetting).toHaveBeenCalledTimes(1);
expect(updateSetting).toHaveBeenCalledWith('wrapNotificationTitle', true);
});
});
Loading
Loading