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