diff options
Diffstat (limited to 'spec/javascripts/registry/components/collapsible_container_spec.js')
-rw-r--r-- | spec/javascripts/registry/components/collapsible_container_spec.js | 87 |
1 files changed, 7 insertions, 80 deletions
diff --git a/spec/javascripts/registry/components/collapsible_container_spec.js b/spec/javascripts/registry/components/collapsible_container_spec.js index a659f08e250..5891921318a 100644 --- a/spec/javascripts/registry/components/collapsible_container_spec.js +++ b/spec/javascripts/registry/components/collapsible_container_spec.js @@ -1,45 +1,20 @@ import Vue from 'vue'; import collapsibleComponent from '~/registry/components/collapsible_container.vue'; -import mountComponent from '../../helpers/vue_mount_component_helper'; +import store from '~/registry/stores'; +import { repoPropsData } from '../mock_data'; describe('collapsible registry container', () => { let vm; let Component; - let mockData; beforeEach(() => { Component = Vue.extend(collapsibleComponent); - mockData = { - canDelete: true, - destroyPath: 'path', - id: '123', - isLoading: false, - list: [ - { - tag: 'centos6', - revision: 'b118ab5b0e90b7cb5127db31d5321ac14961d097516a8e0e72084b6cdc783b43', - shortRevision: 'b118ab5b0', - size: 19, - layers: 10, - location: 'location', - createdAt: 1505828744434, - destroyPath: 'path', - canDelete: true, - }, - ], - location: 'location', - name: 'foo', - tagsPath: 'path', - pagination: { - perPage: 5, - page: 1, - total: 13, - totalPages: 1, - nextPage: null, - previousPage: null, + vm = new Component({ + store, + propsData: { + repo: repoPropsData, }, - }; - vm = mountComponent(Component, { repo: mockData }); + }).$mount(); }); afterEach(() => { @@ -80,52 +55,4 @@ describe('collapsible registry container', () => { expect(vm.$el.querySelector('.js-remove-repo')).toBeDefined(); }); }); - - describe('registry list', () => { - it('should render a table with the registry list', (done) => { - vm.$el.querySelector('.js-toggle-repo').click(); - - Vue.nextTick(() => { - expect( - vm.$el.querySelectorAll('table tbody tr').length, - ).toEqual(mockData.list.length); - done(); - }); - }); - - it('should render registry tag', (done) => { - vm.$el.querySelector('.js-toggle-repo').click(); - - Vue.nextTick(() => { - const textRendered = vm.$el.querySelector('.table tbody tr').textContent.trim().replace(/\s\s+/g, ' '); - expect(textRendered).toContain(mockData.list[0].tag); - expect(textRendered).toContain(mockData.list[0].shortRevision); - expect(textRendered).toContain(mockData.list[0].layers); - expect(textRendered).toContain(mockData.list[0].size); - done(); - }); - }); - - it('should be possible to delete a registry', (done) => { - vm.$el.querySelector('.js-toggle-repo').click(); - - Vue.nextTick(() => { - expect( - vm.$el.querySelector('.table tbody tr .js-delete-registry'), - ).toBeDefined(); - done(); - }); - }); - - describe('pagination', () => { - it('should be possible to change the page', (done) => { - vm.$el.querySelector('.js-toggle-repo').click(); - - Vue.nextTick(() => { - expect(vm.$el.querySelector('.gl-pagination')).toBeDefined(); - done(); - }); - }); - }); - }); }); |