@gitlab/ui 32.43.3 → 32.44.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.
- package/CHANGELOG.md +7 -0
- package/dist/components/base/avatar/avatar.documentation.js +2 -5
- package/dist/components/base/avatar_link/avatar_link.documentation.js +2 -5
- package/dist/components/base/form/form_input/form_input.documentation.js +2 -27
- package/dist/components/base/form/form_input/form_input.js +23 -6
- package/dist/components/base/form/form_text/form_text.documentation.js +1 -4
- package/dist/components/base/pagination/pagination.documentation.js +2 -85
- package/dist/components/base/pagination/pagination.js +76 -0
- package/dist/components/base/segmented_control/segmented_control.documentation.js +2 -14
- package/dist/components/base/segmented_control/segmented_control.js +6 -0
- package/documentation/documented_stories.js +5 -0
- package/package.json +11 -10
- package/src/components/base/alert/alert.spec.js +2 -2
- package/src/components/base/avatar/avatar.documentation.js +0 -2
- package/src/components/base/avatar/avatar.md +0 -2
- package/src/components/base/avatar/avatar.spec.js +1 -2
- package/src/components/base/avatar/avatar.stories.js +88 -101
- package/src/components/base/avatar_link/avatar_link.documentation.js +0 -2
- package/src/components/base/avatar_link/avatar_link.md +4 -7
- package/src/components/base/avatar_link/avatar_link.stories.js +66 -54
- package/src/components/base/filtered_search/filtered_search.spec.js +35 -35
- package/src/components/base/filtered_search/filtered_search_term.spec.js +1 -1
- package/src/components/base/form/form_input/form_input.documentation.js +0 -31
- package/src/components/base/form/form_input/form_input.md +0 -2
- package/src/components/base/form/form_input/form_input.stories.js +50 -42
- package/src/components/base/form/form_input/form_input.vue +23 -6
- package/src/components/base/form/form_input_group/form_input_group.spec.js +1 -3
- package/src/components/base/form/form_text/form_text.documentation.js +0 -2
- package/src/components/base/form/form_text/form_text.md +1 -3
- package/src/components/base/form/form_text/form_text.stories.js +20 -8
- package/src/components/base/icon/icon.spec.js +1 -4
- package/src/components/base/infinite_scroll/infinite_scroll.spec.js +1 -4
- package/src/components/base/modal/modal.spec.js +19 -23
- package/src/components/base/paginated_list/__snapshots__/paginated_list.spec.js.snap +10 -10
- package/src/components/base/pagination/pagination.documentation.js +0 -100
- package/src/components/base/pagination/pagination.md +5 -9
- package/src/components/base/pagination/pagination.spec.js +1 -4
- package/src/components/base/pagination/pagination.stories.js +109 -117
- package/src/components/base/pagination/pagination.vue +85 -0
- package/src/components/base/search_box_by_click/search_box_by_click.spec.js +1 -5
- package/src/components/base/segmented_control/segmented_control.documentation.js +0 -15
- package/src/components/base/segmented_control/segmented_control.md +0 -2
- package/src/components/base/segmented_control/segmented_control.stories.js +46 -36
- package/src/components/base/segmented_control/segmented_control.vue +5 -0
- package/src/components/base/sorting/sorting.spec.js +1 -4
- package/src/components/base/toast/toast.spec.js +4 -6
- package/src/components/base/token/token.spec.js +1 -4
- package/src/components/base/token_selector/token_container.spec.js +2 -3
- package/src/components/charts/gauge/gauge.spec.js +7 -7
- package/src/components/charts/sparkline/sparkline.spec.js +1 -4
- package/src/components/utilities/friendly_wrap/friendly_wrap.spec.js +1 -4
- package/src/components/utilities/intersperse/intersperse.spec.js +1 -4
- package/src/directives/hover_load/hover_load.spec.js +2 -13
- package/src/directives/outside/outside.spec.js +1 -6
- package/src/directives/resize_observer/resize_observer.spec.js +4 -10
- package/src/scss/storybook.scss +8 -0
- package/dist/components/base/avatar/examples/avatar.fallback.example.js +0 -38
- package/dist/components/base/avatar/examples/avatar.image.example.js +0 -38
- package/dist/components/base/avatar/examples/avatar.rect.example.js +0 -38
- package/dist/components/base/avatar/examples/avatar.tooltip.example.js +0 -38
- package/dist/components/base/avatar/examples/index.js +0 -31
- package/dist/components/base/avatar_link/examples/avatar.link.example.js +0 -38
- package/dist/components/base/avatar_link/examples/index.js +0 -13
- package/dist/components/base/form/form_input/examples/form_input/form_input.text.example.js +0 -38
- package/dist/components/base/form/form_input/examples/form_input/form_input.text_disabled.example.js +0 -38
- package/dist/components/base/form/form_input/examples/form_input/form_input.text_reactive.example.js +0 -57
- package/dist/components/base/form/form_input/examples/form_input/index.js +0 -22
- package/dist/components/base/form/form_text/examples/form_text.basic.example.js +0 -38
- package/dist/components/base/form/form_text/examples/index.js +0 -13
- package/dist/components/base/pagination/examples/index.js +0 -37
- package/dist/components/base/pagination/examples/pagination.basic.example.js +0 -45
- package/dist/components/base/pagination/examples/pagination.compact.example.js +0 -58
- package/dist/components/base/pagination/examples/pagination.double_truncation.example.js +0 -45
- package/dist/components/base/pagination/examples/pagination.event.example.js +0 -51
- package/dist/components/base/pagination/examples/pagination.links.example.js +0 -45
- package/dist/components/base/segmented_control/examples/index.js +0 -19
- package/dist/components/base/segmented_control/examples/segmented_control.basic.example.js +0 -65
- package/dist/components/base/segmented_control/examples/segmented_control.whitespace.example.js +0 -55
- package/src/components/base/avatar/examples/avatar.fallback.example.vue +0 -3
- package/src/components/base/avatar/examples/avatar.image.example.vue +0 -3
- package/src/components/base/avatar/examples/avatar.rect.example.vue +0 -6
- package/src/components/base/avatar/examples/avatar.tooltip.example.vue +0 -3
- package/src/components/base/avatar/examples/index.js +0 -36
- package/src/components/base/avatar_link/examples/avatar.link.example.vue +0 -5
- package/src/components/base/avatar_link/examples/index.js +0 -15
- package/src/components/base/form/form_input/examples/form_input/form_input.text.example.vue +0 -3
- package/src/components/base/form/form_input/examples/form_input/form_input.text_disabled.example.vue +0 -3
- package/src/components/base/form/form_input/examples/form_input/form_input.text_reactive.example.vue +0 -24
- package/src/components/base/form/form_input/examples/form_input/index.js +0 -26
- package/src/components/base/form/form_text/examples/form_text.basic.example.vue +0 -5
- package/src/components/base/form/form_text/examples/index.js +0 -15
- package/src/components/base/pagination/examples/index.js +0 -43
- package/src/components/base/pagination/examples/pagination.basic.example.vue +0 -17
- package/src/components/base/pagination/examples/pagination.compact.example.vue +0 -33
- package/src/components/base/pagination/examples/pagination.double_truncation.example.vue +0 -11
- package/src/components/base/pagination/examples/pagination.event.example.vue +0 -26
- package/src/components/base/pagination/examples/pagination.links.example.vue +0 -18
- package/src/components/base/segmented_control/examples/index.js +0 -22
- package/src/components/base/segmented_control/examples/segmented_control.basic.example.vue +0 -19
- package/src/components/base/segmented_control/examples/segmented_control.whitespace.example.vue +0 -18
|
@@ -1,37 +1,6 @@
|
|
|
1
|
-
import examples from './examples/form_input';
|
|
2
1
|
import description from './form_input.md';
|
|
3
2
|
|
|
4
3
|
export default {
|
|
5
4
|
description,
|
|
6
|
-
examples,
|
|
7
|
-
bootstrapComponent: 'b-form-input',
|
|
8
5
|
followsDesignSystem: true,
|
|
9
|
-
propsInfo: {
|
|
10
|
-
size: {
|
|
11
|
-
additionalInfo: 'Maximum width of the input',
|
|
12
|
-
enum: 'formInputSizes',
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
events: [
|
|
16
|
-
{
|
|
17
|
-
event: 'input',
|
|
18
|
-
args: [
|
|
19
|
-
{
|
|
20
|
-
arg: 'value',
|
|
21
|
-
description: '(String)',
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
description: 'Emitted to update the v-model',
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
event: 'update',
|
|
28
|
-
args: [
|
|
29
|
-
{
|
|
30
|
-
arg: 'value',
|
|
31
|
-
description: '(String)',
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
description: `Triggered by user interaction. Emitted after any formatting (not including 'trim' or 'number' props). Useful for getting the currently entered value when the 'debounce' or 'lazy' props are set.`,
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
6
|
};
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import { withKnobs, boolean, select, text } from '@storybook/addon-knobs';
|
|
2
|
-
import { documentedStoriesOf } from '../../../../../documentation/documented_stories';
|
|
3
1
|
import { GlFormInput } from '../../../../../index';
|
|
4
2
|
import { formInputSizes } from '../../../../utils/constants';
|
|
5
3
|
import readme from './form_input.md';
|
|
6
4
|
|
|
7
|
-
const components = {
|
|
8
|
-
GlFormInput,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
5
|
const template = `
|
|
12
6
|
<gl-form-input
|
|
13
7
|
type="text"
|
|
@@ -16,51 +10,65 @@ const template = `
|
|
|
16
10
|
:size="size"
|
|
17
11
|
/>`;
|
|
18
12
|
|
|
19
|
-
|
|
13
|
+
const generateProps = ({
|
|
20
14
|
size = GlFormInput.props.size.default,
|
|
21
15
|
value = '',
|
|
22
16
|
disabled = false,
|
|
23
|
-
} = {}) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
type: Boolean,
|
|
35
|
-
default: boolean('disabled', disabled),
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
}
|
|
17
|
+
} = {}) => ({
|
|
18
|
+
size,
|
|
19
|
+
value,
|
|
20
|
+
disabled,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const Template = (args) => ({
|
|
24
|
+
components: { GlFormInput },
|
|
25
|
+
props: Object.keys(args),
|
|
26
|
+
template,
|
|
27
|
+
});
|
|
39
28
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
components,
|
|
54
|
-
data: () => ({
|
|
55
|
-
formInputSizes,
|
|
56
|
-
}),
|
|
57
|
-
template: `
|
|
29
|
+
export const Default = Template.bind({});
|
|
30
|
+
Default.args = generateProps();
|
|
31
|
+
|
|
32
|
+
export const Disabled = Template.bind({});
|
|
33
|
+
Disabled.args = generateProps({ value: 'some text', disabled: true });
|
|
34
|
+
|
|
35
|
+
export const Sizes = (args, { argTypes }) => ({
|
|
36
|
+
components: { GlFormInput },
|
|
37
|
+
props: Object.keys(argTypes),
|
|
38
|
+
data: () => ({
|
|
39
|
+
formInputSizes,
|
|
40
|
+
}),
|
|
41
|
+
template: `
|
|
58
42
|
<div>
|
|
59
43
|
<gl-form-input
|
|
60
44
|
v-for="(size, name) in formInputSizes"
|
|
45
|
+
:key="size"
|
|
61
46
|
:size="size"
|
|
62
47
|
:value="name"
|
|
63
48
|
/>
|
|
64
49
|
</div>
|
|
65
50
|
`,
|
|
66
|
-
|
|
51
|
+
});
|
|
52
|
+
Sizes.args = {};
|
|
53
|
+
|
|
54
|
+
export default {
|
|
55
|
+
title: 'base/form/form-input',
|
|
56
|
+
component: GlFormInput,
|
|
57
|
+
parameters: {
|
|
58
|
+
bootstrapComponent: 'b-form-input',
|
|
59
|
+
knobs: { disable: true },
|
|
60
|
+
docs: {
|
|
61
|
+
description: {
|
|
62
|
+
component: readme,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
argTypes: {
|
|
67
|
+
size: {
|
|
68
|
+
options: formInputSizes,
|
|
69
|
+
control: {
|
|
70
|
+
type: 'select',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
};
|
|
@@ -2,18 +2,22 @@
|
|
|
2
2
|
import { BFormInput } from 'bootstrap-vue';
|
|
3
3
|
import { formInputSizes } from '../../../../utils/constants';
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
event: 'input',
|
|
8
|
-
};
|
|
5
|
+
const MODEL_PROP = 'value';
|
|
6
|
+
const MODEL_EVENT = 'input';
|
|
9
7
|
|
|
10
8
|
export default {
|
|
11
9
|
components: {
|
|
12
10
|
BFormInput,
|
|
13
11
|
},
|
|
14
12
|
inheritAttrs: false,
|
|
15
|
-
model
|
|
13
|
+
model: {
|
|
14
|
+
prop: MODEL_PROP,
|
|
15
|
+
event: MODEL_EVENT,
|
|
16
|
+
},
|
|
16
17
|
props: {
|
|
18
|
+
/**
|
|
19
|
+
* Maximum width of the input
|
|
20
|
+
*/
|
|
17
21
|
size: {
|
|
18
22
|
type: String,
|
|
19
23
|
required: false,
|
|
@@ -33,10 +37,23 @@ export default {
|
|
|
33
37
|
// Swap purpose of input and update events from underlying BFormInput.
|
|
34
38
|
// See https://gitlab.com/gitlab-org/gitlab-ui/-/issues/631.
|
|
35
39
|
input: (...args) => {
|
|
40
|
+
/**
|
|
41
|
+
* Emitted to update the v-model
|
|
42
|
+
*
|
|
43
|
+
* @event update
|
|
44
|
+
* @property {string} value new value
|
|
45
|
+
*/
|
|
36
46
|
this.$emit('update', ...args);
|
|
37
47
|
},
|
|
38
48
|
update: (...args) => {
|
|
39
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Triggered by user interaction. Emitted after any formatting (not including 'trim' or 'number' props).
|
|
51
|
+
* Useful for getting the currently entered value when the 'debounce' or 'lazy' props are set.
|
|
52
|
+
*
|
|
53
|
+
* @event input
|
|
54
|
+
* @property {string} value new value
|
|
55
|
+
*/
|
|
56
|
+
this.$emit(MODEL_EVENT, ...args);
|
|
40
57
|
},
|
|
41
58
|
};
|
|
42
59
|
},
|
|
@@ -15,7 +15,7 @@ describe('Input Group', () => {
|
|
|
15
15
|
it('renders without errors', () => {
|
|
16
16
|
createWrapper();
|
|
17
17
|
expect(wrapper.findComponent(BInputGroup).exists()).toBe(true);
|
|
18
|
-
expect(
|
|
18
|
+
expect(wrapper).not.toHaveLoggedVueErrors();
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
it('renders prepend and append texts properly in the slots', () => {
|
|
@@ -87,8 +87,6 @@ describe('Input Group', () => {
|
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
expect(global.console).toHaveLoggedVueErrors();
|
|
90
|
-
|
|
91
|
-
global.console.error.mockReset();
|
|
92
90
|
});
|
|
93
91
|
|
|
94
92
|
it('are rendered when supplied', () => {
|
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
import { documentedStoriesOf } from '../../../../../documentation/documented_stories';
|
|
2
1
|
import readme from './form_text.md';
|
|
3
2
|
import GlFormText from './form_text.vue';
|
|
4
3
|
|
|
5
|
-
const
|
|
6
|
-
GlFormText,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
documentedStoriesOf('base/form/form-text', readme).add('default', () => ({
|
|
10
|
-
components,
|
|
4
|
+
const Template = (args) => ({
|
|
5
|
+
components: { GlFormText },
|
|
6
|
+
props: Object.keys(args),
|
|
11
7
|
template: `
|
|
12
8
|
<div class="gl-form-group">
|
|
13
9
|
<gl-form-text>Some form text</gl-form-text>
|
|
14
10
|
</div>
|
|
15
11
|
`,
|
|
16
|
-
})
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const Default = Template.bind({});
|
|
15
|
+
Default.args = {};
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
title: 'base/form/form-text',
|
|
19
|
+
component: GlFormText,
|
|
20
|
+
parameters: {
|
|
21
|
+
knobs: { disable: true },
|
|
22
|
+
docs: {
|
|
23
|
+
description: {
|
|
24
|
+
component: readme,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shallowMount
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
2
|
import Icon from './icon.vue';
|
|
3
3
|
import { iconSizeOptions } from '~/utils/constants';
|
|
4
4
|
|
|
@@ -6,8 +6,6 @@ const ICONS_PATH = '/path/to/icons.svg';
|
|
|
6
6
|
const TEST_SIZE = 8;
|
|
7
7
|
const TEST_NAME = 'check-circle';
|
|
8
8
|
|
|
9
|
-
const localVue = createLocalVue();
|
|
10
|
-
|
|
11
9
|
jest.mock('@gitlab/svgs/dist/icons.svg', () => '/path/to/icons.svg');
|
|
12
10
|
|
|
13
11
|
describe('Icon component', () => {
|
|
@@ -21,7 +19,6 @@ describe('Icon component', () => {
|
|
|
21
19
|
name: TEST_NAME,
|
|
22
20
|
...props,
|
|
23
21
|
},
|
|
24
|
-
localVue,
|
|
25
22
|
});
|
|
26
23
|
};
|
|
27
24
|
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { shallowMount
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
2
|
import throttle from 'lodash/throttle';
|
|
3
3
|
import InfiniteScroll, { adjustScrollGap } from './infinite_scroll.vue';
|
|
4
4
|
|
|
5
5
|
jest.mock('lodash/throttle', () => jest.fn((fn) => fn));
|
|
6
6
|
|
|
7
|
-
const localVue = createLocalVue();
|
|
8
|
-
|
|
9
7
|
const INITIAL_HEIGHT = 500;
|
|
10
8
|
const INITIAL_SCROLL_TOP = 0;
|
|
11
9
|
const ADJUST_SCROLL_GAP = adjustScrollGap;
|
|
@@ -25,7 +23,6 @@ describe('Infinite Scroll component', () => {
|
|
|
25
23
|
|
|
26
24
|
const createComponent = ({ propsData = props, listeners = {} } = {}) => {
|
|
27
25
|
wrapper = shallowMount(InfiniteScroll, {
|
|
28
|
-
localVue,
|
|
29
26
|
propsData,
|
|
30
27
|
listeners,
|
|
31
28
|
attachTo: document.body,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shallowMount
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
2
|
import { BModal } from 'bootstrap-vue';
|
|
3
3
|
import { merge } from 'lodash';
|
|
4
4
|
import CloseButton from '../../shared_components/close_button/close_button.vue';
|
|
@@ -6,23 +6,20 @@ import Button from '../button/button.vue';
|
|
|
6
6
|
import Modal from './modal.vue';
|
|
7
7
|
import { modalButtonDefaults } from '~/utils/constants';
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
})
|
|
25
|
-
);
|
|
9
|
+
const BModalStub = merge({}, BModal.options, {
|
|
10
|
+
methods: {
|
|
11
|
+
onCancel: jest.fn(function cancel() {
|
|
12
|
+
this.$emit('cancel');
|
|
13
|
+
}),
|
|
14
|
+
onClose: jest.fn(),
|
|
15
|
+
onOk: jest.fn(function ok() {
|
|
16
|
+
this.$emit('ok');
|
|
17
|
+
}),
|
|
18
|
+
},
|
|
19
|
+
render(h) {
|
|
20
|
+
return h('div', Object.values(this.$slots));
|
|
21
|
+
},
|
|
22
|
+
});
|
|
26
23
|
|
|
27
24
|
describe('Modal component', () => {
|
|
28
25
|
let wrapperListeners;
|
|
@@ -45,7 +42,6 @@ describe('Modal component', () => {
|
|
|
45
42
|
};
|
|
46
43
|
|
|
47
44
|
wrapper = shallowMount(Modal, {
|
|
48
|
-
localVue,
|
|
49
45
|
propsData: {
|
|
50
46
|
modalId: 'modal-id',
|
|
51
47
|
...props,
|
|
@@ -158,7 +154,7 @@ describe('Modal component', () => {
|
|
|
158
154
|
});
|
|
159
155
|
|
|
160
156
|
it('should emit canceled event', () => {
|
|
161
|
-
expect(BModalStub.
|
|
157
|
+
expect(BModalStub.methods.onCancel).toHaveBeenCalledTimes(1);
|
|
162
158
|
expect(wrapperListeners.canceled).toHaveBeenCalledTimes(1);
|
|
163
159
|
});
|
|
164
160
|
});
|
|
@@ -169,7 +165,7 @@ describe('Modal component', () => {
|
|
|
169
165
|
});
|
|
170
166
|
|
|
171
167
|
it('should emit primary event', () => {
|
|
172
|
-
expect(BModalStub.
|
|
168
|
+
expect(BModalStub.methods.onOk).toHaveBeenCalledTimes(1);
|
|
173
169
|
expect(wrapperListeners.primary).toHaveBeenCalledTimes(1);
|
|
174
170
|
});
|
|
175
171
|
});
|
|
@@ -184,7 +180,7 @@ describe('Modal component', () => {
|
|
|
184
180
|
});
|
|
185
181
|
|
|
186
182
|
it('should close modal', () => {
|
|
187
|
-
expect(BModalStub.
|
|
183
|
+
expect(BModalStub.methods.onClose).toHaveBeenCalledTimes(1);
|
|
188
184
|
});
|
|
189
185
|
});
|
|
190
186
|
|
|
@@ -198,7 +194,7 @@ describe('Modal component', () => {
|
|
|
198
194
|
});
|
|
199
195
|
|
|
200
196
|
it('should close modal', () => {
|
|
201
|
-
expect(BModalStub.
|
|
197
|
+
expect(BModalStub.methods.onClose).not.toHaveBeenCalled();
|
|
202
198
|
});
|
|
203
199
|
});
|
|
204
200
|
});
|
|
@@ -37,7 +37,7 @@ exports[`Paginated List Pagination renders 1 item on page 7 with page size of 2
|
|
|
37
37
|
labelfirstpage="Go to first page"
|
|
38
38
|
labellastpage="Go to last page"
|
|
39
39
|
labelnextpage="Go to next page"
|
|
40
|
-
labelpage="
|
|
40
|
+
labelpage="[Function]"
|
|
41
41
|
labelprevpage="Go to previous page"
|
|
42
42
|
limits="[object Object]"
|
|
43
43
|
nexttext="Next"
|
|
@@ -114,7 +114,7 @@ exports[`Paginated List Pagination renders 3 items on page 2 with default page s
|
|
|
114
114
|
labelfirstpage="Go to first page"
|
|
115
115
|
labellastpage="Go to last page"
|
|
116
116
|
labelnextpage="Go to next page"
|
|
117
|
-
labelpage="
|
|
117
|
+
labelpage="[Function]"
|
|
118
118
|
labelprevpage="Go to previous page"
|
|
119
119
|
limits="[object Object]"
|
|
120
120
|
nexttext="Next"
|
|
@@ -217,7 +217,7 @@ exports[`Paginated List Pagination renders 5 items on page 1 for a page size of
|
|
|
217
217
|
labelfirstpage="Go to first page"
|
|
218
218
|
labellastpage="Go to last page"
|
|
219
219
|
labelnextpage="Go to next page"
|
|
220
|
-
labelpage="
|
|
220
|
+
labelpage="[Function]"
|
|
221
221
|
labelprevpage="Go to previous page"
|
|
222
222
|
limits="[object Object]"
|
|
223
223
|
nexttext="Next"
|
|
@@ -385,7 +385,7 @@ exports[`Paginated List Pagination renders 10 items for a default page size of 1
|
|
|
385
385
|
labelfirstpage="Go to first page"
|
|
386
386
|
labellastpage="Go to last page"
|
|
387
387
|
labelnextpage="Go to next page"
|
|
388
|
-
labelpage="
|
|
388
|
+
labelpage="[Function]"
|
|
389
389
|
labelprevpage="Go to previous page"
|
|
390
390
|
limits="[object Object]"
|
|
391
391
|
nexttext="Next"
|
|
@@ -592,7 +592,7 @@ exports[`Paginated List Pagination renders 13 items for a default page size of 2
|
|
|
592
592
|
labelfirstpage="Go to first page"
|
|
593
593
|
labellastpage="Go to last page"
|
|
594
594
|
labelnextpage="Go to next page"
|
|
595
|
-
labelpage="
|
|
595
|
+
labelpage="[Function]"
|
|
596
596
|
labelprevpage="Go to previous page"
|
|
597
597
|
limits="[object Object]"
|
|
598
598
|
nexttext="Next"
|
|
@@ -712,7 +712,7 @@ exports[`Paginated List Search states renders the list filtered by search result
|
|
|
712
712
|
labelfirstpage="Go to first page"
|
|
713
713
|
labellastpage="Go to last page"
|
|
714
714
|
labelnextpage="Go to next page"
|
|
715
|
-
labelpage="
|
|
715
|
+
labelpage="[Function]"
|
|
716
716
|
labelprevpage="Go to previous page"
|
|
717
717
|
limits="[object Object]"
|
|
718
718
|
nexttext="Next"
|
|
@@ -832,7 +832,7 @@ exports[`Paginated List Searchless states renders the list with nested items, wh
|
|
|
832
832
|
labelfirstpage="Go to first page"
|
|
833
833
|
labellastpage="Go to last page"
|
|
834
834
|
labelnextpage="Go to next page"
|
|
835
|
-
labelpage="
|
|
835
|
+
labelpage="[Function]"
|
|
836
836
|
labelprevpage="Go to previous page"
|
|
837
837
|
limits="[object Object]"
|
|
838
838
|
nexttext="Next"
|
|
@@ -883,7 +883,7 @@ exports[`Paginated List props filter filters on default "id" key 1`] = `
|
|
|
883
883
|
labelfirstpage="Go to first page"
|
|
884
884
|
labellastpage="Go to last page"
|
|
885
885
|
labelnextpage="Go to next page"
|
|
886
|
-
labelpage="
|
|
886
|
+
labelpage="[Function]"
|
|
887
887
|
labelprevpage="Go to previous page"
|
|
888
888
|
limits="[object Object]"
|
|
889
889
|
nexttext="Next"
|
|
@@ -934,7 +934,7 @@ exports[`Paginated List props filter filters on provided "myKey" key 1`] = `
|
|
|
934
934
|
labelfirstpage="Go to first page"
|
|
935
935
|
labellastpage="Go to last page"
|
|
936
936
|
labelnextpage="Go to next page"
|
|
937
|
-
labelpage="
|
|
937
|
+
labelpage="[Function]"
|
|
938
938
|
labelprevpage="Go to previous page"
|
|
939
939
|
limits="[object Object]"
|
|
940
940
|
nexttext="Next"
|
|
@@ -985,7 +985,7 @@ exports[`Paginated List props filter filters with provided filter function 1`] =
|
|
|
985
985
|
labelfirstpage="Go to first page"
|
|
986
986
|
labellastpage="Go to last page"
|
|
987
987
|
labelnextpage="Go to next page"
|
|
988
|
-
labelpage="
|
|
988
|
+
labelpage="[Function]"
|
|
989
989
|
labelprevpage="Go to previous page"
|
|
990
990
|
limits="[object Object]"
|
|
991
991
|
nexttext="Next"
|
|
@@ -1,106 +1,6 @@
|
|
|
1
|
-
import examples from './examples';
|
|
2
1
|
import description from './pagination.md';
|
|
3
2
|
|
|
4
3
|
export default {
|
|
5
4
|
followsDesignSystem: true,
|
|
6
5
|
description,
|
|
7
|
-
examples,
|
|
8
|
-
propsInfo: {
|
|
9
|
-
perPage: {
|
|
10
|
-
additionalInfo: 'Number of items per page',
|
|
11
|
-
},
|
|
12
|
-
totalItems: {
|
|
13
|
-
additionalInfo: 'Total number of items',
|
|
14
|
-
},
|
|
15
|
-
limits: {
|
|
16
|
-
additionalInfo: 'The object must contain the xs, sm, md and default keys',
|
|
17
|
-
},
|
|
18
|
-
linkGen: {
|
|
19
|
-
additionalInfo:
|
|
20
|
-
'A function that receives the page number and that returns a string representing the page URL',
|
|
21
|
-
},
|
|
22
|
-
prevPage: {
|
|
23
|
-
additionalInfo:
|
|
24
|
-
'When using the compact pagination, use this prop to pass the previous page number',
|
|
25
|
-
},
|
|
26
|
-
prevText: {
|
|
27
|
-
additionalInfo: 'Text for the previous button (overridden by "previous" slot)',
|
|
28
|
-
},
|
|
29
|
-
nextPage: {
|
|
30
|
-
additionalInfo:
|
|
31
|
-
'When using the compact pagination, use this prop to pass the next page number',
|
|
32
|
-
},
|
|
33
|
-
nextText: {
|
|
34
|
-
additionalInfo: 'Text for the next button (overridden by "next" slot)',
|
|
35
|
-
},
|
|
36
|
-
ellipsisText: {
|
|
37
|
-
additionalInfo:
|
|
38
|
-
'Text for the ellipsis (overridden by "ellipsis-left" and "ellipsis-right" slots)',
|
|
39
|
-
},
|
|
40
|
-
labelFirstPage: {
|
|
41
|
-
additionalInfo: 'aria-label for the first page item',
|
|
42
|
-
},
|
|
43
|
-
labelPrevPage: {
|
|
44
|
-
additionalInfo: 'aria-label for the previous page item',
|
|
45
|
-
},
|
|
46
|
-
labelNextPage: {
|
|
47
|
-
additionalInfo: 'aria-label for the next page item',
|
|
48
|
-
},
|
|
49
|
-
labelLastPage: {
|
|
50
|
-
additionalInfo: 'aria-label for the last page item',
|
|
51
|
-
},
|
|
52
|
-
labelPage: {
|
|
53
|
-
additionalInfo:
|
|
54
|
-
'aria-label getter for numbered page items, defaults to "Go to page <page_number>"',
|
|
55
|
-
},
|
|
56
|
-
align: {
|
|
57
|
-
additionalInfo:
|
|
58
|
-
'Controls the component\'s horizontal alignment, value should be one of "left", "center", "right" or "fill"',
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
events: [
|
|
62
|
-
{
|
|
63
|
-
event: 'input',
|
|
64
|
-
description: 'Emitted when the page changes',
|
|
65
|
-
args: [
|
|
66
|
-
{
|
|
67
|
-
arg: 'value',
|
|
68
|
-
description: 'The page that just got loaded',
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
event: 'next',
|
|
74
|
-
description: 'Emitted when the "next" button is clicked',
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
event: 'previous',
|
|
78
|
-
description: 'Emitted when the "previous" button is clicked',
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
slots: [
|
|
82
|
-
{
|
|
83
|
-
name: 'previous',
|
|
84
|
-
description: `Content for the "previous" button. Overrides the "prevText" prop.`,
|
|
85
|
-
scopedProps: `{ active: boolean, disabled: boolean, page: number }`,
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
name: 'next',
|
|
89
|
-
description: `Content for the "next" button. Overrides the "nextText" prop.`,
|
|
90
|
-
scopedProps: `{ active: boolean, disabled: boolean, page: number }`,
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: 'page-number',
|
|
94
|
-
description: `Content for page number buttons.`,
|
|
95
|
-
scopedProps: `{ active: boolean, disabled: boolean, page: number }`,
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
name: 'ellipsis-left',
|
|
99
|
-
description: `Content for the left ellipsis. Overrides the "ellipsisText" prop.`,
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
name: 'ellipsis-right',
|
|
103
|
-
description: `Content for the right ellipsis. Overrides the "ellipsisText" prop.`,
|
|
104
|
-
},
|
|
105
|
-
],
|
|
106
6
|
};
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
# Pagination
|
|
2
|
-
|
|
3
|
-
<!-- STORY -->
|
|
4
|
-
|
|
5
1
|
## Current page
|
|
6
2
|
|
|
7
3
|
The current page's value should be bound using `v-model`, e.g.:
|
|
8
4
|
|
|
9
5
|
```html
|
|
10
6
|
<script>
|
|
11
|
-
export default {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
7
|
+
export default {
|
|
8
|
+
data: () => ({
|
|
9
|
+
page: 2,
|
|
10
|
+
}),
|
|
11
|
+
};
|
|
16
12
|
</script>
|
|
17
13
|
|
|
18
14
|
<template>
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { mount
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
2
|
import debounce from 'lodash/debounce';
|
|
3
3
|
import Pagination from './pagination.vue';
|
|
4
4
|
import { breakpoints } from '~/utils/breakpoints';
|
|
5
5
|
|
|
6
6
|
jest.mock('lodash/debounce', () => jest.fn((fn) => fn));
|
|
7
7
|
|
|
8
|
-
const localVue = createLocalVue();
|
|
9
|
-
|
|
10
8
|
const expectClassActive = expect.arrayContaining(['active']);
|
|
11
9
|
const mockResizeWidth = (width) => {
|
|
12
10
|
window.innerWidth = width;
|
|
@@ -29,7 +27,6 @@ describe('pagination component', () => {
|
|
|
29
27
|
itemsPerPage: 20,
|
|
30
28
|
...props,
|
|
31
29
|
},
|
|
32
|
-
localVue,
|
|
33
30
|
...options,
|
|
34
31
|
});
|
|
35
32
|
};
|