Commit 50c52424 authored by Illya Klymov's avatar Illya Klymov

Address reviewer comments

* remove incorrect aria-role
* improve storybook
parent 0385b81e
...@@ -27,17 +27,11 @@ Default.args = { ...@@ -27,17 +27,11 @@ Default.args = {
Default.argTypes = { Default.argTypes = {
pageInfo: { pageInfo: {
description: 'Page info object', description: 'Page info object',
control: false, control: { type: 'object' },
}, },
pageSizes: { pageSizes: {
description: 'Array of possible page sizes', description: 'Array of possible page sizes',
control: false, control: { type: 'array' },
},
itemsCount: {
description: 'Total number of items',
control: {
type: 'number',
},
}, },
// events // events
......
...@@ -42,8 +42,24 @@ export default { ...@@ -42,8 +42,24 @@ export default {
methods: { methods: {
setPage(page) { setPage(page) {
// eslint-disable-next-line spaced-comment
/**
* Emitted when selected page is updated
*
* @event set-page
**/
this.$emit('set-page', page); this.$emit('set-page', page);
}, },
setPageSize(pageSize) {
// eslint-disable-next-line spaced-comment
/**
* Emitted when page size is updated
*
* @event set-page-size
**/
this.$emit('set-page-size', pageSize);
},
}, },
}; };
</script> </script>
...@@ -51,7 +67,7 @@ export default { ...@@ -51,7 +67,7 @@ export default {
<template> <template>
<div class="gl-display-flex gl-align-items-center"> <div class="gl-display-flex gl-align-items-center">
<pagination-links :change="setPage" :page-info="pageInfo" class="gl-m-0" /> <pagination-links :change="setPage" :page-info="pageInfo" class="gl-m-0" />
<gl-dropdown category="tertiary" class="gl-ml-auto" :aria-label="__('Page size')"> <gl-dropdown category="tertiary" class="gl-ml-auto" data-testid="page-size">
<template #button-content> <template #button-content>
<span class="gl-font-weight-bold"> <span class="gl-font-weight-bold">
<gl-sprintf :message="__('%{count} items per page')"> <gl-sprintf :message="__('%{count} items per page')">
...@@ -62,7 +78,7 @@ export default { ...@@ -62,7 +78,7 @@ export default {
</span> </span>
<gl-icon class="gl-button-icon dropdown-chevron" name="chevron-down" /> <gl-icon class="gl-button-icon dropdown-chevron" name="chevron-down" />
</template> </template>
<gl-dropdown-item v-for="size in pageSizes" :key="size" @click="$emit('set-page-size', size)"> <gl-dropdown-item v-for="size in pageSizes" :key="size" @click="setPageSize(size)">
<gl-sprintf :message="__('%{count} items per page')"> <gl-sprintf :message="__('%{count} items per page')">
<template #count> <template #count>
{{ size }} {{ size }}
......
...@@ -25258,9 +25258,6 @@ msgstr "" ...@@ -25258,9 +25258,6 @@ msgstr ""
msgid "Page settings" msgid "Page settings"
msgstr "" msgstr ""
msgid "Page size"
msgstr ""
msgid "PagerDutySettings|Active" msgid "PagerDutySettings|Active"
msgstr "" msgstr ""
......
...@@ -38,7 +38,7 @@ describe('import table', () => { ...@@ -38,7 +38,7 @@ describe('import table', () => {
wrapper.findAll('button').wrappers.find((w) => w.text() === 'Import selected'); wrapper.findAll('button').wrappers.find((w) => w.text() === 'Import selected');
const findImportButtons = () => const findImportButtons = () =>
wrapper.findAll('button').wrappers.filter((w) => w.text() === 'Import'); wrapper.findAll('button').wrappers.filter((w) => w.text() === 'Import');
const findPaginationDropdown = () => wrapper.find('[aria-label="Page size"]'); const findPaginationDropdown = () => wrapper.find('[data-testid="page-size"]');
const findPaginationDropdownText = () => findPaginationDropdown().find('button').text(); const findPaginationDropdownText = () => findPaginationDropdown().find('button').text();
const findSelectionCount = () => wrapper.find('[data-test-id="selection-count"]'); const findSelectionCount = () => wrapper.find('[data-test-id="selection-count"]');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment