Skip to content

Commit

Permalink
Fix suggested-action regression where title does not get added to pos…
Browse files Browse the repository at this point in the history
…tback and imback action buttons
  • Loading branch information
Corina committed Jan 18, 2019
1 parent 7a5cc3a commit 919501c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
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() => {
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') ?
value
: JSON.stringify(value)
}
displayText={ displayText }
key={ index }
Expand Down

0 comments on commit 919501c

Please sign in to comment.