Commit 7148226e authored by Tom Quirk's avatar Tom Quirk

Add test for design item loading state

parent 399964b6
...@@ -415,3 +415,51 @@ exports[`Design management list item component renders item with single comment ...@@ -415,3 +415,51 @@ exports[`Design management list item component renders item with single comment
</div> </div>
</router-link-stub> </router-link-stub>
`; `;
exports[`Design management list item component renders loading spinner when no image prop present 1`] = `
<router-link-stub
class="card cursor-pointer text-plain js-design-list-item design-list-item"
to="[object Object]"
>
<div
class="card-body p-0 d-flex-center overflow-hidden position-relative"
>
<!---->
<glloadingicon-stub
color="orange"
label="Loading"
size="md"
/>
</div>
<div
class="card-footer d-flex w-100"
>
<div
class="d-flex flex-column str-truncated-100"
>
<span
class="bold str-truncated-100"
data-qa-selector="design_file_name"
>
test
</span>
<span
class="str-truncated-100"
>
Updated
<timeago-stub
cssclass=""
time="01-01-2019"
tooltipplacement="bottom"
/>
</span>
</div>
<!---->
</div>
</router-link-stub>
`;
...@@ -9,7 +9,7 @@ const router = new VueRouter(); ...@@ -9,7 +9,7 @@ const router = new VueRouter();
describe('Design management list item component', () => { describe('Design management list item component', () => {
let wrapper; let wrapper;
function createComponent(notesCount = 1, event = 'NONE') { function createComponent(notesCount = 1, event = 'NONE', isLoading = false) {
wrapper = shallowMount(Item, { wrapper = shallowMount(Item, {
sync: false, sync: false,
localVue, localVue,
...@@ -17,7 +17,7 @@ describe('Design management list item component', () => { ...@@ -17,7 +17,7 @@ describe('Design management list item component', () => {
propsData: { propsData: {
id: 1, id: 1,
filename: 'test', filename: 'test',
image: 'http://via.placeholder.com/300', image: isLoading ? '' : 'http://via.placeholder.com/300',
event, event,
notesCount, notesCount,
updatedAt: '01-01-2019', updatedAt: '01-01-2019',
...@@ -71,4 +71,10 @@ describe('Design management list item component', () => { ...@@ -71,4 +71,10 @@ describe('Design management list item component', () => {
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
}); });
it('renders loading spinner when no image prop present', () => {
createComponent(0, 'NONE', true);
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