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

Add word-wrap to messageActivity #1832

Merged
merged 4 commits into from
Mar 21, 2019
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 @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed
- Fix [#1423](https://github.com/Microsoft/BotFramework-WebChat/issues/1423). Added sample for hosting WebChat in Angular, by [@omarsourour](https://github.com/omarsourour) in PR [#1813](https://github.com/Microsoft/BotFramework-WebChat/pull/1813)
- Fix [#1767](https://github.com/Microsoft/BotFramework-WebChat/issues/1767). Remove `cursor: pointer` from buttons, by [@corinagum](https://github.com/corinagum) in PR [#1819](https://github.com/Microsoft/BotFramework-WebChat/pull/1819)
- Fix [#1774](https://github.com/Microsoft/BotFramework-WebChat/issues/1774). Add `styleSetOption` to allow word break. Default to `break-word`, by [@corinagum](https://github.com/corinagum) in PR [#1832](https://github.com/Microsoft/BotFramework-WebChat/pull/1832)

## [4.3.0] - 2019-03-04

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.
43 changes: 43 additions & 0 deletions __tests__/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,46 @@ test('setup', async () => {

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

test('long URLs with break-word', async () => {
const { driver, pageObjects} = await setupWebDriver();

await pageObjects.sendMessageViaSendBox('https://subdomain.domain.com/pathname0/pathname1/pathname2/pathname3/pathname4/')

await driver.wait(minNumActivitiesShown(2), 2000);
await driver.wait(allImagesLoaded(), 2000);

const base64PNG = await driver.takeScreenshot();

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

test('long URLs with break-all', async () => {
const WEB_CHAT_PROPS = { styleOptions: { messageActivityWordBreak: 'break-all' } };

const { driver, pageObjects} = await setupWebDriver({ props: WEB_CHAT_PROPS });

await pageObjects.sendMessageViaSendBox('https://subdomain.domain.com/pathname0/pathname1/pathname2/pathname3/pathname4/')

await driver.wait(minNumActivitiesShown(2), 2000);
await driver.wait(allImagesLoaded(), 2000);

const base64PNG = await driver.takeScreenshot();

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

test('long URLs with keep-all', async () => {
const WEB_CHAT_PROPS = { styleOptions: { messageActivityWordBreak: 'keep-all' } };

const { driver, pageObjects} = await setupWebDriver({ props: WEB_CHAT_PROPS });

await pageObjects.sendMessageViaSendBox('箸より重いものを持ったことがない箸より重いものを持ったことがない')

await driver.wait(minNumActivitiesShown(2), 2000);
await driver.wait(allImagesLoaded(), 2000);

const base64PNG = await driver.takeScreenshot();

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
});
4 changes: 3 additions & 1 deletion packages/component/src/Styles/StyleSet/Bubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ export default function createBubbleStyle({
bubbleFromUserTextColor,
bubbleMaxWidth,
bubbleMinHeight,
bubbleTextColor
bubbleTextColor,
messageActivityWordBreak
}) {
return {
maxWidth: bubbleMaxWidth,
minHeight: bubbleMinHeight,
wordBreak: messageActivityWordBreak,

'&:not(.from-user)': {
background: bubbleBackground,
Expand Down
5 changes: 4 additions & 1 deletion packages/component/src/Styles/defaultStyleSetOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ const DEFAULT_OPTIONS = {
paddingWide: 20,
subtle: DEFAULT_SUBTLE,

// Word break
messageActivityWordBreak: 'break-word', // 'normal' || 'break-all' || 'break-word' || 'keep-all'

// fonts
primaryFont: fontFamily(['Calibri', 'Helvetica Neue', 'Arial', 'sans-serif']),
monospaceFont: fontFamily(['Consolas', 'Courier New', 'monospace']),
Expand Down Expand Up @@ -43,7 +46,7 @@ const DEFAULT_OPTIONS = {
// Root
rootHeight: '100%',
rootWidth: '100%',

// Send box
hideSendBox: false,
hideUploadButton: false,
Expand Down