diff --git a/webapp/.eslintrc.js b/webapp/.eslintrc.js
index 0400fe5f2..f5aa82c81 100644
--- a/webapp/.eslintrc.js
+++ b/webapp/.eslintrc.js
@@ -10,7 +10,7 @@ module.exports = {
},
extends: [
'standard',
- 'plugin:vue/recommended',
+ 'plugin:vue/essential',
'plugin:prettier/recommended'
],
// required to lint *.vue files
@@ -25,7 +25,9 @@ module.exports = {
'no-console': ['error'],
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'vue/component-name-in-template-casing': ['error', 'kebab-case'],
- 'prettier/prettier': ['error'],
+ 'prettier/prettier': ['error', {
+ htmlWhitespaceSensitivity: 'ignore'
+ }],
// 'newline-per-chained-call': [2]
}
}
diff --git a/webapp/Dockerfile b/webapp/Dockerfile
index 7274693a4..fc3b17779 100644
--- a/webapp/Dockerfile
+++ b/webapp/Dockerfile
@@ -1,4 +1,4 @@
-FROM node:10-alpine as base
+FROM node:12.3.1-alpine as base
LABEL Description="Web Frontend of the Social Network Human-Connection.org" Vendor="Human-Connection gGmbH" Version="0.0.1" Maintainer="Human-Connection gGmbH (developer@human-connection.org)"
EXPOSE 3000
@@ -18,7 +18,7 @@ COPY . .
FROM base as build-and-test
RUN cp .env.template .env
-RUN yarn install --production=false --frozen-lockfile --non-interactive
+RUN yarn install --ignore-engines --production=false --frozen-lockfile --non-interactive
RUN yarn run build
FROM base as production
diff --git a/webapp/components/Avatar/Avatar.vue b/webapp/components/Avatar/Avatar.vue
index 2c5cf1ddc..0d997c745 100644
--- a/webapp/components/Avatar/Avatar.vue
+++ b/webapp/components/Avatar/Avatar.vue
@@ -1,10 +1,5 @@
-
+
diff --git a/webapp/components/Upload/spec.js b/webapp/components/Upload/spec.js
index 85215ea59..b81babb6e 100644
--- a/webapp/components/Upload/spec.js
+++ b/webapp/components/Upload/spec.js
@@ -26,6 +26,7 @@ describe('Upload', () => {
success: jest.fn(),
error: jest.fn(),
},
+ $t: jest.fn(),
}
const propsData = {
@@ -34,7 +35,7 @@ describe('Upload', () => {
},
}
- const file = {
+ const fileSuccess = {
filename: 'avatar.jpg',
previewElement: {
classList: {
@@ -59,13 +60,38 @@ describe('Upload', () => {
wrapper = shallowMount(Upload, { localVue, propsData, mocks })
})
+ afterEach(() => {
+ jest.clearAllMocks()
+ })
+
it('sends a the UpdateUser mutation when vddrop is called', () => {
wrapper.vm.vddrop([{ filename: 'avatar.jpg' }])
expect(mocks.$apollo.mutate).toHaveBeenCalledTimes(1)
})
it('thumbnail', () => {
- wrapper.vm.thumbnail(file, dataUrl)
- expect(file.previewElement.classList.add).toHaveBeenCalledTimes(1)
+ wrapper.vm.thumbnail(fileSuccess, dataUrl)
+ expect(fileSuccess.previewElement.classList.add).toHaveBeenCalledTimes(1)
+ })
+
+ describe('error handling', () => {
+ const message = 'File upload failed'
+ const fileError = { status: 'error' }
+
+ it('defaults to error false', () => {
+ expect(wrapper.vm.error).toEqual(false)
+ })
+
+ it('shows an error toaster when verror is called', () => {
+ wrapper.vm.verror(fileError, message)
+ expect(mocks.$toast.error).toHaveBeenCalledWith(fileError.status, message)
+ })
+
+ it('changes error status from false to true to false', () => {
+ wrapper.vm.verror(fileError, message)
+ expect(wrapper.vm.error).toEqual(true)
+ jest.runAllTimers()
+ expect(wrapper.vm.error).toEqual(false)
+ })
})
})
diff --git a/webapp/components/User/index.vue b/webapp/components/User/index.vue
index fd435d0c5..7841fe596 100644
--- a/webapp/components/User/index.vue
+++ b/webapp/components/User/index.vue
@@ -6,53 +6,24 @@
- {{ $t('profile.userAnonym') }}
+ {{ $t('profile.userAnonym') }}
-
-
-
-
+
+
+
+
-
+
- {{ userName | truncate(18) }}
+ {{ userName | truncate(18) }}
-
-
+
+
@@ -64,10 +35,7 @@
-
+
-
+
@@ -106,20 +70,16 @@
-
-
+
+
user.followedByCurrentUser = follow"
- @update="follow => user.followedByCurrentUser = follow"
+ @optimistic="follow => (user.followedByCurrentUser = follow)"
+ @update="follow => (user.followedByCurrentUser = follow)"
/>
-
+
diff --git a/webapp/components/comments/CommentForm/index.vue b/webapp/components/comments/CommentForm/index.vue
index f16c31ae3..f105bd5ff 100644
--- a/webapp/components/comments/CommentForm/index.vue
+++ b/webapp/components/comments/CommentForm/index.vue
@@ -1,36 +1,18 @@
-
+
-
+
-
+
{{ $t('actions.cancel') }}
-
+
{{ $t('post.comment.submit') }}
diff --git a/webapp/components/comments/CommentList/index.vue b/webapp/components/comments/CommentList/index.vue
index 6b81bebdf..d127bab47 100644
--- a/webapp/components/comments/CommentList/index.vue
+++ b/webapp/components/comments/CommentList/index.vue
@@ -9,15 +9,14 @@
color="primary"
size="small"
round
- >{{ comments.length }} Comments
+ >
+ {{ comments.length }}
+
+ Comments
-