config.spec.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import Vue from 'vue'
  2. describe('Global config', () => {
  3. describe('preserveWhitespace', () => {
  4. it('should preserve whitepspaces when set to true', () => {
  5. // this option is set to false during unit tests.
  6. Vue.config.preserveWhitespace = true
  7. const vm = new Vue({
  8. template: '<div><span>hi</span> <span>ha</span></div>'
  9. }).$mount()
  10. expect(vm.$el.innerHTML).toBe('<span>hi</span> <span>ha</span>')
  11. Vue.config.preserveWhitespace = false
  12. })
  13. it('should remove whitespaces when set to false', () => {
  14. const vm = new Vue({
  15. template: '<div><span>hi</span> <span>ha</span></div>'
  16. }).$mount()
  17. expect(vm.$el.innerHTML).toBe('<span>hi</span><span>ha</span>')
  18. })
  19. })
  20. describe('silent', () => {
  21. it('should be false by default', () => {
  22. Vue.util.warn('foo')
  23. expect('foo').toHaveBeenWarned()
  24. })
  25. it('should work when set to true', () => {
  26. Vue.config.silent = true
  27. Vue.util.warn('foo')
  28. expect('foo').not.toHaveBeenWarned()
  29. Vue.config.silent = false
  30. })
  31. })
  32. })