compat.spec.ts 684 B

1234567891011121314151617181920212223242526272829303132
  1. ;(global as any).__COMPAT__ = true
  2. import Vue from '../src/index'
  3. describe('2.x compat build', async () => {
  4. test('should work', async () => {
  5. const root = document.createElement('div')
  6. document.body.appendChild(root)
  7. const instance = new Vue({
  8. data() {
  9. return { count: 0 }
  10. },
  11. methods: {
  12. change() {
  13. this.count++
  14. }
  15. },
  16. render(h: any) {
  17. return h('div', this.count)
  18. }
  19. }).$mount(root)
  20. expect(instance.count).toBe(0)
  21. expect(root.textContent).toBe('0')
  22. instance.change()
  23. expect(instance.count).toBe(1)
  24. await Vue.nextTick()
  25. expect(root.textContent).toBe('1')
  26. })
  27. })