From 855fdecf5d3f1e2aab3e735abc25e1d20fa1bad0 Mon Sep 17 00:00:00 2001 From: Tony Anziano Date: Mon, 28 Oct 2019 16:59:38 -0700 Subject: [PATCH] Added an empty state for the recent bots submenu in the app menu for Windows --- CHANGELOG.md | 2 ++ .../app/client/src/ui/shell/appMenu/appMenu.spec.tsx | 11 +++++++++++ packages/app/client/src/ui/shell/appMenu/appMenu.tsx | 3 +++ 3 files changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30e75ab47..2043c6c21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +## Fixed +- [client] Added an empty state for the recent bots submenu in the app menu for Windows in PR [1945](https://github.com/microsoft/BotFramework-Emulator/pull/1945) ## v4.6.0 - 2019 - 10 - 31 ## Added diff --git a/packages/app/client/src/ui/shell/appMenu/appMenu.spec.tsx b/packages/app/client/src/ui/shell/appMenu/appMenu.spec.tsx index 9d4306a11..db018f3a3 100644 --- a/packages/app/client/src/ui/shell/appMenu/appMenu.spec.tsx +++ b/packages/app/client/src/ui/shell/appMenu/appMenu.spec.tsx @@ -162,6 +162,17 @@ describe('', () => { expect(dispatchSpy).toHaveBeenCalledWith(executeCommand(false, Bot.Switch, null, 'path1')); }); + it('should generate the recent bots menu when there are no recent bots', () => { + instance.props = { + ...instance.props, + recentBots: [], + }; + const recentBotsItems: MenuItem[] = (instance as any).getRecentBotsMenuItems(); + + expect(recentBotsItems).toHaveLength(1); + expect(recentBotsItems.reduce((labels, item) => [...labels, item.label], [])).toEqual(['No recent bots']); + }); + it('should get an app update menu item for when an update is ready to install', () => { instance.props = { ...instance.props, appUpdateStatus: UpdateStatus.UpdateReadyToInstall }; const updateItem: MenuItem = (instance as any).getAppUpdateMenuItem(); diff --git a/packages/app/client/src/ui/shell/appMenu/appMenu.tsx b/packages/app/client/src/ui/shell/appMenu/appMenu.tsx index 948d9f516..e5865d6c8 100644 --- a/packages/app/client/src/ui/shell/appMenu/appMenu.tsx +++ b/packages/app/client/src/ui/shell/appMenu/appMenu.tsx @@ -133,6 +133,9 @@ export class AppMenu extends React.Component { }; bots.push(botItem); }); + if (!bots.length) { + bots.push({ label: 'No recent bots', disabled: true }); + } return bots; }