Skip to content

Commit 6dfd45e

Browse files
authored
Merge pull request #1635 from hovancik/fix/tit
prevent error with negative time to break in tray icon
2 parents 0186556 + 0285efc commit 6dfd45e

4 files changed

Lines changed: 18 additions & 1 deletion

File tree

.github/copilot-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ You are a specialized assistant for developers working on Stretchly, a break-tim
2121
- Respect the existing project structure
2222
- Place new functionality in appropriate modules
2323
- Follow the established patterns for event handling
24+
- Do not write comments unless absolutely necessary; prefer self-explanatory code
2425

2526
## Testing Expectations
2627
- Suggest tests for new functionality

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1414
- do not check for Quiet Hours on Windows (deprecated)
1515

1616
### Fixed
17+
- prevent error with negative time to break in tray icon
1718
- hide close/minimize actions on Break window on macOS
1819
- issue when not all strings correctly translate after language change
1920

app/utils/appIcon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class AppIcon {
2424
const invertedMonochromeString = this.inverted ? 'Inverted' : ''
2525
const darkModeString = this.darkMode ? 'Dark' : ''
2626
const timeToBreakInTrayString = (this.paused || this.reference === 'finishMicrobreak' ||
27-
this.reference === 'finishBreak' || !this.timeToBreakInTray || !Number.isInteger(this.timeToBreak))
27+
this.reference === 'finishBreak' || !this.timeToBreakInTray || !Number.isInteger(this.timeToBreak) || this.timeToBreak < 0)
2828
? ''
2929
: `Number${this.timeToBreak}`
3030

test/appIcon.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,21 @@ describe('appIcon', function () {
242242
appIcon.trayIconFileName.should.equal('trayNumber2.png')
243243
})
244244

245+
it('does not add Number when timeToBreak is negative', function () {
246+
const params = {
247+
paused: false,
248+
monochrome: false,
249+
inverted: false,
250+
darkMode: false,
251+
platform: 'linux',
252+
timeToBreakInTray: true,
253+
timeToBreak: -1,
254+
reference: 'startMicrobreak'
255+
}
256+
const appIcon = new AppIcon(params)
257+
appIcon.trayIconFileName.should.equal('tray.png')
258+
})
259+
245260
it('trayIconFileName works for light mode on Windows', function () {
246261
const params = {
247262
paused: false,

0 commit comments

Comments
 (0)