@bethinkpl/design-system 33.0.3 → 33.0.4
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/dist/design-system.js +5487 -5495
- package/dist/design-system.js.map +1 -1
- package/lib/js/components/Form/Checkbox/Checkbox.spec.ts +20 -8
- package/lib/js/components/Form/Checkbox/Checkbox.stories.ts +2 -4
- package/lib/js/components/Form/CheckboxGroupField/CheckboxGroupField.stories.ts +1 -3
- package/lib/js/vue-custom.d.ts +7 -0
- package/package.json +2 -2
|
@@ -185,13 +185,17 @@ describe('Checkbox', () => {
|
|
|
185
185
|
});
|
|
186
186
|
|
|
187
187
|
describe('user interactions', () => {
|
|
188
|
-
it('should
|
|
188
|
+
it('should change to checked state when clicked from unchecked', async () => {
|
|
189
189
|
const wrapper = setup({ modelValue: CHECKBOX_VALUES.UNCHECKED });
|
|
190
190
|
|
|
191
191
|
await wrapper.find('label').trigger('click');
|
|
192
192
|
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
const checkboxRoot = wrapper.find('[role="checkbox"]');
|
|
194
|
+
const checkboxIndicator = wrapper.find('.ds-checkbox__indicator');
|
|
195
|
+
|
|
196
|
+
expect(checkboxRoot.attributes('data-state')).toBe('checked');
|
|
197
|
+
expect(checkboxRoot.attributes('aria-checked')).toBe('true');
|
|
198
|
+
expect(checkboxIndicator.attributes('data-state')).toBe('checked');
|
|
195
199
|
});
|
|
196
200
|
|
|
197
201
|
it('should toggle from checked to unchecked when clicked', async () => {
|
|
@@ -199,7 +203,9 @@ describe('Checkbox', () => {
|
|
|
199
203
|
|
|
200
204
|
await wrapper.find('label').trigger('click');
|
|
201
205
|
|
|
202
|
-
|
|
206
|
+
const checkboxRoot = wrapper.find('[role="checkbox"]');
|
|
207
|
+
expect(checkboxRoot.attributes('data-state')).toBe('unchecked');
|
|
208
|
+
expect(checkboxRoot.attributes('aria-checked')).toBe('false');
|
|
203
209
|
});
|
|
204
210
|
|
|
205
211
|
it('should toggle from indeterminate to checked when clicked', async () => {
|
|
@@ -207,19 +213,25 @@ describe('Checkbox', () => {
|
|
|
207
213
|
|
|
208
214
|
await wrapper.find('label').trigger('click');
|
|
209
215
|
|
|
210
|
-
|
|
216
|
+
const checkboxRoot = wrapper.find('[role="checkbox"]');
|
|
217
|
+
expect(checkboxRoot.attributes('data-state')).toBe('checked');
|
|
218
|
+
expect(checkboxRoot.attributes('aria-checked')).toBe('true');
|
|
211
219
|
});
|
|
212
220
|
|
|
213
|
-
it('should not
|
|
221
|
+
it('should not change state when disabled and clicked', async () => {
|
|
214
222
|
const wrapper = setup({
|
|
215
223
|
modelValue: CHECKBOX_VALUES.UNCHECKED,
|
|
216
224
|
state: CHECKBOX_STATES.DISABLED,
|
|
217
225
|
});
|
|
218
226
|
|
|
227
|
+
const checkboxRoot = wrapper.find('[role="checkbox"]');
|
|
228
|
+
const initialState = checkboxRoot.attributes('data-state');
|
|
229
|
+
|
|
219
230
|
await wrapper.find('label').trigger('click');
|
|
220
231
|
|
|
221
|
-
// Should not
|
|
222
|
-
expect(
|
|
232
|
+
// Should not change state because checkbox is disabled
|
|
233
|
+
expect(checkboxRoot.attributes('data-state')).toBe(initialState);
|
|
234
|
+
expect(checkboxRoot.attributes('aria-checked')).toBe('false');
|
|
223
235
|
});
|
|
224
236
|
});
|
|
225
237
|
|
|
@@ -2,14 +2,13 @@ import Checkbox from './Checkbox.vue';
|
|
|
2
2
|
|
|
3
3
|
import { Meta, StoryFn } from '@storybook/vue3';
|
|
4
4
|
import {
|
|
5
|
+
CHECKBOX_ELEVATIONS,
|
|
5
6
|
CHECKBOX_SIZES,
|
|
6
7
|
CHECKBOX_STATES,
|
|
7
8
|
CHECKBOX_VALUES,
|
|
8
|
-
CHECKBOX_ELEVATIONS,
|
|
9
9
|
} from './Checkbox.consts';
|
|
10
10
|
import { withActions } from '@storybook/addon-actions/decorator';
|
|
11
11
|
import { computed } from 'vue';
|
|
12
|
-
import Banner from '../../Banner';
|
|
13
12
|
import { useArgs } from '@storybook/preview-api';
|
|
14
13
|
|
|
15
14
|
export default {
|
|
@@ -22,7 +21,7 @@ const StoryTemplate: StoryFn<typeof Checkbox> = (args) => {
|
|
|
22
21
|
const [_, updateArgs] = useArgs();
|
|
23
22
|
|
|
24
23
|
return {
|
|
25
|
-
components: { Checkbox
|
|
24
|
+
components: { Checkbox },
|
|
26
25
|
setup() {
|
|
27
26
|
const props = computed(() => {
|
|
28
27
|
const { default: defaultSlot, modelValue, ...rest } = args;
|
|
@@ -43,7 +42,6 @@ const StoryTemplate: StoryFn<typeof Checkbox> = (args) => {
|
|
|
43
42
|
>
|
|
44
43
|
<span v-if="defaultSlot" v-html="defaultSlot" />
|
|
45
44
|
</Checkbox>
|
|
46
|
-
<Banner color="danger" title="Uwaga! Mogą wystąpić problemy z pisaniem testów jednostkowych korzystających z tego komponentu. Unikaj jego używania. A jeśli jest rok 2026 i wciąż widzisz ten komunikat — nakrzycz na Karola!" title-in-color />
|
|
47
45
|
`,
|
|
48
46
|
};
|
|
49
47
|
};
|
|
@@ -6,13 +6,12 @@ import { args, argTypes } from '../FormField/FormField.stories.shared';
|
|
|
6
6
|
import { reactive, toRefs } from 'vue';
|
|
7
7
|
import { ICONS } from '../../Icons/Icon';
|
|
8
8
|
import HelpButton from '../../Buttons/HelpButton';
|
|
9
|
-
import Banner from '../../Banner';
|
|
10
9
|
|
|
11
10
|
const meta: Meta<typeof CheckboxGroupField> = {
|
|
12
11
|
title: 'Components/Form/CheckboxGroupField',
|
|
13
12
|
component: CheckboxGroupField,
|
|
14
13
|
render: (args) => ({
|
|
15
|
-
components: { CheckboxGroupField, Checkbox, HelpButton
|
|
14
|
+
components: { CheckboxGroupField, Checkbox, HelpButton },
|
|
16
15
|
setup() {
|
|
17
16
|
const { help, labelAside, message, fieldStatus, field, ...restRefs } = toRefs(args);
|
|
18
17
|
const props = reactive({ ...restRefs });
|
|
@@ -51,7 +50,6 @@ const meta: Meta<typeof CheckboxGroupField> = {
|
|
|
51
50
|
<div v-if="message" v-html="message" />
|
|
52
51
|
</template>
|
|
53
52
|
</CheckboxGroupField>
|
|
54
|
-
<Banner color="danger" title="Uwaga! Mogą wystąpić problemy z pisaniem testów jednostkowych korzystających z tego komponentu. Unikaj jego używania. A jeśli jest rok 2026 i wciąż widzisz ten komunikat — nakrzycz na Karola!" title-in-color />
|
|
55
53
|
`,
|
|
56
54
|
}),
|
|
57
55
|
argTypes,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bethinkpl/design-system",
|
|
3
|
-
"version": "33.0.
|
|
3
|
+
"version": "33.0.4",
|
|
4
4
|
"description": "Bethink universe design-system",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"@vueuse/core": "14.1.0",
|
|
113
113
|
"lodash-es": "4.17.22",
|
|
114
114
|
"primevue": "4.0.0-rc.3",
|
|
115
|
-
"reka-ui": "2.
|
|
115
|
+
"reka-ui": "2.8.0",
|
|
116
116
|
"vee-validate": "4.15.1",
|
|
117
117
|
"vue-component-type-helpers": "2.2.10"
|
|
118
118
|
},
|