debug_spec.js 680 B

123456789101112131415161718192021222324252627282930
  1. var _ = require('src/util')
  2. var config = require('src/config')
  3. var warnPrefix = '[Vue warn]: '
  4. if (typeof console !== 'undefined') {
  5. describe('Util - Debug', function () {
  6. beforeEach(function () {
  7. spyOn(console, 'log')
  8. spyOn(console, 'warn')
  9. if (console.trace) {
  10. spyOn(console, 'trace')
  11. }
  12. })
  13. it('warn when silent is false', function () {
  14. config.silent = false
  15. _.warn('oops')
  16. expect(console.warn).toHaveBeenCalledWith(warnPrefix + 'oops')
  17. })
  18. it('not warn when silent is ture', function () {
  19. config.silent = true
  20. _.warn('oops')
  21. expect(console.warn).not.toHaveBeenCalled()
  22. })
  23. })
  24. }