Skip to content

Commit 3d0d22d

Browse files
committed
[Discover] Fix truncation for longer text in table (elastic#241440)
(cherry picked from commit b947916)
1 parent de426e6 commit 3d0d22d

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/platform/packages/shared/kbn-data-grid-in-table-search/src/in_table_search_highlights_wrapper.test.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('InTableSearchHighlightsWrapper', () => {
3636
});
3737

3838
expect(container.innerHTML).toMatchInlineSnapshot(
39-
`"<div><div>Some text here with <mark style=\\"color: black; background-color: green;\\" class=\\"dataGridInTableSearch__match\\" data-match-index=\\"0\\">test</mark> and <mark style=\\"color: black; background-color: green;\\" class=\\"dataGridInTableSearch__match\\" data-match-index=\\"1\\">test</mark> and even more <mark style=\\"color: black; background-color: green;\\" class=\\"dataGridInTableSearch__match\\" data-match-index=\\"2\\">Test</mark> to be sure<div><mark style=\\"color: black; background-color: green;\\" class=\\"dataGridInTableSearch__match\\" data-match-index=\\"3\\">test</mark></div><div>this</div><img src=\\"https://test.com\\" alt=\\"not for test\\"></div></div>"`
39+
`"<span><div>Some text here with <mark style=\\"color: black; background-color: green;\\" class=\\"dataGridInTableSearch__match\\" data-match-index=\\"0\\">test</mark> and <mark style=\\"color: black; background-color: green;\\" class=\\"dataGridInTableSearch__match\\" data-match-index=\\"1\\">test</mark> and even more <mark style=\\"color: black; background-color: green;\\" class=\\"dataGridInTableSearch__match\\" data-match-index=\\"2\\">Test</mark> to be sure<div><mark style=\\"color: black; background-color: green;\\" class=\\"dataGridInTableSearch__match\\" data-match-index=\\"3\\">test</mark></div><div>this</div><img src=\\"https://test.com\\" alt=\\"not for test\\"></div></span>"`
4040
);
4141
});
4242

@@ -52,7 +52,7 @@ describe('InTableSearchHighlightsWrapper', () => {
5252
});
5353

5454
expect(container.innerHTML).toMatchInlineSnapshot(
55-
`"<div><div><mark style=\\"color: black; background-color: green;\\" class=\\"dataGridInTableSearch__match\\" data-match-index=\\"0\\">test2</mark></div></div>"`
55+
`"<span><div><mark style=\\"color: black; background-color: green;\\" class=\\"dataGridInTableSearch__match\\" data-match-index=\\"0\\">test2</mark></div></span>"`
5656
);
5757
});
5858

@@ -63,7 +63,7 @@ describe('InTableSearchHighlightsWrapper', () => {
6363
</InTableSearchHighlightsWrapper>
6464
);
6565

66-
expect(container.innerHTML).toMatchInlineSnapshot(`"<div><div>test2</div></div>"`);
66+
expect(container.innerHTML).toMatchInlineSnapshot(`"<span><div>test2</div></span>"`);
6767
});
6868

6969
it('escape the input with tags', async () => {
@@ -82,7 +82,7 @@ describe('InTableSearchHighlightsWrapper', () => {
8282
});
8383

8484
expect(container.innerHTML).toMatchInlineSnapshot(
85-
`"<div><div><hr><div>test</div><div>this <mark style=\\"color: black; background-color: green;\\" class=\\"dataGridInTableSearch__match\\" data-match-index=\\"0\\">&lt;hr /&gt;</mark></div></div></div>"`
85+
`"<span><div><hr><div>test</div><div>this <mark style=\\"color: black; background-color: green;\\" class=\\"dataGridInTableSearch__match\\" data-match-index=\\"0\\">&lt;hr /&gt;</mark></div></div></span>"`
8686
);
8787
});
8888

@@ -98,7 +98,7 @@ describe('InTableSearchHighlightsWrapper', () => {
9898
});
9999

100100
expect(container.innerHTML).toMatchInlineSnapshot(
101-
`"<div><div>test this now<mark style=\\"color: black; background-color: green;\\" class=\\"dataGridInTableSearch__match\\" data-match-index=\\"0\\">.</mark></div></div>"`
101+
`"<span><div>test this now<mark style=\\"color: black; background-color: green;\\" class=\\"dataGridInTableSearch__match\\" data-match-index=\\"0\\">.</mark></div></span>"`
102102
);
103103
});
104104

@@ -109,7 +109,7 @@ describe('InTableSearchHighlightsWrapper', () => {
109109
</InTableSearchHighlightsWrapper>
110110
);
111111

112-
expect(container.innerHTML).toMatchInlineSnapshot(`"<div><div>test</div></div>"`);
112+
expect(container.innerHTML).toMatchInlineSnapshot(`"<span><div>test</div></span>"`);
113113
});
114114
});
115115

@@ -136,7 +136,7 @@ describe('InTableSearchHighlightsWrapper', () => {
136136
});
137137

138138
expect(container.innerHTML).toMatchInlineSnapshot(
139-
`"<div><div>Some text here with test and test and even more Test to be sure<div>test</div><div>this</div><img src=\\"https://test.com\\" alt=\\"not for test\\"></div></div>"`
139+
`"<span><div>Some text here with test and test and even more Test to be sure<div>test</div><div>this</div><img src=\\"https://test.com\\" alt=\\"not for test\\"></div></span>"`
140140
);
141141
});
142142

@@ -157,7 +157,7 @@ describe('InTableSearchHighlightsWrapper', () => {
157157
expect(onHighlightsCountFound).toHaveBeenCalledWith(1);
158158
});
159159

160-
expect(container.innerHTML).toMatchInlineSnapshot(`"<div><div>test2</div></div>"`);
160+
expect(container.innerHTML).toMatchInlineSnapshot(`"<span><div>test2</div></span>"`);
161161
});
162162

163163
it('with no matches', async () => {
@@ -176,7 +176,7 @@ describe('InTableSearchHighlightsWrapper', () => {
176176
expect(onHighlightsCountFound).toHaveBeenCalledWith(0);
177177
});
178178

179-
expect(container.innerHTML).toMatchInlineSnapshot(`"<div><div>test2</div></div>"`);
179+
expect(container.innerHTML).toMatchInlineSnapshot(`"<span><div>test2</div></span>"`);
180180
});
181181

182182
it('with no search term', async () => {
@@ -187,7 +187,7 @@ describe('InTableSearchHighlightsWrapper', () => {
187187
</InTableSearchHighlightsWrapper>
188188
);
189189

190-
expect(container.innerHTML).toMatchInlineSnapshot(`"<div><div>test</div></div>"`);
190+
expect(container.innerHTML).toMatchInlineSnapshot(`"<span><div>test</div></span>"`);
191191
expect(onHighlightsCountFound).not.toHaveBeenCalled();
192192
});
193193
});

src/platform/packages/shared/kbn-data-grid-in-table-search/src/in_table_search_highlights_wrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const InTableSearchHighlightsWrapper: React.FC<InTableSearchHighlightsWra
6161
onHighlightsCountFound,
6262
]);
6363

64-
return <div ref={cellValueRef}>{children}</div>;
64+
return <span ref={cellValueRef}>{children}</span>;
6565
};
6666

6767
const searchTermRegExpCache = new Map<string, RegExp>();

0 commit comments

Comments
 (0)