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

[Post 4.10.1] Fix suggested actions maxHeight #3456

Merged
merged 6 commits into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed

- Fixes [#3431](https://github.com/microsoft/BotFramework-WebChat/issues/3431). Removed delay of first activity with `replyToId` pointing to a missing activity, by [@compulim](https://github.com/compulim) in PR [#3450](https://github.com/microsoft/BotFramework-WebChat/pull/3450)
- Fixes [#3444](https://github.com/microsoft/BotFramework-WebChat/issues/3444). Make suggested actions container height styleOption flexible, by [@corinagum](https://github.com/corinagum) in PR [#3456](https://github.com/microsoft/BotFramework-WebChat/pull/3456)

### Changed

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 88 additions & 2 deletions __tests__/suggestedActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ describe('suggested-actions command', () => {
expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});

test('should show stacked suggested actions with height of 50 with overflow hidden', async () => {
test('should show stacked suggested actions with a max height of 50 with overflow hidden', async () => {
const { driver, pageObjects } = await setupWebDriver({
props: {
styleOptions: {
Expand All @@ -248,7 +248,7 @@ describe('suggested-actions command', () => {
expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});

test('should show stacked suggested actions with height of 50 with overflow scroll', async () => {
test('should show stacked suggested actions with a max height of 50 with overflow scroll', async () => {
const { driver, pageObjects } = await setupWebDriver({
props: {
styleOptions: {
Expand All @@ -269,4 +269,90 @@ describe('suggested-actions command', () => {

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

test('should show stacked suggested actions with height of 50 and scroll overflow if overflow is unassigned', async () => {
const { driver, pageObjects } = await setupWebDriver({
props: {
styleOptions: {
suggestedActionLayout: 'stacked',
suggestedActionsStackedHeight: 50,
suggestedActionsStackedOverflow: 'scroll'
}
}
});

await driver.wait(uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox('suggested-actions', { waitForSend: true });

await driver.wait(suggestedActionsShown(), timeouts.directLine);
await driver.wait(allImagesLoaded(), timeouts.fetchImage);

const base64PNG = await driver.takeScreenshot();

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

test('should show stacked suggested actions with auto height if suggested actions do not need the assigned max height', async () => {
const { driver, pageObjects } = await setupWebDriver({
props: {
styleOptions: {
suggestedActionLayout: 'stacked',
suggestedActionsStackedHeight: 1000
}
}
});

await driver.wait(uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox('suggested-actions', { waitForSend: true });

await driver.wait(suggestedActionsShown(), timeouts.directLine);
await driver.wait(allImagesLoaded(), timeouts.fetchImage);

const base64PNG = await driver.takeScreenshot();

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

test('should show stacked suggested actions with max-height ignored if it is set to 0', async () => {
const { driver, pageObjects } = await setupWebDriver({
props: {
styleOptions: {
suggestedActionLayout: 'stacked',
suggestedActionsStackedHeight: 0
}
}
});

await driver.wait(uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox('suggested-actions', { waitForSend: true });

await driver.wait(suggestedActionsShown(), timeouts.directLine);
await driver.wait(allImagesLoaded(), timeouts.fetchImage);

const base64PNG = await driver.takeScreenshot();

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

test('should show stacked suggested actions, ignoring max-height: 0 and overflow: hidden', async () => {
const { driver, pageObjects } = await setupWebDriver({
props: {
styleOptions: {
suggestedActionLayout: 'stacked',
suggestedActionsStackedHeight: 0,
suggestedActionsStackedOverflow: 'hidden'
}
}
});

await driver.wait(uiConnected(), timeouts.directLine);
await pageObjects.sendMessageViaSendBox('suggested-actions', { waitForSend: true });

await driver.wait(suggestedActionsShown(), timeouts.directLine);
await driver.wait(allImagesLoaded(), timeouts.fetchImage);

const base64PNG = await driver.takeScreenshot();

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function createSuggestedActionsStyle({
},

'& .webchat__suggested-actions__stack': {
height: suggestedActionsStackedHeight || 'auto',
maxHeight: suggestedActionsStackedHeight || 'auto',
overflowY: suggestedActionsStackedOverflow || 'auto',
paddingBottom: paddingRegular / 2,
paddingLeft: paddingRegular / 2,
Expand Down
2 changes: 1 addition & 1 deletion packages/component/src/Styles/defaultStyleOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const DEFAULT_OPTIONS = {
suggestedActionsCarouselFlipperSize: 20, // Flipper visible size

// Suggested actions stacked layout
suggestedActionsStackedHeight: undefined, // defaults to 'auto'
suggestedActionsStackedHeight: undefined, // sets the container's max height. defaults to 'auto'
suggestedActionsStackedOverflow: undefined, // defaults to 'auto',

// Timestamp
Expand Down