@webitel/ui-sdk 23.12.24 → 23.12.26

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "23.12.24",
3
+ "version": "23.12.26",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "build": "vue-cli-service build --target lib --name ui-sdk ./src/install.js",
@@ -257,6 +257,7 @@ export default {
257
257
  searchBar: {
258
258
  placeholder: 'Search',
259
259
  settingsHint: 'Search mode',
260
+ variableSearchHint: 'Query format: "key=value"',
260
261
  },
261
262
  timepicker: {
262
263
  hour: 'Hour:',
@@ -339,8 +340,7 @@ export default {
339
340
  },
340
341
  deleteConfirmationPopup: {
341
342
  title: 'Confirm deletion',
342
- askingAlert: 'Are you sure you want to delete {count} item? | Are you sure you want to delete {count} items?',
343
- undoneActionAlert: 'This action cannot be undone.',
343
+ askingAlert: 'Are you sure you want\n to delete {count} records? | Are you sure you want\n to delete {count} records?',
344
344
  deleteAll: 'ALL',
345
345
  },
346
346
  dummy: {
@@ -255,6 +255,7 @@ export default {
255
255
  searchBar: {
256
256
  placeholder: 'Поиск',
257
257
  settingsHint: 'Настройки поиска',
258
+ variableSearchHint: 'Формат запроса: "ключ=значение"',
258
259
  },
259
260
  timepicker: {
260
261
  hour: 'Час:',
@@ -337,8 +338,7 @@ export default {
337
338
  },
338
339
  deleteConfirmationPopup: {
339
340
  title: 'Подтвердите удаление',
340
- askingAlert: 'Вы уверенны, что хотите удалить {count} запись? | Вы уверенны, что хотите удалить {count} записей?',
341
- undoneActionAlert: 'Это действие не может быть отменено.',
341
+ askingAlert: 'Вы уверенны, что хотите\n удалить {count} запись? | Вы уверенны, что хотите\n удалить {count} записей?',
342
342
  deleteAll: 'ВСЕ',
343
343
  },
344
344
  dummy: {
@@ -255,6 +255,7 @@ export default {
255
255
  searchBar: {
256
256
  placeholder: 'Пошук',
257
257
  settingsHint: 'Налаштування пошуку',
258
+ variableSearchHint: 'Формат запиту: "ключ=значення"',
258
259
  },
259
260
  timepicker: {
260
261
  hour: 'Год:',
@@ -337,8 +338,7 @@ export default {
337
338
  },
338
339
  deleteConfirmationPopup: {
339
340
  title: 'Підтвердіть видалення',
340
- askingAlert: 'Ви впевнені, що хочете видалити {count} запис? | Ви впевнені, що хочете видалити {count} записів?',
341
- undoneActionAlert: 'Дана дія не може бути скасована.',
341
+ askingAlert: 'Ви впевнені, що хочете\n видалити {count} запис? | Ви впевнені, що хочете\n видалити {count} записів?',
342
342
  deleteAll: 'ВСІ',
343
343
  },
344
344
  dummy: {
@@ -30,7 +30,7 @@ describe('Validation mixin', () => {
30
30
  },
31
31
  },
32
32
  });
33
- expect(wrapper.vm.validationText).toBe('validation.email');
33
+ expect(wrapper.vm.validationText).toBe('Should look like email');
34
34
  });
35
35
 
36
36
  it('prioritizes error messages', () => {
@@ -42,6 +42,6 @@ describe('Validation mixin', () => {
42
42
  },
43
43
  },
44
44
  });
45
- expect(wrapper.vm.validationText).toBe('validation.required');
45
+ expect(wrapper.vm.validationText).toBe('Field is required');
46
46
  });
47
47
  });
@@ -0,0 +1,77 @@
1
+ import { mount, shallowMount } from '@vue/test-utils';
2
+ import { ref } from 'vue';
3
+ import { useValidation } from '../../../mixins/validationMixin/useValidation';
4
+ import DeleteConfirmationPopup from '../components/delete-confirmation-popup.vue';
5
+
6
+ jest.mock('../../../mixins/validationMixin/useValidation');
7
+
8
+ useValidation.mockImplementation(() => ({
9
+ isValidation: ref(false),
10
+ invalid: ref(false),
11
+ validationText: ref(''),
12
+ }));
13
+
14
+ describe('DeleteConfirmationPopup', () => {
15
+ it('renders a component', () => {
16
+ const wrapper = shallowMount(DeleteConfirmationPopup, {
17
+ props: {
18
+ deleteCount: 1,
19
+ callback: jest.fn(),
20
+ },
21
+ });
22
+ expect(wrapper.classes('delete-confirmation-popup')).toBe(true);
23
+ });
24
+
25
+ it('yes button called props callback', async () => {
26
+ const callback = jest.fn();
27
+ const wrapper = mount(DeleteConfirmationPopup, {
28
+ props: {
29
+ deleteCount: 1,
30
+ callback,
31
+ },
32
+ });
33
+ const button = wrapper.findAllComponents({ name: 'wt-button' }).find((btn) => btn.text().includes('Yes'));
34
+ expect(button.text()).toContain('Yes');
35
+ await button.trigger('click');
36
+ await wrapper.vm.$nextTick();
37
+ expect(callback).toHaveBeenCalled();
38
+ });
39
+
40
+ it('popup message block have delete count', () => {
41
+ const deleteCount = 123;
42
+ const wrapper = mount(DeleteConfirmationPopup, {
43
+ props: {
44
+ deleteCount,
45
+ callback: jest.fn(),
46
+ },
47
+ });
48
+ expect(wrapper.find('.delete-confirmation-popup__content').text())
49
+ .toContain(deleteCount.toString());
50
+ });
51
+
52
+ it('yes button emitted close', async () => {
53
+ const wrapper = mount(DeleteConfirmationPopup, {
54
+ props: {
55
+ deleteCount: 1,
56
+ callback: jest.fn(),
57
+ },
58
+ });
59
+ const button = wrapper.findAllComponents({ name: 'wt-button' }).find((btn) => btn.text().includes('Yes'));
60
+ await button.vm.$emit('close');
61
+ await wrapper.vm.$nextTick();
62
+ expect(button.emitted('close')).toBeTruthy();
63
+ });
64
+
65
+ it('no button emitted close', async () => {
66
+ const wrapper = mount(DeleteConfirmationPopup, {
67
+ props: {
68
+ deleteCount: 1,
69
+ callback: jest.fn(),
70
+ },
71
+ });
72
+ const button = wrapper.findAllComponents({ name: 'wt-button' }).find((btn) => btn.text().includes('No'));
73
+ await button.vm.$emit('close');
74
+ await wrapper.vm.$nextTick();
75
+ expect(button.emitted('close')).toBeTruthy();
76
+ });
77
+ });
@@ -1,28 +1,29 @@
1
1
  <template>
2
2
  <wt-popup
3
3
  class="delete-confirmation-popup"
4
- min-width="480"
4
+ width="500"
5
5
  @close="close"
6
6
  >
7
7
  <template v-slot:title>{{ $t('webitelUI.deleteConfirmationPopup.title') }}</template>
8
8
  <template v-slot:main>
9
- <p>
10
- {{ deleteMessage }}
11
- {{ $t('webitelUI.deleteConfirmationPopup.undoneActionAlert') }}
12
- </p>
9
+ <div class="delete-confirmation-popup__content">
10
+ <wt-icon icon="attention" color="error"/>
11
+ <p class="delete-confirmation-popup__message">
12
+ {{ deleteMessage }}
13
+ </p>
14
+ </div>
13
15
  </template>
14
16
  <template v-slot:actions>
15
17
  <wt-button
16
- color="secondary"
17
- :disabled="isDeleting"
18
- @click="close"
19
- >{{ $t('reusable.cancel') }}
20
- </wt-button>
21
- <wt-button
22
- color="danger"
23
18
  :loading="isDeleting"
24
19
  @click="confirm"
25
- >{{ $t('reusable.delete') }}
20
+ >{{ $t('vocabulary.yes') }}
21
+ </wt-button>
22
+ <wt-button
23
+ :disabled="isDeleting"
24
+ color="secondary"
25
+ @click="close"
26
+ >{{ $t('vocabulary.no') }}
26
27
  </wt-button>
27
28
  </template>
28
29
  </wt-popup>
@@ -44,7 +45,7 @@ const props = defineProps({
44
45
  });
45
46
 
46
47
  const emit = defineEmits([
47
- 'close',
48
+ 'close',
48
49
  ]);
49
50
 
50
51
  const { t } = useI18n();
@@ -83,5 +84,15 @@ async function confirm() {
83
84
  </script>
84
85
 
85
86
  <style scoped>
87
+ .delete-confirmation-popup__content {
88
+ display: flex;
89
+ flex-direction: column;
90
+ align-items: center;
91
+ gap: var(--spacing-sm);
92
+ }
93
+
94
+ .delete-confirmation-popup__message {
95
+ text-align: center;
96
+ }
86
97
 
87
98
  </style>
@@ -12,7 +12,9 @@ const router = createRouter({
12
12
  describe('Abstract Api Filter', () => {
13
13
  const namespace = 'jest';
14
14
  const filterQuery = 'jest';
15
- const filterSchema = new ApiFilterSchema({ locale: {} });
15
+ const filterSchema = new ApiFilterSchema({
16
+ locale: { label: '' }
17
+ });
16
18
  const searchMock = jest.fn();
17
19
  const fetchSelectedMock = jest.fn(() => ({ items: [] }));
18
20
  jest.spyOn(filterSchema, 'search').mockImplementation(searchMock);
@@ -12,7 +12,9 @@ const router = createRouter({
12
12
  describe('Abstract Enum Filter', () => {
13
13
  const namespace = 'jest';
14
14
  const filterQuery = 'jest';
15
- const filterSchema = new EnumFilterSchema({ locale: {} });
15
+ const filterSchema = new EnumFilterSchema({
16
+ locale: { label: ''}
17
+ });
16
18
  const store = createStore({
17
19
  modules: {
18
20
  [namespace]: {
@@ -0,0 +1,4 @@
1
+ export default function variableSearchValidator(value) {
2
+ const isValid = /^(?!.*\s)[^\s=]+=[^\s=]+$/.test(value);
3
+ return !value || isValid;
4
+ };