diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a11f2789..8ea3d363c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Fixed - [build] Replaced a missing .icns file that was deleted by mistake in a previous PR. Fixes the app icon on Linux & Mac in PR [2104](https://github.com/microsoft/BotFramework-Emulator/pull/2104) - [client] Fixed an issue where Restart activity wont appear on selected activity after restarting once in PR [2105](https://github.com/microsoft/BotFramework-Emulator/pull/2105) - +- [client] Disable "Restart conversation from here" bubble on DL Speech bots [2107](https://github.com/microsoft/BotFramework-Emulator/pull/2107) ## v4.8.0 - 2019 - 03 - 12 ## Added diff --git a/packages/app/client/src/ui/editor/emulator/parts/chat/outerActivityWrapper.spec.tsx b/packages/app/client/src/ui/editor/emulator/parts/chat/outerActivityWrapper.spec.tsx index 89d827096..00165a0dc 100644 --- a/packages/app/client/src/ui/editor/emulator/parts/chat/outerActivityWrapper.spec.tsx +++ b/packages/app/client/src/ui/editor/emulator/parts/chat/outerActivityWrapper.spec.tsx @@ -40,6 +40,10 @@ import { ValueTypes, RestartConversationOptions, RestartConversationStatus } fro import { OuterActivityWrapper } from './outerActivityWrapper'; import { OuterActivityWrapperContainer } from './outerActivityWrapperContainer'; +jest.mock('./chat.scss', () => ({ + hidden: 'hidden-restart', +})); + describe('', () => { it('should render', () => { const storeState = { @@ -152,4 +156,201 @@ describe('', () => { expect((instance as any).isUserActivity(userCard.activity)).toBe(true); expect((instance as any).isUserActivity(botCard.activity)).toBe(false); }); + + describe('Restart conversation bubble in OuterActivityWrapper', () => { + it('should show restart bubble if a)not Speech bot; b) Webchat is enabled; c)User activity is selected', () => { + const card = { + activity: { + id: 'card1', + from: { + role: 'user', + }, + channelData: { + test: true, + }, + }, + }; + const storeState = { + chat: { + chats: { + doc1: { + highlightedObjects: [], + inspectorObjects: [{ value: { ...card.activity }, valueType: ValueTypes.Activity }], + mode: 'livechat', + }, + }, + restartStatus: { + doc1: RestartConversationStatus.Stop, + }, + }, + }; + + const wrapper = mount( + state, storeState)}> + + + ); + expect(wrapper.find('hidden-restart').length).toBe(0); + }); + + it('should hide restart bubble if activity not selected', () => { + const card = { + activity: { + id: 'card1', + from: { + role: 'user', + }, + channelData: { + test: true, + }, + }, + }; + const storeState = { + chat: { + chats: { + doc1: { + highlightedObjects: [], + inspectorObjects: [{ value: {}, valueType: ValueTypes.Activity }], + mode: 'livechat', + }, + }, + restartStatus: { + doc1: RestartConversationStatus.Stop, + }, + }, + }; + + const wrapper = mount( + state, storeState)}> + + + ); + expect(wrapper.find('.hidden-restart').length).toBe(1); + }); + + it('should hide restart bubble if it is a speech bot', () => { + const card = { + activity: { + id: 'card1', + from: { + role: 'user', + }, + channelData: { + test: true, + }, + }, + }; + const storeState = { + chat: { + chats: { + doc1: { + highlightedObjects: [], + inspectorObjects: [{ value: { ...card.activity }, valueType: ValueTypes.Activity }], + mode: 'livechat', + speechKey: 'abc', + speechRegion: 'westus', + }, + }, + restartStatus: { + doc1: RestartConversationStatus.Stop, + }, + }, + }; + + const wrapper = mount( + state, storeState)}> + + + ); + expect(wrapper.find('.hidden-restart').length).toBe(1); + }); + + it('should hide restart bubble if restart conversation has a status of "Started" for chat', () => { + const card = { + activity: { + id: 'card1', + from: { + role: 'user', + }, + channelData: { + test: true, + }, + }, + }; + const storeState = { + chat: { + chats: { + doc1: { + highlightedObjects: [], + inspectorObjects: [{ value: { ...card.activity }, valueType: ValueTypes.Activity }], + mode: 'livechat', + }, + }, + restartStatus: { + doc1: RestartConversationStatus.Started, + }, + }, + }; + + const wrapper = mount( + state, storeState)}> + + + ); + expect(wrapper.find('.hidden-restart').length).toBe(1); + }); + + it('should hide restart bubble if chat in transcript mode', () => { + const card = { + activity: { + id: 'card1', + from: { + role: 'user', + }, + channelData: { + test: true, + }, + }, + }; + const storeState = { + chat: { + chats: { + doc1: { + highlightedObjects: [], + inspectorObjects: [{ value: { ...card.activity }, valueType: ValueTypes.Activity }], + mode: 'transcript', + }, + }, + restartStatus: {}, + }, + }; + + const wrapper = mount( + state, storeState)}> + + + ); + expect(wrapper.find('.hidden-restart').length).toBe(1); + }); + }); }); diff --git a/packages/app/client/src/ui/editor/emulator/parts/chat/outerActivityWrapper.tsx b/packages/app/client/src/ui/editor/emulator/parts/chat/outerActivityWrapper.tsx index b6d5534ff..9c93710c6 100644 --- a/packages/app/client/src/ui/editor/emulator/parts/chat/outerActivityWrapper.tsx +++ b/packages/app/client/src/ui/editor/emulator/parts/chat/outerActivityWrapper.tsx @@ -57,6 +57,7 @@ export interface OuterActivityWrapperProps { currentRestartConversationOption: RestartConversationOptions; mode: EmulatorMode; restartStatus: RestartConversationStatus; + isDLSpeechBot: boolean; } export class OuterActivityWrapper extends React.Component { @@ -69,6 +70,7 @@ export class OuterActivityWrapper extends React.Component