feat: allow monospaced font styles to be specified for macOS tray titles (#25059)
* feat: add optional font type to macOS tray title * test: add tests for tray font type * docs: update API reference for Tray setTitle * review: change API to use an options object * review: fix string enum in docs Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> * review: return after throwing errors * review: don't need thrower anymore now that we have args Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
This commit is contained in:
parent
13751c815e
commit
a23c66e4e1
7 changed files with 106 additions and 13 deletions
|
@ -159,5 +159,36 @@ describe('tray module', () => {
|
|||
|
||||
expect(newTitle).to.equal(title);
|
||||
});
|
||||
|
||||
it('can have an options object passed in', () => {
|
||||
expect(() => {
|
||||
tray.setTitle('Hello World!', {});
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('throws when the options parameter is not an object', () => {
|
||||
expect(() => {
|
||||
tray.setTitle('Hello World!', 'test' as any);
|
||||
}).to.throw(/setTitle options must be an object/);
|
||||
});
|
||||
|
||||
it('can have a font type option set', () => {
|
||||
expect(() => {
|
||||
tray.setTitle('Hello World!', { fontType: 'monospaced' });
|
||||
tray.setTitle('Hello World!', { fontType: 'monospacedDigit' });
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('throws when the font type is specified but is not a string', () => {
|
||||
expect(() => {
|
||||
tray.setTitle('Hello World!', { fontType: 5.4 as any });
|
||||
}).to.throw(/fontType must be one of 'monospaced' or 'monospacedDigit'/);
|
||||
});
|
||||
|
||||
it('throws on invalid font types', () => {
|
||||
expect(() => {
|
||||
tray.setTitle('Hello World!', { fontType: 'blep' as any });
|
||||
}).to.throw(/fontType must be one of 'monospaced' or 'monospacedDigit'/);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue