summaryrefslogtreecommitdiff
path: root/spec/frontend/boards/components/board_column_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/boards/components/board_column_spec.js')
-rw-r--r--spec/frontend/boards/components/board_column_spec.js37
1 files changed, 35 insertions, 2 deletions
diff --git a/spec/frontend/boards/components/board_column_spec.js b/spec/frontend/boards/components/board_column_spec.js
index 4e523d636cd..f1964daa8b2 100644
--- a/spec/frontend/boards/components/board_column_spec.js
+++ b/spec/frontend/boards/components/board_column_spec.js
@@ -15,6 +15,10 @@ describe('Board Column Component', () => {
wrapper = null;
});
+ const initStore = () => {
+ store = createStore();
+ };
+
const createComponent = ({ listType = ListType.backlog, collapsed = false } = {}) => {
const boardId = '1';
@@ -29,8 +33,6 @@ describe('Board Column Component', () => {
listMock.assignee = {};
}
- store = createStore();
-
wrapper = shallowMount(BoardColumn, {
store,
propsData: {
@@ -47,6 +49,10 @@ describe('Board Column Component', () => {
const isCollapsed = () => wrapper.classes('is-collapsed');
describe('Given different list types', () => {
+ beforeEach(() => {
+ initStore();
+ });
+
it('is expandable when List Type is `backlog`', () => {
createComponent({ listType: ListType.backlog });
@@ -79,4 +85,31 @@ describe('Board Column Component', () => {
expect(wrapper.element.scrollIntoView).toHaveBeenCalled();
});
});
+
+ describe('on mount', () => {
+ beforeEach(async () => {
+ initStore();
+ jest.spyOn(store, 'dispatch').mockImplementation();
+ });
+
+ describe('when list is collapsed', () => {
+ it('does not call fetchItemsForList when', async () => {
+ createComponent({ collapsed: true });
+
+ await nextTick();
+
+ expect(store.dispatch).toHaveBeenCalledTimes(0);
+ });
+ });
+
+ describe('when the list is not collapsed', () => {
+ it('calls fetchItemsForList when', async () => {
+ createComponent({ collapsed: false });
+
+ await nextTick();
+
+ expect(store.dispatch).toHaveBeenCalledWith('fetchItemsForList', { listId: 300 });
+ });
+ });
+ });
});