Commit 1284ea5a authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'upgrade-bootstrap-vue/specs-update-registry' into 'master'

Prepare registry specs for BootstrapVue upgrade

See merge request gitlab-org/gitlab!20504
parents 1e661088 bf514965
...@@ -39,6 +39,8 @@ describe('Registry List', () => { ...@@ -39,6 +39,8 @@ describe('Registry List', () => {
// See https://github.com/vuejs/vue-test-utils/issues/532. // See https://github.com/vuejs/vue-test-utils/issues/532.
Vue.config.silent = true; Vue.config.silent = true;
wrapper = mount(registry, { wrapper = mount(registry, {
attachToDocument: true,
sync: false,
propsData, propsData,
computed: { computed: {
repos() { repos() {
...@@ -67,6 +69,8 @@ describe('Registry List', () => { ...@@ -67,6 +69,8 @@ describe('Registry List', () => {
let localWrapper; let localWrapper;
beforeEach(() => { beforeEach(() => {
localWrapper = mount(registry, { localWrapper = mount(registry, {
attachToDocument: true,
sync: false,
propsData, propsData,
computed: { computed: {
repos() { repos() {
......
...@@ -22,7 +22,14 @@ describe('collapsible registry container', () => { ...@@ -22,7 +22,14 @@ describe('collapsible registry container', () => {
const findToggleRepos = (w = wrapper) => w.findAll('.js-toggle-repo'); const findToggleRepos = (w = wrapper) => w.findAll('.js-toggle-repo');
const findDeleteModal = (w = wrapper) => w.find({ ref: 'deleteModal' }); const findDeleteModal = (w = wrapper) => w.find({ ref: 'deleteModal' });
const mountWithStore = config => mount(collapsibleComponent, { ...config, store, localVue }); const mountWithStore = config =>
mount(collapsibleComponent, {
...config,
store,
localVue,
attachToDocument: true,
sync: false,
});
beforeEach(() => { beforeEach(() => {
createFlash.mockClear(); createFlash.mockClear();
...@@ -63,12 +70,15 @@ describe('collapsible registry container', () => { ...@@ -63,12 +70,15 @@ describe('collapsible registry container', () => {
it('should be closed by default', () => { it('should be closed by default', () => {
expectIsClosed(); expectIsClosed();
}); });
it('should be open when user clicks on closed repo', () => { it('should be open when user clicks on closed repo', done => {
const toggleRepos = findToggleRepos(wrapper); const toggleRepos = findToggleRepos(wrapper);
toggleRepos.at(0).trigger('click'); toggleRepos.at(0).trigger('click');
const container = findContainerImageTags(wrapper); Vue.nextTick(() => {
expect(container.exists()).toBe(true); const container = findContainerImageTags(wrapper);
expect(wrapper.vm.fetchList).toHaveBeenCalled(); expect(container.exists()).toBe(true);
expect(wrapper.vm.fetchList).toHaveBeenCalled();
done();
});
}); });
it('should be closed when the user clicks on an opened repo', done => { it('should be closed when the user clicks on an opened repo', done => {
const toggleRepos = findToggleRepos(wrapper); const toggleRepos = findToggleRepos(wrapper);
......
...@@ -6,6 +6,8 @@ describe('Registry Project Empty state', () => { ...@@ -6,6 +6,8 @@ describe('Registry Project Empty state', () => {
beforeEach(() => { beforeEach(() => {
wrapper = mount(projectEmptyState, { wrapper = mount(projectEmptyState, {
attachToDocument: true,
sync: false,
propsData: { propsData: {
noContainersImage: 'imageUrl', noContainersImage: 'imageUrl',
helpPagePath: 'help', helpPagePath: 'help',
......
...@@ -28,7 +28,8 @@ describe('table registry', () => { ...@@ -28,7 +28,8 @@ describe('table registry', () => {
const findImageId = (w = wrapper) => w.find({ ref: 'imageId' }); const findImageId = (w = wrapper) => w.find({ ref: 'imageId' });
const bulkDeletePath = 'path'; const bulkDeletePath = 'path';
const mountWithStore = config => mount(tableRegistry, { ...config, store, localVue }); const mountWithStore = config =>
mount(tableRegistry, { ...config, store, localVue, attachToDocument: true, sync: false });
beforeEach(() => { beforeEach(() => {
// This is needed due to console.error called by vue to emit a warning that stop the tests // This is needed due to console.error called by vue to emit a warning that stop the tests
...@@ -196,7 +197,7 @@ describe('table registry', () => { ...@@ -196,7 +197,7 @@ describe('table registry', () => {
expect(wrapper.vm.handleSingleDelete).toHaveBeenCalledWith(repoPropsData.list[0]); expect(wrapper.vm.handleSingleDelete).toHaveBeenCalledWith(repoPropsData.list[0]);
expect(wrapper.vm.handleMultipleDelete).not.toHaveBeenCalled(); expect(wrapper.vm.handleMultipleDelete).not.toHaveBeenCalled();
}); });
it('on ok when multiple items are selected should call muultiDelete', () => { it('on ok when multiple items are selected should call multiDelete', () => {
wrapper.setData({ itemsToBeDeleted: [0, 1, 2] }); wrapper.setData({ itemsToBeDeleted: [0, 1, 2] });
wrapper.vm.onDeletionConfirmed(); wrapper.vm.onDeletionConfirmed();
......
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