Commit 0f63ba44 authored by Tom Quirk's avatar Tom Quirk

Default notesCount to 0 in item_spec

0 is more common than 1, so for readability and
ease of use, we are defaulting to 0 now.
parent 01e26e50
...@@ -416,7 +416,7 @@ exports[`Design management list item component with notes renders item with sing ...@@ -416,7 +416,7 @@ exports[`Design management list item component with notes renders item with sing
</router-link-stub> </router-link-stub>
`; `;
exports[`Design management list item component with no notes renders loading spinner when no image prop present 1`] = ` exports[`Design management list item component with no notes renders loading spinner when isLoading is true 1`] = `
<router-link-stub <router-link-stub
class="card cursor-pointer text-plain js-design-list-item design-list-item" class="card cursor-pointer text-plain js-design-list-item design-list-item"
to="[object Object]" to="[object Object]"
......
...@@ -17,7 +17,7 @@ const DESIGN_VERSION_EVENT = { ...@@ -17,7 +17,7 @@ const DESIGN_VERSION_EVENT = {
describe('Design management list item component', () => { describe('Design management list item component', () => {
let wrapper; let wrapper;
function createComponent({ function createComponent({
notesCount = 1, notesCount = 0,
event = DESIGN_VERSION_EVENT.NO_CHANGE, event = DESIGN_VERSION_EVENT.NO_CHANGE,
isLoading = false, isLoading = false,
} = {}) { } = {}) {
...@@ -44,7 +44,7 @@ describe('Design management list item component', () => { ...@@ -44,7 +44,7 @@ describe('Design management list item component', () => {
describe('with notes', () => { describe('with notes', () => {
it('renders item with single comment', () => { it('renders item with single comment', () => {
createComponent(); createComponent({ notesCount: 1 });
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
}); });
...@@ -58,37 +58,37 @@ describe('Design management list item component', () => { ...@@ -58,37 +58,37 @@ describe('Design management list item component', () => {
describe('with no notes', () => { describe('with no notes', () => {
it('hides comment count', () => { it('hides comment count', () => {
createComponent({ notesCount: 0 }); createComponent();
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
}); });
it('renders item with correct status icon for modification event', () => { it('renders item with correct status icon for modification event', () => {
createComponent({ notesCount: 0, event: DESIGN_VERSION_EVENT.MODIFICATION }); createComponent({ event: DESIGN_VERSION_EVENT.MODIFICATION });
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
}); });
it('renders item with correct status icon for deletion event', () => { it('renders item with correct status icon for deletion event', () => {
createComponent({ notesCount: 0, event: DESIGN_VERSION_EVENT.DELETION }); createComponent({ event: DESIGN_VERSION_EVENT.DELETION });
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
}); });
it('renders item with correct status icon for creation event', () => { it('renders item with correct status icon for creation event', () => {
createComponent({ notesCount: 0, event: DESIGN_VERSION_EVENT.CREATION }); createComponent({ event: DESIGN_VERSION_EVENT.CREATION });
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
}); });
it('renders item with no status icon for none event', () => { it('renders item with no status icon for none event', () => {
createComponent({ notesCount: 0 }); createComponent();
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
}); });
it('renders loading spinner when isLoading is true', () => { it('renders loading spinner when isLoading is true', () => {
createComponent({ notesCount: 0, isLoading: true }); createComponent({ isLoading: true });
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
}); });
......
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