diff --git a/shell/browser/api/electron_api_app.cc b/shell/browser/api/electron_api_app.cc index 32cd2bbc388e..e7e2dfd0a6ce 100644 --- a/shell/browser/api/electron_api_app.cc +++ b/shell/browser/api/electron_api_app.cc @@ -1281,7 +1281,7 @@ JumpListResult App::SetJumpList(v8::Local val, if (!delete_jump_list && !gin::ConvertFromV8(args->isolate(), val, &categories)) { gin_helper::ErrorThrower(args->isolate()) - .ThrowError("Argument must be null or an array of categories"); + .ThrowTypeError("Argument must be null or an array of categories"); return JumpListResult::kArgumentError; } diff --git a/spec/api-app-spec.ts b/spec/api-app-spec.ts index 3d8334a0e7d5..c0b01fd41abf 100644 --- a/spec/api-app-spec.ts +++ b/spec/api-app-spec.ts @@ -996,6 +996,44 @@ describe('app module', () => { }); }); + ifdescribe(process.platform === 'win32')('setJumpList(categories)', () => { + it('throws an error when categories is not null or an array', () => { + expect(() => { + app.setJumpList('string' as any); + }).to.throw('Argument must be null or an array of categories'); + }); + + it('can get jump list settings', () => { + const settings = app.getJumpListSettings(); + expect(settings).to.eql({ minItems: 10, removedItems: [] }); + }); + + it('can set a jump list with an array of categories', () => { + expect(() => { + app.setJumpList([ + { type: 'frequent' }, + { + items: [{ + type: 'task', + title: 'New Project', + program: process.execPath, + args: '--new-project', + description: 'Create a new project.' + }, + { type: 'separator' }, + { + type: 'task', + title: 'Recover Project', + program: process.execPath, + args: '--recover-project', + description: 'Recover Project' + }] + } + ]); + }).to.not.throw(); + }); + }); + describe('getAppPath', () => { it('works for directories with package.json', async () => { const { appPath } = await runTestApp('app-path');