Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1602: suggested-action regression #1616

Merged
merged 6 commits into from
Jan 23, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `core`: Added `sendEvent`, in PR [#1286](https://github.com/Microsoft/BotFramework-WebChat/pull/1286)
- `core`: Added `CONNECT_FULFILLING` action to workaround `redux-saga` [design decision](https://github.com/redux-saga/redux-saga/issues/1651), in PR [#1286](https://github.com/Microsoft/BotFramework-WebChat/pull/1286)
- Added missing Spanish (es-ES) locale by [@schgressive](https://github.com/schgressive) in PR [#1615](https://github.com/Microsoft/BotFramework-WebChat/pull/1615)
- Fix [#1602](https://github.com/Microsoft/BotFramework-WebChat/issues/1602). Fix suggested actions regression of buttons, by [@corinagum](https://github.com/corinagum) in PR [#1616](https://github.com/Microsoft/BotFramework-WebChat/pull/1616)

### Changed
- Moved `botAvatarImage` and `userAvatarImage` to `styleOptions.botAvatarImage` and `styleOptions.userAvatarImage` respectively, in PR [#1486](https://github.com/Microsoft/BotFramework-WebChat/pull/1486)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions __tests__/suggestedActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@ function sleep(ms = 1000) {
// https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_WebDriver.html

describe('suggested-actions command', async () => {
test('should show correctly formatted buttons when suggested actions are displayed', async() => {
corinagum marked this conversation as resolved.
Show resolved Hide resolved
const { driver } = await setupWebDriver();

await sleep(2000);

const input = await driver.findElement(By.tagName('input[type="text"]'));

await input.sendKeys('suggested-actions', Key.RETURN);
await sleep(2000);

const base64PNG = await driver.takeScreenshot();

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
}, 60000);

test('should show response from bot and no text from user on imback', async () => {
const { driver } = await setupWebDriver();
Expand Down
7 changes: 5 additions & 2 deletions packages/component/src/SendBox/SuggestedActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ export default connectSuggestedActions(
buttonText={
type === 'messageBack' ?
title || displayText
:
title || (typeof value !== 'string') ? JSON.stringify(value) : value
: title ?
title
: (typeof value === 'string') ?
corinagum marked this conversation as resolved.
Show resolved Hide resolved
value
: JSON.stringify(value)
}
displayText={ displayText }
key={ index }
Expand Down