Commit 5a04f8f7 authored by Nick Kipling's avatar Nick Kipling

Applying reviewer feedback

parent 3b531032
...@@ -96,9 +96,9 @@ export default { ...@@ -96,9 +96,9 @@ export default {
<template v-else> <template v-else>
<div data-qa-selector="packages-table"> <div data-qa-selector="packages-table">
<packages-list-row <packages-list-row
v-for="pk in list" v-for="packageEntity in list"
:key="pk.id" :key="packageEntity.id"
:package-entity="pk" :package-entity="packageEntity"
@packageToDelete="setItemToBeDeleted" @packageToDelete="setItemToBeDeleted"
/> />
</div> </div>
......
...@@ -50,9 +50,10 @@ export default { ...@@ -50,9 +50,10 @@ export default {
<div class="gl-responsive-table-row" data-qa-selector="packages-row"> <div class="gl-responsive-table-row" data-qa-selector="packages-row">
<div class="table-section section-50 d-flex flex-md-column justify-content-between flex-wrap"> <div class="table-section section-50 d-flex flex-md-column justify-content-between flex-wrap">
<div class="d-flex align-items-center mr-2"> <div class="d-flex align-items-center mr-2">
<gl-link :href="packageEntity._links.web_path" class="text-dark font-weight-bold mb-md-1">{{ <gl-link :href="packageEntity._links.web_path" class="text-dark font-weight-bold mb-md-1">
packageEntity.name {{ packageEntity.name }}
}}</gl-link> </gl-link>
<package-tags <package-tags
v-if="packageEntity.tags && packageEntity.tags.length" v-if="packageEntity.tags && packageEntity.tags.length"
class="prepend-left-8" class="prepend-left-8"
......
...@@ -15,7 +15,9 @@ exports[`packages_list_row renders 1`] = ` ...@@ -15,7 +15,9 @@ exports[`packages_list_row renders 1`] = `
class="text-dark font-weight-bold mb-md-1" class="text-dark font-weight-bold mb-md-1"
href="foo" href="foo"
> >
Test package Test package
</gl-link-stub> </gl-link-stub>
<!----> <!---->
......
...@@ -5,6 +5,7 @@ import Tracking from '~/tracking'; ...@@ -5,6 +5,7 @@ import Tracking from '~/tracking';
import { mount, createLocalVue } from '@vue/test-utils'; import { mount, createLocalVue } from '@vue/test-utils';
import PackagesList from 'ee/packages/list/components/packages_list.vue'; import PackagesList from 'ee/packages/list/components/packages_list.vue';
import PackagesListLoader from 'ee/packages/list/components/packages_list_loader.vue'; import PackagesListLoader from 'ee/packages/list/components/packages_list_loader.vue';
import PackagesListRow from 'ee/packages/list/components/packages_list_row.vue';
import * as SharedUtils from 'ee/packages/shared/utils'; import * as SharedUtils from 'ee/packages/shared/utils';
import { TrackingActions } from 'ee/packages/shared/constants'; import { TrackingActions } from 'ee/packages/shared/constants';
import stubChildren from 'helpers/stub_children'; import stubChildren from 'helpers/stub_children';
...@@ -24,6 +25,7 @@ describe('packages_list', () => { ...@@ -24,6 +25,7 @@ describe('packages_list', () => {
const findPackageListPagination = () => wrapper.find(GlPagination); const findPackageListPagination = () => wrapper.find(GlPagination);
const findPackageListDeleteModal = () => wrapper.find(GlModal); const findPackageListDeleteModal = () => wrapper.find(GlModal);
const findEmptySlot = () => wrapper.find({ name: 'empty-slot-stub' }); const findEmptySlot = () => wrapper.find({ name: 'empty-slot-stub' });
const findPackagesListRow = () => wrapper.find(PackagesListRow);
const createStore = (isGroupPage, packages, isLoading) => { const createStore = (isGroupPage, packages, isLoading) => {
const state = { const state = {
...@@ -66,6 +68,7 @@ describe('packages_list', () => { ...@@ -66,6 +68,7 @@ describe('packages_list', () => {
...stubChildren(PackagesList), ...stubChildren(PackagesList),
GlTable, GlTable,
GlSortingItem, GlSortingItem,
GlModal,
}, },
...options, ...options,
}); });
...@@ -130,14 +133,14 @@ describe('packages_list', () => { ...@@ -130,14 +133,14 @@ describe('packages_list', () => {
}); });
it('setItemToBeDeleted sets itemToBeDeleted and open the modal', () => { it('setItemToBeDeleted sets itemToBeDeleted and open the modal', () => {
wrapper.vm.$refs.packageListDeleteModal.show = jest.fn(); const mockModalShow = jest.spyOn(wrapper.vm.$refs.packageListDeleteModal, 'show');
const item = last(wrapper.vm.list); const item = last(wrapper.vm.list);
wrapper.vm.setItemToBeDeleted(item);
findPackagesListRow().vm.$emit('packageToDelete', item);
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(wrapper.vm.itemToBeDeleted).toEqual(item); expect(wrapper.vm.itemToBeDeleted).toEqual(item);
expect(wrapper.vm.$refs.packageListDeleteModal.show).toHaveBeenCalled(); expect(mockModalShow).toHaveBeenCalled();
}); });
}); });
......
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