diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-10 06:07:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-10 06:07:43 +0300 |
commit | 677227413ae31f5a02fd4c8e10f6ef50c228334f (patch) | |
tree | fbd07453cf1aaded55f081bb42fa043b3f3ffc2b /spec/frontend/packages_and_registries | |
parent | 3f22924df411018ba665ecf72ab0768d61173477 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/packages_and_registries')
-rw-r--r-- | spec/frontend/packages_and_registries/shared/components/registry_list_spec.js | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/spec/frontend/packages_and_registries/shared/components/registry_list_spec.js b/spec/frontend/packages_and_registries/shared/components/registry_list_spec.js index aaca58d21bb..2e2d5e26d33 100644 --- a/spec/frontend/packages_and_registries/shared/components/registry_list_spec.js +++ b/spec/frontend/packages_and_registries/shared/components/registry_list_spec.js @@ -54,6 +54,28 @@ describe('Registry List', () => { it('exists', () => { expect(findSelectAll().exists()).toBe(true); + expect(findSelectAll().attributes('aria-label')).toBe('Select all'); + expect(findSelectAll().attributes('disabled')).toBeUndefined(); + expect(findSelectAll().attributes('indeterminate')).toBeUndefined(); + }); + + it('sets disabled prop to true when items length is 0', () => { + mountComponent({ propsData: { ...defaultPropsData, items: [] } }); + + expect(findSelectAll().attributes('disabled')).toBe('true'); + }); + + it('when few are selected, sets indeterminate prop to true', async () => { + await findScopedSlotSelectButton(0).trigger('click'); + + expect(findSelectAll().attributes('indeterminate')).toBe('true'); + }); + + it('when all are selected, sets the right checkbox label', async () => { + findSelectAll().vm.$emit('change', true); + await nextTick(); + + expect(findSelectAll().attributes('aria-label')).toBe('Unselect all'); }); it('select and unselect all', async () => { @@ -63,7 +85,7 @@ describe('Registry List', () => { }); // simulate selection - findSelectAll().vm.$emit('input', true); + findSelectAll().vm.$emit('change', true); await nextTick(); // all rows selected @@ -72,12 +94,12 @@ describe('Registry List', () => { }); // simulate de-selection - findSelectAll().vm.$emit('input', ''); + findSelectAll().vm.$emit('change', false); await nextTick(); // no row is not selected items.forEach((item, index) => { - expect(findScopedSlotIsSelectedValue(index).text()).toBe(''); + expect(findScopedSlotIsSelectedValue(index).text()).toBe('false'); }); }); }); |