Skip to content

Commit

Permalink
fix(Ellipsis): the whiteSpace style of the calc container should be…
Browse files Browse the repository at this point in the history
… the same as Ellipsis (#6342)
  • Loading branch information
miracles1919 authored Aug 29, 2023
1 parent 681671d commit bb991b8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/components/ellipsis/ellipsis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ export const Ellipsis: FC<EllipsisProps> = p => {
container.style.minHeight = 'auto'
container.style.maxHeight = 'auto'
container.style.textOverflow = 'clip'
container.style.whiteSpace = 'normal'
container.style.webkitLineClamp = 'unset'
container.style.display = 'block'

Expand Down
18 changes: 18 additions & 0 deletions src/components/ellipsis/tests/ellipsis.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,22 @@ describe('Ellipsis', () => {
fireEvent.click(getByText('expand'))
expect(getByText('collapse')).toBeInTheDocument()
})

test('the `whiteSpace` style of the calc container should be the same as Ellipsis', () => {
let container: Element | null = null
Object.defineProperty(HTMLElement.prototype, 'removeChild', {
value: (child: Element) => {
container = child
},
})
render(
<Ellipsis
style={{
whiteSpace: 'pre-wrap',
}}
content={content}
/>
)
expect(container).toHaveStyle('white-space: pre-wrap')
})
})

0 comments on commit bb991b8

Please sign in to comment.