BigW Consortium Gitlab

user_avatar_svg_spec.js 862 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
import Vue from 'vue';
import UserAvatarSvg from '~/vue_shared/components/user_avatar/user_avatar_svg.vue';
import avatarSvg from 'icons/_icon_random.svg';

const UserAvatarSvgComponent = Vue.extend(UserAvatarSvg);

describe('User Avatar Svg Component', function () {
  describe('Initialization', function () {
    beforeEach(function () {
      this.propsData = {
        size: 99,
        svg: avatarSvg,
      };

      this.userAvatarSvg = new UserAvatarSvgComponent({
        propsData: this.propsData,
      }).$mount();
    });

    it('should return a defined Vue component', function () {
      expect(this.userAvatarSvg).toBeDefined();
    });

    it('should have <svg> as a child element', function () {
      expect(this.userAvatarSvg.$el.tagName).toEqual('svg');
      expect(this.userAvatarSvg.$el.innerHTML).toContain('<path');
    });
  });
});