Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 485 Bytes

destroy.md

File metadata and controls

24 lines (18 loc) · 485 Bytes

destroy

Destroys a Vue component instance.

  • Example:
import { mount } from '@vue/test-utils'
import sinon from 'sinon'

const spy = sinon.stub()
mount({
  render: null,
  destroyed() {
    spy()
  }
}).destroy()
expect(spy.calledOnce).toBe(true)

if attachToDocument was set to true when mounted, the component DOM elements will also be removed from the document.

For functional components, destroy only removes the rendered DOM elements from the document.