@webitel/ui-sdk 2.1.48 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/ui-sdk.common.js +10504 -17728
  2. package/dist/ui-sdk.common.js.map +1 -1
  3. package/dist/ui-sdk.css +1 -1
  4. package/dist/ui-sdk.umd.js +10459 -17683
  5. package/dist/ui-sdk.umd.js.map +1 -1
  6. package/dist/ui-sdk.umd.min.js +4 -6
  7. package/dist/ui-sdk.umd.min.js.map +1 -1
  8. package/package.json +24 -15
  9. package/src/components/atoms/wt-button/__tests__/WtButton.spec.js +1 -1
  10. package/src/components/atoms/wt-context-menu/__tests__/WtContextMenu.spec.js +1 -1
  11. package/src/components/atoms/wt-icon/__tests__/WtIcon.spec.js +2 -2
  12. package/src/components/atoms/wt-indicator/__tests__/WtIndicator.spec.js +2 -2
  13. package/src/components/atoms/wt-rounded-action/__tests__/WtRoundedAction.spec.js +1 -1
  14. package/src/components/atoms/wt-tooltip/__tests__/WtTooltip.spec.js +1 -1
  15. package/src/components/index.js +0 -4
  16. package/src/components/molecules/wt-checkbox/__tests__/WtCheckbox.spec.js +2 -2
  17. package/src/components/molecules/wt-datepicker/__tests__/WtDatepicker.spec.js +1 -1
  18. package/src/components/molecules/wt-datetimepicker/__tests__/WtDatetimepicker.spec.js +20 -17
  19. package/src/components/molecules/wt-icon-btn/__tests__/WtIconBtn.spec.js +1 -1
  20. package/src/components/molecules/wt-icon-btn/wt-icon-btn.vue +3 -0
  21. package/src/components/molecules/wt-input/__tests__/WtInput.spec.js +1 -1
  22. package/src/components/molecules/wt-input/wt-input.vue +6 -13
  23. package/src/components/molecules/wt-progress-bar/__tests__/WtProgressBar.spec.js +2 -2
  24. package/src/components/molecules/wt-radio/__tests__/WtRadio.spec.js +2 -2
  25. package/src/components/molecules/wt-select/__tests__/WtSelect.spec.js +1 -1
  26. package/src/components/molecules/wt-select/mixins/__tests__/multiselectMixin.spec.js +2 -2
  27. package/src/components/molecules/wt-select/mixins/multiselectMixin.js +1 -1
  28. package/src/components/molecules/wt-select/wt-select.vue +5 -5
  29. package/src/components/molecules/wt-switcher/__tests__/WtSwitcher.spec.js +2 -2
  30. package/src/components/molecules/wt-tabs/__tests__/WtTabs.spec.js +3 -3
  31. package/src/components/molecules/wt-tags-input/__tests__/WtTagsInput.spec.js +3 -3
  32. package/src/components/molecules/wt-tags-input/wt-tags-input.vue +1 -1
  33. package/src/components/molecules/wt-textarea/__tests__/WtTextarea.spec.js +2 -2
  34. package/src/components/molecules/wt-time-input/__tests__/WtTimeInput.spec.js +1 -1
  35. package/src/components/molecules/wt-timepicker/__tests__/WtTimepicker.spec.js +4 -4
  36. package/src/components/organisms/wt-app-header/__tests__/WtAppNavigator.spec.js +1 -1
  37. package/src/components/organisms/wt-app-header/__tests__/WtHeaderActions.spec.js +1 -1
  38. package/src/components/organisms/wt-error-page/__tests__/wt-error-page.spec.js +3 -3
  39. package/src/components/organisms/wt-headline-nav/__tests__/wt-headline-nav.spec.js +1 -1
  40. package/src/components/organisms/wt-navigation-bar/__tests__/WtNavigationBar.spec.js +20 -16
  41. package/src/components/organisms/wt-notifications-bar/wt-notifications-bar.vue +1 -0
  42. package/src/components/organisms/wt-status-select/wt-status-select.vue +2 -2
  43. package/src/components/organisms/wt-table/__tests__/WtTable.spec.js +7 -7
  44. package/src/components/organisms/wt-table-column-select/__tests__/WtTableColumnSelect.spec.js +3 -3
  45. package/src/components/transitions/wt-expand-transition.vue +41 -39
  46. package/src/css/components/molecules/wt-select/_multiselect.scss +1 -1
  47. package/src/locale/i18n.js +3 -5
  48. package/src/mixins/dataFilterMixins/__tests__/apiFilterMixin.spec.js +8 -8
  49. package/src/mixins/dataFilterMixins/__tests__/enumFilterMixin.spec.js +15 -11
  50. package/src/mixins/dataFilterMixins/__tests__/sortFilterMixin.spec.js +7 -10
  51. package/src/mixins/dataFilterMixins/__tests__/urlControllerMixin.spec.js +9 -9
  52. package/src/mixins/validationMixin/__tests__/validationMixin.spec.js +3 -3
  53. package/src/modules/QueryFilters/components/__tests__/abstract-api-filter.spec.js +1 -1
  54. package/src/modules/QueryFilters/components/__tests__/abstract-enum-filter.spec.js +1 -1
  55. package/src/modules/QueryFilters/components/__tests__/filter-datetime.spec.js +1 -1
  56. package/src/modules/QueryFilters/components/__tests__/filter-from-to.spec.js +1 -1
  57. package/src/modules/QueryFilters/components/__tests__/filter-search.spec.js +1 -1
  58. package/src/modules/Userinfo/components/__tests__/auth.spec.js +11 -12
  59. package/src/plugins/breakpoint/breakpoint.plugin.js +3 -2
  60. package/src/scripts/eventBus.js +7 -3
@@ -1,5 +1,5 @@
1
- import { shallowMount, createLocalVue } from '@vue/test-utils';
2
- import VueRouter from 'vue-router';
1
+ import { shallowMount, mount } from '@vue/test-utils';
2
+ import { createRouter, createWebHistory } from 'vue-router';
3
3
  import WtNavigationBar from '../wt-navigation-bar.vue';
4
4
 
5
5
  const nav = [
@@ -13,9 +13,10 @@ const nav = [
13
13
  },
14
14
  ];
15
15
 
16
- const localVue = createLocalVue();
17
- localVue.use(VueRouter);
18
- const router = new VueRouter();
16
+ const router = createRouter({
17
+ history: createWebHistory(),
18
+ routes: [],
19
+ });
19
20
 
20
21
  describe('WtNavigationBar', () => {
21
22
  it('renders a component', () => {
@@ -25,19 +26,21 @@ describe('WtNavigationBar', () => {
25
26
 
26
27
  it('renders navigation links', () => {
27
28
  const wrapper = shallowMount(WtNavigationBar, {
28
- localVue,
29
- router,
30
- propsData: { nav },
29
+ global: {
30
+ plugins: [router],
31
+ },
32
+ props: { nav },
31
33
  });
32
34
  const navLinksLen = nav.filter((nav) => !nav.subNav).length;
33
35
  expect(wrapper.findAll('.wt-navigation-bar__nav-item-link').length).toBe(navLinksLen);
34
36
  });
35
37
 
36
38
  it('renders navigation expansions with subNav inside it', async () => {
37
- const wrapper = shallowMount(WtNavigationBar, {
38
- localVue,
39
- router,
40
- propsData: { nav },
39
+ const wrapper = mount(WtNavigationBar, {
40
+ global: {
41
+ plugins: [router],
42
+ },
43
+ props: { nav },
41
44
  });
42
45
  wrapper.find('.wt-navigation-bar__nav-expansion').trigger('click');
43
46
  await wrapper.vm.$nextTick();
@@ -51,10 +54,11 @@ describe('WtNavigationBar', () => {
51
54
  });
52
55
 
53
56
  it('correctly computes subNav nested routes', async () => {
54
- const wrapper = shallowMount(WtNavigationBar, {
55
- localVue,
56
- router,
57
- propsData: { nav },
57
+ const wrapper = mount(WtNavigationBar, {
58
+ global: {
59
+ plugins: [router],
60
+ },
61
+ props: { nav },
58
62
  });
59
63
  wrapper.find('.wt-navigation-bar__nav-expansion').trigger('click');
60
64
  await wrapper.vm.$nextTick();
@@ -15,6 +15,7 @@
15
15
  <script>
16
16
  export default {
17
17
  name: 'wt-notifications-bar',
18
+ inject: ['$eventBus'],
18
19
  data: () => ({
19
20
  notificationDuration: 4000,
20
21
  notifications: [],
@@ -8,13 +8,13 @@
8
8
  :searchable="false"
9
9
  @input="inputHandler"
10
10
  >
11
- <template slot="singleLabel" slot-scope="{ option }">
11
+ <template v-slot:singleLabel="{ option }">
12
12
  <wt-indicator
13
13
  :color="option.color"
14
14
  :text="duration"
15
15
  ></wt-indicator>
16
16
  </template>
17
- <template slot="option" slot-scope="{ option }">
17
+ <template v-slot:option="{ option }">
18
18
  <wt-indicator
19
19
  :color="option.color"
20
20
  :text="option.text"
@@ -51,7 +51,7 @@ describe('WtTable', () => {
51
51
 
52
52
  it('renders table data rows', () => {
53
53
  const wrapper = shallowMount(WtTable, {
54
- propsData: {
54
+ props: {
55
55
  headers,
56
56
  data,
57
57
  },
@@ -61,7 +61,7 @@ describe('WtTable', () => {
61
61
 
62
62
  it('renders table headers', () => {
63
63
  const wrapper = shallowMount(WtTable, {
64
- propsData: {
64
+ props: {
65
65
  headers,
66
66
  data,
67
67
  selectable: false,
@@ -73,7 +73,7 @@ describe('WtTable', () => {
73
73
 
74
74
  it('do not renders table footer by default', () => {
75
75
  const wrapper = shallowMount(WtTable, {
76
- propsData: {
76
+ props: {
77
77
  headers,
78
78
  data,
79
79
  },
@@ -83,7 +83,7 @@ describe('WtTable', () => {
83
83
 
84
84
  it('renders table footer if footer slot is passed', () => {
85
85
  const wrapper = shallowMount(WtTable, {
86
- propsData: {
86
+ props: {
87
87
  headers,
88
88
  data,
89
89
  },
@@ -96,7 +96,7 @@ describe('WtTable', () => {
96
96
 
97
97
  it('emits sort event at header click when sortable is true', () => {
98
98
  const wrapper = shallowMount(WtTable, {
99
- propsData: {
99
+ props: {
100
100
  headers,
101
101
  data,
102
102
  sortable: true,
@@ -109,7 +109,7 @@ describe('WtTable', () => {
109
109
  it('draws sort arrow, if a column is sorted', () => {
110
110
  headers[0].sort = 'asc';
111
111
  const wrapper = shallowMount(WtTable, {
112
- propsData: {
112
+ props: {
113
113
  headers,
114
114
  data,
115
115
  sortable: true,
@@ -122,7 +122,7 @@ describe('WtTable', () => {
122
122
 
123
123
  it('selects all rows at header checkbox click', async () => {
124
124
  const wrapper = shallowMount(WtTable, {
125
- propsData: {
125
+ props: {
126
126
  headers,
127
127
  data,
128
128
  selectable: true,
@@ -4,7 +4,7 @@ import WtTableColumnSelect from '../wt-table-column-select.vue';
4
4
  describe('WtTableColumnSelect', () => {
5
5
  it('renders a component', () => {
6
6
  const wrapper = shallowMount(WtTableColumnSelect, {
7
- propsData: {
7
+ props: {
8
8
  headers: [],
9
9
  },
10
10
  });
@@ -12,7 +12,7 @@ describe('WtTableColumnSelect', () => {
12
12
  });
13
13
  it('column select popup is invisible by default', () => {
14
14
  const wrapper = shallowMount(WtTableColumnSelect, {
15
- propsData: {
15
+ props: {
16
16
  headers: [],
17
17
  },
18
18
  });
@@ -20,7 +20,7 @@ describe('WtTableColumnSelect', () => {
20
20
  });
21
21
  it('column select popup is opening by icon-btn click', async () => {
22
22
  const wrapper = mount(WtTableColumnSelect, {
23
- propsData: {
23
+ props: {
24
24
  headers: [],
25
25
  },
26
26
  });
@@ -1,51 +1,53 @@
1
+ <template>
2
+ <transition
3
+ name="expand"
4
+ @after-enter="afterEnter"
5
+ @enter="enter"
6
+ @leave="leave"
7
+ >
8
+ <slot></slot>
9
+ </transition>
10
+ </template>
11
+
1
12
  <script>
2
13
  /* eslint-disable no-param-reassign */
3
14
  // https://markus.oberlehner.net/blog/transition-to-height-auto-with-vue/
4
15
  export default {
5
16
  name: 'wt-expand-transition',
6
- functional: true,
7
- render(createElement, context) {
8
- const data = {
9
- props: {
10
- name: 'expand',
11
- },
12
- on: {
13
- afterEnter(element) {
14
- element.style.height = 'auto';
15
- },
16
- enter(element) {
17
- const { width } = getComputedStyle(element);
18
- element.style.width = width;
19
- element.style.position = 'absolute';
20
- element.style.visibility = 'hidden';
21
- element.style.height = 'auto';
17
+ methods: {
18
+ afterEnter(element) {
19
+ element.style.height = 'auto';
20
+ },
21
+ enter(element) {
22
+ const { width } = getComputedStyle(element);
23
+ element.style.width = width;
24
+ element.style.position = 'absolute';
25
+ element.style.visibility = 'hidden';
26
+ element.style.height = 'auto';
22
27
 
23
- const { height } = getComputedStyle(element);
24
- element.style.width = null;
25
- element.style.position = null;
26
- element.style.visibility = null;
27
- element.style.height = 0;
28
+ const { height } = getComputedStyle(element);
29
+ element.style.width = null;
30
+ element.style.position = null;
31
+ element.style.visibility = null;
32
+ element.style.height = 0;
28
33
 
29
- // Force repaint to make sure the
30
- // animation is triggered correctly.
31
- // eslint-disable-next-line no-unused-expressions
32
- getComputedStyle(element).height;
34
+ // Force repaint to make sure the
35
+ // animation is triggered correctly.
36
+ // eslint-disable-next-line no-unused-expressions
37
+ getComputedStyle(element).height;
33
38
 
34
- // eslint-disable-next-line no-return-assign
35
- requestAnimationFrame(() => element.style.height = height);
36
- },
37
- leave(element) {
38
- const { height } = getComputedStyle(element);
39
- element.style.height = height;
40
- // eslint-disable-next-line no-unused-expressions
41
- getComputedStyle(element).height;
39
+ // eslint-disable-next-line no-return-assign
40
+ requestAnimationFrame(() => element.style.height = height);
41
+ },
42
+ leave(element) {
43
+ const { height } = getComputedStyle(element);
44
+ element.style.height = height;
45
+ // eslint-disable-next-line no-unused-expressions
46
+ getComputedStyle(element).height;
42
47
 
43
- // eslint-disable-next-line no-return-assign
44
- requestAnimationFrame(() => element.style.height = 0);
45
- },
46
- },
47
- };
48
- return createElement('transition', data, context.children);
48
+ // eslint-disable-next-line no-return-assign
49
+ requestAnimationFrame(() => element.style.height = 0);
50
+ },
49
51
  },
50
52
  };
51
53
  </script>
@@ -1,4 +1,4 @@
1
- @import '~vue-multiselect/dist/vue-multiselect.min.css';
1
+ @import '~vue-multiselect/dist/vue3-multiselect.css';
2
2
 
3
3
  .multiselect ::v-deep {
4
4
  cursor: pointer;
@@ -1,18 +1,16 @@
1
- import Vue from 'vue';
2
- import VueI18n from 'vue-i18n';
1
+ import { createI18n } from 'vue-i18n';
3
2
  import en from './en/en';
4
3
  import ru from './ru/ru';
5
4
  import ua from './ua/ua';
6
5
 
7
- Vue.use(VueI18n);
8
-
9
6
  const messages = {
10
7
  en,
11
8
  ru,
12
9
  ua,
13
10
  };
14
11
 
15
- export default new VueI18n({
12
+ // eslint-disable-next-line new-cap
13
+ export default new createI18n({
16
14
  locale: 'en',
17
15
  fallbackLocale: 'en',
18
16
  messages,
@@ -1,10 +1,11 @@
1
- import { createLocalVue, shallowMount } from '@vue/test-utils';
2
- import VueRouter from 'vue-router';
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import { createRouter, createWebHistory } from 'vue-router';
3
3
  import apiFilterMixin from '../apiFilterMixin';
4
4
 
5
- const localVue = createLocalVue();
6
- localVue.use(VueRouter);
7
- const router = new VueRouter();
5
+ const router = new createRouter({
6
+ history: createWebHistory(),
7
+ routes: [],
8
+ });
8
9
  const team = ['1', '2'];
9
10
 
10
11
  describe('API filter mixin', () => {
@@ -18,14 +19,13 @@ describe('API filter mixin', () => {
18
19
  };
19
20
 
20
21
  beforeEach(() => {
21
- if (Object.keys(router.currentRoute.query).length) router.replace({ query: null });
22
+ if (Object.keys(router.currentRoute.value.query).length) router.replace({ query: null });
22
23
  });
23
24
 
24
25
  it('Correctly sets value from $route query', async () => {
25
26
  await router.replace({ query: { team } });
26
27
  wrapper = shallowMount(Component, {
27
- localVue,
28
- router,
28
+ plugins: [router],
29
29
  });
30
30
  await wrapper.vm.$nextTick();
31
31
  expect(wrapper.vm.value).toEqual(team);
@@ -1,5 +1,5 @@
1
- import { createLocalVue, shallowMount } from '@vue/test-utils';
2
- import VueRouter from 'vue-router';
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import { createRouter, createWebHistory } from 'vue-router';
3
3
  import enumFilterMixin from '../enumFilterMixin';
4
4
 
5
5
  const options = [{
@@ -11,9 +11,10 @@ const options = [{
11
11
  value: 'outbound',
12
12
  }];
13
13
 
14
- const localVue = createLocalVue();
15
- localVue.use(VueRouter);
16
- const router = new VueRouter();
14
+ const router = createRouter({
15
+ history: createWebHistory(),
16
+ routes: [],
17
+ });
17
18
 
18
19
  describe('Enum filter mixin', () => {
19
20
  let wrapper;
@@ -34,8 +35,9 @@ describe('Enum filter mixin', () => {
34
35
  it('Correctly sets value from $route query', async () => {
35
36
  await router.replace({ query: { type: [options[0].value] } });
36
37
  wrapper = shallowMount(Component, {
37
- localVue,
38
- router,
38
+ global: {
39
+ plugins: [router],
40
+ },
39
41
  });
40
42
  await wrapper.vm.$nextTick();
41
43
  expect(wrapper.vm.value).toEqual([options[0]]);
@@ -44,8 +46,9 @@ describe('Enum filter mixin', () => {
44
46
  it('Correctly sets single value from $route query', async () => {
45
47
  await router.replace({ query: { type: options[0].value } });
46
48
  wrapper = shallowMount(Component, {
47
- localVue,
48
- router,
49
+ global: {
50
+ plugins: [router],
51
+ },
49
52
  });
50
53
  await wrapper.vm.$nextTick();
51
54
  expect(wrapper.vm.value).toEqual(options[0]);
@@ -54,8 +57,9 @@ describe('Enum filter mixin', () => {
54
57
  it('Resets value after $route query reset', async () => {
55
58
  await router.replace({ query: { type: [options[0].value] } });
56
59
  wrapper = shallowMount(Component, {
57
- localVue,
58
- router,
60
+ global: {
61
+ plugins: [router],
62
+ },
59
63
  });
60
64
  await wrapper.vm.$nextTick();
61
65
  expect(wrapper.vm.value).toEqual([options[0]]);
@@ -1,10 +1,11 @@
1
- import { shallowMount, createLocalVue } from '@vue/test-utils';
2
- import VueRouter from 'vue-router';
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import { createRouter, createWebHistory } from 'vue-router';
3
3
  import sortFilterMixin from '../sortFilterMixin';
4
4
 
5
- const localVue = createLocalVue();
6
- localVue.use(VueRouter);
7
- const router = new VueRouter();
5
+ const router = createRouter({
6
+ history: createWebHistory(),
7
+ routes: [],
8
+ });
8
9
 
9
10
  const headers = [{
10
11
  value: 'queue',
@@ -18,8 +19,6 @@ const headers = [{
18
19
  field: 'online',
19
20
  }];
20
21
 
21
- const $t = () => {};
22
-
23
22
  describe('Sort filter mixin', () => {
24
23
  let wrapper;
25
24
  const Component = {
@@ -31,9 +30,7 @@ describe('Sort filter mixin', () => {
31
30
  beforeEach(() => {
32
31
  router.replace('/');
33
32
  wrapper = shallowMount(Component, {
34
- localVue,
35
- router,
36
- mocks: { $t },
33
+ global: { plugins: [router] },
37
34
  });
38
35
  });
39
36
 
@@ -1,12 +1,12 @@
1
- import { shallowMount, createLocalVue } from '@vue/test-utils';
2
- import VueRouter from 'vue-router';
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import { createRouter, createWebHistory } from 'vue-router';
3
3
  import _urlControllerMixin from '../_urlControllerMixin/_urlControllerMixin';
4
4
 
5
- const localVue = createLocalVue();
6
- localVue.use(VueRouter);
7
- const router = new VueRouter();
5
+ const router = createRouter({
6
+ history: createWebHistory(),
7
+ routes: [],
8
+ });
8
9
 
9
- const $t = () => {};
10
10
  const filterQuery = 'team';
11
11
 
12
12
  describe('URL Controller mixin Set and Get operations', () => {
@@ -19,9 +19,9 @@ describe('URL Controller mixin Set and Get operations', () => {
19
19
  beforeEach(() => {
20
20
  router.replace('/');
21
21
  wrapper = shallowMount(Component, {
22
- localVue,
23
- router,
24
- mocks: { $t },
22
+ global: {
23
+ plugins: [router],
24
+ },
25
25
  });
26
26
  });
27
27
 
@@ -11,7 +11,7 @@ describe('Validation mixin', () => {
11
11
 
12
12
  it('detects validation prop', () => {
13
13
  wrapper = shallowMount(Component, {
14
- propsData: {
14
+ props: {
15
15
  v: {
16
16
  $error: true,
17
17
  },
@@ -23,7 +23,7 @@ describe('Validation mixin', () => {
23
23
 
24
24
  it('computes error message on validation error', () => {
25
25
  wrapper = shallowMount(Component, {
26
- propsData: {
26
+ props: {
27
27
  v: {
28
28
  $error: true,
29
29
  email: false,
@@ -35,7 +35,7 @@ describe('Validation mixin', () => {
35
35
 
36
36
  it('prioritizes error messages', () => {
37
37
  wrapper = shallowMount(Component, {
38
- propsData: {
38
+ props: {
39
39
  v: {
40
40
  $error: true,
41
41
  required: false,
@@ -32,7 +32,7 @@ describe('Abstract Api Filter', () => {
32
32
  localVue,
33
33
  store,
34
34
  router,
35
- propsData: {
35
+ props: {
36
36
  namespace,
37
37
  filterQuery,
38
38
  },
@@ -28,7 +28,7 @@ describe('Abstract Enum Filter', () => {
28
28
  localVue,
29
29
  store,
30
30
  router,
31
- propsData: {
31
+ props: {
32
32
  namespace,
33
33
  filterQuery,
34
34
  },
@@ -29,7 +29,7 @@ describe('DatetimeFilter Filter', () => {
29
29
  localVue,
30
30
  store,
31
31
  router,
32
- propsData: {
32
+ props: {
33
33
  namespace,
34
34
  filterQuery,
35
35
  },
@@ -29,7 +29,7 @@ describe('FilterFromTo Filter', () => {
29
29
  localVue,
30
30
  store,
31
31
  router,
32
- propsData: {
32
+ props: {
33
33
  namespace,
34
34
  filterQuery,
35
35
  },
@@ -29,7 +29,7 @@ describe('Search Filter', () => {
29
29
  localVue,
30
30
  store,
31
31
  router,
32
- propsData: {
32
+ props: {
33
33
  namespace,
34
34
  filterQuery,
35
35
  },
@@ -1,6 +1,6 @@
1
- import { shallowMount, createLocalVue } from '@vue/test-utils';
2
- import Vuex from 'vuex';
3
- import VueRouter from 'vue-router';
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import { createStore } from 'vuex';
3
+ import { createRouter, createWebHistory } from 'vue-router';
4
4
  import JSDOM from 'jsdom';
5
5
  import authAPI from '../../api/auth';
6
6
  import userinfoAPI from '../../api/userinfo';
@@ -11,10 +11,6 @@ import '../../../../../tests/mocks/localStorageMock';
11
11
 
12
12
  localStorage.setItem('access-token', 'jest');
13
13
 
14
- const localVue = createLocalVue();
15
- localVue.use(Vuex);
16
- localVue.use(VueRouter);
17
-
18
14
  authAPI.setToken = jest.fn();
19
15
  userinfoAPI.getSession = jest.fn(() => ({}));
20
16
  userinfoAPI.getApplicationsAccess = jest.fn(() => ({}));
@@ -23,19 +19,22 @@ describe('Auth', () => {
23
19
  let store;
24
20
  let wrapper;
25
21
  global.window = new JSDOM.JSDOM().window;
26
- const router = new VueRouter();
22
+ const router = createRouter({
23
+ history: createWebHistory(),
24
+ routes: [],
25
+ });
27
26
  router.replace = jest.fn();
28
27
 
29
28
  const userinfo = new UserinfoStoreModule().getModule();
30
29
  beforeEach(() => {
31
- store = new Vuex.Store({
30
+ store = createStore({
32
31
  modules: { userinfo },
33
32
  });
34
33
 
35
34
  wrapper = shallowMount(Auth, {
36
- localVue,
37
- store,
38
- router,
35
+ global: {
36
+ plugins: [router, store],
37
+ },
39
38
  });
40
39
  });
41
40
 
@@ -1,3 +1,4 @@
1
+ import { reactive } from 'vue';
1
2
  import debounce from '../../scripts/debounce';
2
3
 
3
4
  // https://stackoverflow.com/questions/41791193/vuejs-reactive-binding-for-a-plugin-how-to/41801107#41801107
@@ -124,13 +125,13 @@ const onResize = () => {
124
125
  breakpoint.mobile = current <= max;
125
126
  };
126
127
 
127
- const install = (Vue) => {
128
+ const install = (app) => {
128
129
  window.addEventListener('resize', debounce(onResize), { passive: true });
129
130
 
130
131
  onResize();
131
132
 
132
133
  // eslint-disable-next-line no-param-reassign
133
- Vue.prototype.$breakpoint = Vue.observable(breakpoint);
134
+ app.config.globalProperties.$breakpoint = reactive(breakpoint);
134
135
  };
135
136
 
136
137
  export { install };
@@ -1,4 +1,8 @@
1
- import Vue from 'vue';
1
+ import emitter from 'tiny-emitter/instance';
2
2
 
3
- const eventBus = new Vue();
4
- export default eventBus;
3
+ export default {
4
+ $on: (...args) => emitter.on(...args),
5
+ $once: (...args) => emitter.once(...args),
6
+ $off: (...args) => emitter.off(...args),
7
+ $emit: (...args) => emitter.emit(...args),
8
+ }