global-config.spec.js 1.1 KB

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