Commit 6f31efaf authored by Justin Ho's avatar Justin Ho

Add specs for collapsed sidebar

Clean up sidebar specs to be more consistent
parent fb8b7c25
......@@ -55,7 +55,11 @@ export default {
<template>
<div class="block">
<div v-gl-tooltip.html="dueDateTooltipProps" class="sidebar-collapsed-icon">
<div
v-gl-tooltip.html="dueDateTooltipProps"
class="sidebar-collapsed-icon"
data-testid="due-date-collapsed"
>
<gl-icon name="calendar" />
<span v-if="dueDate">{{ dueDateInWords }}</span>
<span v-else>{{ $options.i18n.none }}</span>
......
......@@ -23,12 +23,14 @@ describe('IssueDueDate', () => {
}
});
const findDueDateCollapsed = () => wrapper.findByTestId('due-date-collapsed');
const findDueDateValue = () => wrapper.findByTestId('due-date-value');
describe('when dueDate is null', () => {
it('renders "None" as value', () => {
createComponent();
expect(findDueDateCollapsed().text()).toBe('None');
expect(findDueDateValue().text()).toBe('None');
});
});
......@@ -45,6 +47,7 @@ describe('IssueDueDate', () => {
},
});
expect(findDueDateCollapsed().text()).toBe('Feb 14, 2021');
expect(findDueDateValue().text()).toBe('Feb 14, 2021 (Past due)');
});
});
......@@ -61,6 +64,7 @@ describe('IssueDueDate', () => {
},
});
expect(findDueDateCollapsed().text()).toBe('Feb 14, 2021');
expect(findDueDateValue().text()).toBe('Feb 14, 2021');
});
});
......
......@@ -38,24 +38,21 @@ describe('JiraIssuesSidebar', () => {
it('renders Labels block', () => {
createComponent();
expect(findLabelsSelect().exists()).toBe(true);
expect(findLabelsSelect().props('selectedLabels')).toEqual(mockJiraIssue.labels);
expect(findLabelsSelect().props('selectedLabels')).toBe(mockJiraIssue.labels);
});
it('renders Assignee block', () => {
createComponent();
const assignee = findAssignee();
expect(assignee.exists()).toBe(true);
expect(assignee.props('assignee')).toEqual(mockJiraIssue.assignees[0]);
expect(assignee.props('assignee')).toBe(mockJiraIssue.assignees[0]);
});
it('renders IssueDueDate', () => {
createComponent();
const dueDate = findIssueDueDate();
expect(dueDate.exists()).toBe(true);
expect(dueDate.props('dueDate')).toEqual(mockJiraIssue.dueDate);
expect(dueDate.props('dueDate')).toBe(mockJiraIssue.dueDate);
});
describe('when references.relative is null', () => {
......
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