mirror of
https://github.com/element-plus/element-plus.git
synced 2025-02-23 11:59:34 +08:00
test(components): [el-tooltip] add unit test about appendTo (#6178)
This commit is contained in:
parent
4c4be8f951
commit
7e9ff25aea
@ -145,7 +145,6 @@ tooltip/animations
|
||||
| Attribute | Description | Type | Accepted Values | Default |
|
||||
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------- | --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
|
||||
| append-to | which element the tooltip CONTENT appends to | CSSSelector \| HTMLElement | — | #el-popper-container-[randomValue] |
|
||||
| append-to-body (deprecated) | indicates whether the tooltip contents will be append to the document.body element | boolean | true / false | true |
|
||||
| effect | Tooltip theme, built-in theme: `dark` / `light` | string | string | dark |
|
||||
| content | display content, can be overridden by `slot#content` | String | — | — |
|
||||
| raw-content | whether `content` is treated as HTML string | boolean | — | false |
|
||||
|
@ -41,6 +41,19 @@ describe('<ElTooltip />', () => {
|
||||
await nextTick()
|
||||
expect(findTrigger().text()).toContain(AXIOM)
|
||||
})
|
||||
it('content should teleport according appendTo', async () => {
|
||||
const el = document.createElement('div')
|
||||
el.id = 'test'
|
||||
document.body.appendChild(el)
|
||||
wrapper = createComponent({ appendTo: '#test' }, 'test appendTo props')
|
||||
await nextTick()
|
||||
const trigger$ = findTrigger()
|
||||
const triggerEl = trigger$.find('.el-tooltip__trigger')
|
||||
await triggerEl.trigger('mouseenter')
|
||||
expect(document.querySelector('#test')?.innerHTML).toContain(
|
||||
'test appendTo props'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('deprecating API', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user