name.spec.js 892 B

12345678910111213141516171819202122232425262728293031
  1. import Vue from 'vue'
  2. describe('Options name', () => {
  3. it('should contain itself in self components', () => {
  4. const vm = Vue.extend({
  5. name: 'SuperVue'
  6. })
  7. expect(vm.options.components['SuperVue']).toEqual(vm)
  8. })
  9. it('should warn when incorrect name given', () => {
  10. Vue.extend({
  11. name: 'Hyper*Vue'
  12. })
  13. /* eslint-disable */
  14. expect(`Invalid component name: "Hyper*Vue". Component names can only contain alphanumeric characaters and the hyphen.`)
  15. .toHaveBeenWarned()
  16. /* eslint-enable */
  17. })
  18. it('id should not override given name when using Vue.component', () => {
  19. const SuperComponent = Vue.component('super-component', {
  20. name: 'SuperVue'
  21. })
  22. expect(SuperComponent.options.components['SuperVue']).toEqual(SuperComponent)
  23. expect(SuperComponent.options.components['super-component']).toEqual(SuperComponent)
  24. })
  25. })