diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-31 15:07:53 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-31 15:07:53 +0000 |
commit | d7a028e20d29b8c6d0e780ac168544dfbb712d3c (patch) | |
tree | f9fc9ea12e166aec6c4ffe476ba7a3566396b696 /spec/frontend/registry/explorer | |
parent | 0d0cddc9ce20c5a7d8a2723d0aa620ca184a711a (diff) | |
download | gitlab-ce-d7a028e20d29b8c6d0e780ac168544dfbb712d3c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/registry/explorer')
-rw-r--r-- | spec/frontend/registry/explorer/pages/details_spec.js | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/spec/frontend/registry/explorer/pages/details_spec.js b/spec/frontend/registry/explorer/pages/details_spec.js index 60e509e4a88..15aa5008413 100644 --- a/spec/frontend/registry/explorer/pages/details_spec.js +++ b/spec/frontend/registry/explorer/pages/details_spec.js @@ -29,10 +29,11 @@ describe('Details Page', () => { const findAllDeleteButtons = () => wrapper.findAll('.js-delete-registry'); const findAllCheckboxes = () => wrapper.findAll('.js-row-checkbox'); const findCheckedCheckboxes = () => findAllCheckboxes().filter(c => c.attributes('checked')); + const findFirsTagColumn = () => wrapper.find('.js-tag-column'); const routeId = window.btoa(JSON.stringify({ name: 'foo', tags_path: 'bar' })); - beforeEach(() => { + const mountComponent = options => { wrapper = mount(component, { store, stubs: { @@ -49,7 +50,11 @@ describe('Details Page', () => { }, $toast, }, + ...options, }); + }; + + beforeEach(() => { dispatchSpy = jest.spyOn(store, 'dispatch'); store.dispatch('receiveTagsListSuccess', tagsListResponse); jest.spyOn(Tracking, 'event'); @@ -61,6 +66,7 @@ describe('Details Page', () => { describe('when isLoading is true', () => { beforeEach(() => { + mountComponent(); store.dispatch('receiveTagsListSuccess', { ...tagsListResponse, data: [] }); store.commit(SET_MAIN_LOADING, true); }); @@ -81,6 +87,10 @@ describe('Details Page', () => { }); describe('table', () => { + beforeEach(() => { + mountComponent(); + }); + it.each([ 'rowCheckbox', 'rowName', @@ -93,6 +103,10 @@ describe('Details Page', () => { }); describe('header checkbox', () => { + beforeEach(() => { + mountComponent(); + }); + it('exists', () => { expect(findMainCheckbox().exists()).toBe(true); }); @@ -116,6 +130,10 @@ describe('Details Page', () => { }); describe('row checkbox', () => { + beforeEach(() => { + mountComponent(); + }); + it('if selected adds item to selectedItems', () => { findFirstRowItem('rowCheckbox').vm.$emit('change'); return wrapper.vm.$nextTick().then(() => { @@ -135,6 +153,10 @@ describe('Details Page', () => { }); describe('header delete button', () => { + beforeEach(() => { + mountComponent(); + }); + it('exists', () => { expect(findBulkDeleteButton().exists()).toBe(true); }); @@ -182,6 +204,10 @@ describe('Details Page', () => { }); describe('row delete button', () => { + beforeEach(() => { + mountComponent(); + }); + it('exists', () => { expect( findAllDeleteButtons() @@ -213,9 +239,39 @@ describe('Details Page', () => { }); }); }); + + describe('tag cell', () => { + describe('on desktop viewport', () => { + beforeEach(() => { + mountComponent(); + }); + + it('has class w-25', () => { + expect(findFirsTagColumn().classes()).toContain('w-25'); + }); + }); + + describe('on mobile viewport', () => { + beforeEach(() => { + mountComponent({ + data() { + return { isDesktop: false }; + }, + }); + }); + + it('does not has class w-25', () => { + expect(findFirsTagColumn().classes()).not.toContain('w-25'); + }); + }); + }); }); describe('pagination', () => { + beforeEach(() => { + mountComponent(); + }); + it('exists', () => { expect(findPagination().exists()).toBe(true); }); @@ -238,6 +294,10 @@ describe('Details Page', () => { }); describe('modal', () => { + beforeEach(() => { + mountComponent(); + }); + it('exists', () => { expect(findDeleteModal().exists()).toBe(true); }); |