render-proxy.spec.js 899 B

1234567891011121314151617181920212223242526272829303132
  1. import Vue from 'vue'
  2. if (typeof Proxy !== 'undefined') {
  3. describe('render proxy', () => {
  4. it('should warn missing property in render fns with `with`', () => {
  5. new Vue({
  6. template: `<div>{{ a }}</div>`
  7. }).$mount()
  8. expect(`Property or method "a" is not defined`).toHaveBeenWarned()
  9. })
  10. it('should warn missing property in render fns without `with`', () => {
  11. const render = function (h) {
  12. return h('div', [this.a])
  13. }
  14. render._withStripped = true
  15. new Vue({
  16. render
  17. }).$mount()
  18. expect(`Property or method "a" is not defined`).toHaveBeenWarned()
  19. })
  20. it('should not warn for hand-written render functions', () => {
  21. new Vue({
  22. render (h) {
  23. return h('div', [this.a])
  24. }
  25. }).$mount()
  26. expect(`Property or method "a" is not defined`).not.toHaveBeenWarned()
  27. })
  28. })
  29. }