Fix Specs, lint, fix test

This commit is contained in:
senderfm 2019-06-18 09:58:29 +02:00
parent 00286ef6b9
commit 0a66ad56d9
3 changed files with 14 additions and 3 deletions

View File

@ -86,7 +86,7 @@ describe('CommentList.vue', () => {
})
it('displays comments when there are comments to display', () => {
expect(wrapper.find('div#comments').text()).toEqual('this is a comment')
expect(wrapper.find('div.comments').text()).toEqual('this is a comment')
})
it("refetches a post's comments from the backend", () => {

View File

@ -1,5 +1,5 @@
<template>
<div>
<div id="comments">
<h3 style="margin-top: -10px;">
<span>
<ds-icon name="comments" />
@ -16,7 +16,7 @@
</span>
</h3>
<ds-space margin-bottom="large" />
<div v-if="comments && comments.length" id="comments" class="comments">
<div v-if="comments && comments.length" class="comments">
<comment
v-for="(comment, index) in comments"
:key="comment.id"

View File

@ -77,6 +77,17 @@ export default {
]
},
},
watch: {
$route(to, from) {
if (to.hash === '#comments') {
window.scroll({
top: document.getElementById('comments').offsetTop,
left: 0,
behavior: 'smooth',
})
}
},
},
}
</script>