diff --git a/src-docs/src/views/expression/expression.js b/src-docs/src/views/expression/expression.js
index 2153d2b6033..bb9113635c3 100644
--- a/src-docs/src/views/expression/expression.js
+++ b/src-docs/src/views/expression/expression.js
@@ -91,10 +91,7 @@ export default () => {
onChange={changeExample1}
options={[
{ value: 'count()', text: 'count()' },
- {
- value: 'average()',
- text: 'average()',
- },
+ { value: 'average()', text: 'average()' },
{ value: 'sum()', text: 'sum()' },
{ value: 'median()', text: 'median()' },
{ value: 'min()', text: 'min()' },
diff --git a/src-docs/src/views/expression/expression_example.js b/src-docs/src/views/expression/expression_example.js
index 42a7db8924d..6e6a5464e37 100644
--- a/src-docs/src/views/expression/expression_example.js
+++ b/src-docs/src/views/expression/expression_example.js
@@ -46,18 +46,11 @@ const stringingSnippet = `
import Truncate from './truncate';
const truncateSource = require('!!raw-loader!./truncate');
const truncateHtml = renderToHtml(Truncate);
-const truncateSnippet = `
-
-
-
`;
+const truncateSnippet = `
`;
export const ExpressionExample = {
title: 'Expression',
@@ -144,12 +137,12 @@ export const ExpressionExample = {
],
text: (
- For scenarios where you might want to truncate the text in{' '}
- EuiExpression. You can opt for this option when space
- is limited (e.g. a flyout) and/or when the value in{' '}
- EuiExpression can be quite long. When truncating, you
- can compliment EuiExpression with a{' '}
- EuiToolTip displaying its full value.
+ There might be cases where you need to truncate the text, to do so use
+ the truncate prop. You can opt for this option when
+ space is limited and EuiExpression's value can
+ be quite long. When truncating, you can complement{' '}
+ EuiExpression with an EuiToolTip{' '}
+ displaying its full value.
),
snippet: truncateSnippet,
diff --git a/src-docs/src/views/expression/truncate.tsx b/src-docs/src/views/expression/truncate.tsx
index fd4d3cee64b..78088b23d90 100644
--- a/src-docs/src/views/expression/truncate.tsx
+++ b/src-docs/src/views/expression/truncate.tsx
@@ -1,5 +1,4 @@
import React, { Component, HTMLAttributes } from 'react';
-import { CommonProps } from '../../../../src/components/common';
import { EuiExpression } from '../../../../src/components/expression';
import { EuiToolTip } from '../../../../src/components/tool_tip';
import { EuiPanel } from '../../../../src/components/panel';
@@ -9,7 +8,7 @@ import {
} from '../../../../src/components/popover';
import { EuiSelect } from '../../../../src/components/form/select';
-export type TruncateProps = HTMLAttributes
& CommonProps & {};
+export type TruncateProps = HTMLAttributes;
interface TruncateState {
isOpen: boolean;
@@ -90,15 +89,15 @@ export default class extends Component {
);
return (
-
- {this.state.isOpen ? (
- popOver
- ) : (
- {popOver}
- )}
-
+
+
+ {this.state.isOpen ? (
+ popOver
+ ) : (
+ {popOver}
+ )}
+
+
);
}
}
diff --git a/src/components/expression/__snapshots__/expression.test.tsx.snap b/src/components/expression/__snapshots__/expression.test.tsx.snap
index 9f91b365e54..d174696b1fb 100644
--- a/src/components/expression/__snapshots__/expression.test.tsx.snap
+++ b/src/components/expression/__snapshots__/expression.test.tsx.snap
@@ -156,7 +156,25 @@ exports[`EuiExpression props isActive true renders active 1`] = `
`;
-exports[`EuiExpression props uppercase false renders inherted case 1`] = `
+exports[`EuiExpression props truncate true truncates text 1`] = `
+
+
+ the answer is
+
+
+
+ 42
+
+
+`;
+
+exports[`EuiExpression props uppercase false renders inherited case 1`] = `
diff --git a/src/components/expression/_expression.scss b/src/components/expression/_expression.scss
index 705cef49adb..03138561053 100644
--- a/src/components/expression/_expression.scss
+++ b/src/components/expression/_expression.scss
@@ -3,7 +3,7 @@
* but then wrap long words
*/
.euiExpression {
- // @include euiTextBreakWord; /* 1 */
+ @include euiTextBreakWord; /* 1 */
@include euiFontSizeS;
@include euiCodeFont;
@@ -30,6 +30,7 @@
.euiExpression-isTruncate {
@include euiTextTruncate;
+ vertical-align: bottom;
}
.euiExpression-isClickable {
diff --git a/src/components/expression/expression.test.tsx b/src/components/expression/expression.test.tsx
index f334919d9d4..23adca2fcbb 100644
--- a/src/components/expression/expression.test.tsx
+++ b/src/components/expression/expression.test.tsx
@@ -70,7 +70,7 @@ describe('EuiExpression', () => {
expect(render(component)).toMatchSnapshot();
});
- test('false renders inherted case', () => {
+ test('false renders inherited case', () => {
const component = (
{
});
});
+ describe('truncate', () => {
+ test('true truncates text', () => {
+ const component = (
+
+ );
+
+ expect(render(component)).toMatchSnapshot();
+ });
+ });
+
describe('isActive', () => {
test('true renders active', () => {
const component = (