global-config.spec.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. el: document.createElement('div'),
  9. template: '<div><span>hi</span> <span>ha</span></div>'
  10. })
  11. expect(vm.$el.innerHTML).toBe('<span>hi</span> <span>ha</span>')
  12. Vue.config.preserveWhitespace = false
  13. })
  14. it('should remove whitespaces when set to false', () => {
  15. const vm = new Vue({
  16. el: document.createElement('div'),
  17. template: '<div><span>hi</span> <span>ha</span></div>'
  18. })
  19. expect(vm.$el.innerHTML).toBe('<span>hi</span><span>ha</span>')
  20. })
  21. })
  22. describe('silent', () => {
  23. it('should be false by default', () => {
  24. Vue.util.warn('foo')
  25. expect('foo').toHaveBeenWarned()
  26. })
  27. it('should work when set to true', () => {
  28. Vue.config.silent = true
  29. Vue.util.warn('foo')
  30. expect('foo').not.toHaveBeenWarned()
  31. Vue.config.silent = false
  32. })
  33. })
  34. })