diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2019-06-21 10:11:53 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2019-06-21 10:11:53 +0000 |
commit | dff6165e8c7d9e1cadbc7c014136dab1c69df62c (patch) | |
tree | 10c79f7fea1018322ca603d06d91497c10db6775 /spec/frontend | |
parent | 77cb03166d34c25bb3383fac0065e64d544323fc (diff) | |
parent | 91cf0cb2d53b6f48560862fc121f897bb7331046 (diff) | |
download | gitlab-ce-dff6165e8c7d9e1cadbc7c014136dab1c69df62c.tar.gz |
Merge branch 'paginate-license-management' into 'master'
Backport and Docs for Paginate license management and add license search
See merge request gitlab-org/gitlab-ce!27602
Diffstat (limited to 'spec/frontend')
-rw-r--r-- | spec/frontend/vue_shared/components/paginated_list_spec.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/spec/frontend/vue_shared/components/paginated_list_spec.js b/spec/frontend/vue_shared/components/paginated_list_spec.js new file mode 100644 index 00000000000..31ac362d35f --- /dev/null +++ b/spec/frontend/vue_shared/components/paginated_list_spec.js @@ -0,0 +1,56 @@ +import PaginatedList from '~/vue_shared/components/paginated_list.vue'; +import { PREV, NEXT } from '~/vue_shared/components/pagination/constants'; +import { mount } from '@vue/test-utils'; + +describe('Pagination links component', () => { + let wrapper; + let glPaginatedList; + + const template = ` + <div class="slot" slot-scope="{ listItem }"> + <span class="item">Item Name: {{listItem.id}}</span> + </div> + `; + + const props = { + prevText: PREV, + nextText: NEXT, + }; + + beforeEach(() => { + wrapper = mount(PaginatedList, { + scopedSlots: { + default: template, + }, + propsData: { + list: [{ id: 'foo' }, { id: 'bar' }], + props, + }, + }); + + [glPaginatedList] = wrapper.vm.$children; + }); + + afterEach(() => { + wrapper.destroy(); + }); + + describe('Paginated List Component', () => { + describe('props', () => { + // We test attrs and not props because we pass through to child component using v-bind:"$attrs" + it('should pass prevText to GitLab UI paginated list', () => { + expect(glPaginatedList.$attrs['prev-text']).toBe(props.prevText); + }); + it('should pass nextText to GitLab UI paginated list', () => { + expect(glPaginatedList.$attrs['next-text']).toBe(props.nextText); + }); + }); + + describe('rendering', () => { + it('it renders the gl-paginated-list', () => { + expect(wrapper.contains('ul.list-group')).toBe(true); + expect(wrapper.findAll('li.list-group-item').length).toBe(2); + }); + }); + }); +}); |