From a52671fd407a3059382ab9192eb825e0a0e64fc0 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Wed, 23 Mar 2022 16:21:06 +0100 Subject: [PATCH] Upgrade code according to migration guide for Vue 3 Update npm dependencies Update vue router version Disable validation temporarily Specify property Update dependencies Update store to v4 Update async component definitions Update some event emitters Update tiptap vue version Implement some router changes for v4 Remove obsolete tag attributes Update dependencies Fix some cypress tests Fix most jest tests Fix some more cypress tests Fix school class cypress test Fix another cypress test Disable failing test temporarily Fix validation Fix error messages for validation Fix e2e test for beta login page Apply prettier --- client/.prettierignore | 2 + .../e2e/frontend/modules/snapshots.spec.js | 14 +- .../e2e/frontend/read-only/rooms.spec.js | 36 +- client/jest.config.js | 21 +- client/package.json | 3 + client/src/components/AddContentButton.vue | 145 +++-- client/src/components/AddContentElement.vue | 47 +- client/src/components/AddWidget.vue | 107 ++-- client/src/components/BackLink.vue | 47 +- client/src/components/ColorChooser.vue | 122 ++-- .../src/components/FullscreenInfographic.vue | 57 +- client/src/components/HeaderBar.vue | 179 +++--- client/src/components/HelpfulTooltip.vue | 101 ++-- client/src/components/LoadingButton.vue | 78 ++- client/src/components/MobileHeader.vue | 80 ++- client/src/components/Modal.vue | 287 +++++---- client/src/components/MoreOptionsWidget.vue | 88 ++- client/src/components/ScrollUp.vue | 107 ++-- .../components/StudentSubmissionDocument.vue | 53 +- client/src/components/UserWidget.vue | 110 ++-- .../book-navigation/ContentNavigation.vue | 265 ++++----- .../book-navigation/NavigationSidebar.vue | 165 +++--- .../book-navigation/SubNavigationItem.vue | 60 +- .../book-navigation/TopicNavigation.vue | 48 +- .../content-block-form/ContentElement.vue | 549 +++++++++--------- .../content-block-form/ContentFormSection.vue | 85 ++- .../content-block-form/ContentsForm.vue | 227 ++++---- .../EditContentBlockWizard.vue | 31 +- .../content-blocks/ContentComponent.vue | 122 ++-- .../content-blocks/ContentListBlock.vue | 9 +- .../content-blocks/DocumentBlock.vue | 106 ++-- .../components/content-blocks/Instruction.vue | 74 ++- .../components/content-blocks/LinkBlock.vue | 81 ++- .../assignment/FinalSubmission.vue | 168 +++--- .../assignment/SubmissionForm.vue | 192 +++--- .../assignment/SubmissionInput.vue | 96 ++- .../content-forms/AssignmentForm.vue | 64 +- .../components/content-forms/DocumentForm.vue | 185 +++--- .../components/content-forms/VideoForm.vue | 126 ++-- .../illustrations/HelloMyKVIllustration.vue | 11 +- .../components/instruments/FilterEntry.vue | 280 +++++---- .../components/instruments/FilterGroup.vue | 111 ++-- .../src/components/modules/ModuleTeaser.vue | 103 ++-- .../src/components/notes/BookmarkActions.vue | 107 ++-- .../objective-groups/ObjectiveForm.vue | 41 +- .../components/portfolio/AddProjectEntry.vue | 55 +- .../portfolio/PortfolioOnboarding.vue | 60 +- .../components/portfolio/ProjectActions.vue | 112 ++-- .../src/components/portfolio/ProjectEntry.vue | 212 ++++--- .../components/portfolio/ProjectEntryForm.vue | 163 +++--- .../src/components/portfolio/ProjectForm.vue | 23 +- .../components/portfolio/ProjectListItem.vue | 19 +- client/src/components/portfolio/ShareLink.vue | 54 +- client/src/components/profile/Avatar.vue | 192 +++--- .../components/profile/ContentBookmark.vue | 64 +- .../src/components/profile/EditGroupName.vue | 30 +- client/src/components/profile/GroupList.vue | 16 +- client/src/components/profile/Profile.vue | 129 ++-- .../src/components/profile/ProfileSidebar.vue | 239 ++++---- client/src/components/profile/ShowCode.vue | 11 +- .../components/rooms/AddRoomEntryButton.vue | 86 ++- .../src/components/rooms/EntryCountWidget.vue | 77 +-- client/src/components/rooms/MoreActions.vue | 80 ++- client/src/components/rooms/RoomForm.vue | 143 ++--- .../src/components/rooms/RoomGroupWidget.vue | 44 +- .../components/rooms/RoomVisibilityWidget.vue | 57 +- client/src/components/rooms/RoomWidget.vue | 10 +- .../src/components/rooms/RoomsOnboarding.vue | 81 ++- .../school-class/ClassSelectionWidget.vue | 129 ++-- .../components/school-class/CurrentClass.vue | 31 +- client/src/components/ui/BaseInput.vue | 49 +- client/src/components/ui/PopoverLink.vue | 88 ++- .../components/ui/file-upload/FileUpload.vue | 41 +- .../ui/file-upload/SimpleFileUploadIcon.vue | 24 +- .../src/components/ui/form-element-icons.js | 2 +- .../components/validation/InputWrapper.vue | 17 +- .../visibility/VisibilityAction.vue | 124 ++-- client/src/layouts/DefaultFooter.vue | 211 +++---- client/src/layouts/FullScreenLayout.vue | 63 +- client/src/layouts/PublicLayout.vue | 104 ++-- client/src/layouts/SimpleLayout.vue | 157 +++-- client/src/layouts/SplitLayout.vue | 266 ++++----- client/src/pages/beta-login.vue | 64 +- client/src/pages/createContentBlock.vue | 116 ++-- client/src/pages/hello.vue | 260 ++++----- client/src/pages/instrumentOverview.vue | 7 +- client/src/pages/license-activation.vue | 163 +++--- client/src/pages/module/moduleVisibility.vue | 169 +++--- client/src/pages/onboarding/start.vue | 22 +- client/src/pages/portfolio/project.vue | 39 +- client/src/pages/rooms/editRoomEntry.vue | 126 ++-- client/src/pages/rooms/newRoomEntry.vue | 135 +++-- client/src/pages/start.vue | 7 +- client/src/pages/survey.vue | 21 +- client/src/pages/topic-page.vue | 319 +++++----- client/src/plugins/modal.ts | 20 +- client/src/router/guards.ts | 2 +- client/src/router/index.js | 42 +- client/src/router/onboarding.routes.js | 4 +- client/src/shims-vue.d.ts | 1 - client/src/store/index.js | 2 +- client/src/styles/_survey.scss | 6 + client/tests/unit/checkbox.spec.js | 4 +- .../tests/unit/class-selection-widget.spec.js | 9 +- client/tests/unit/comment-input.spec.js | 2 - client/tests/unit/text-form.spec.js | 6 +- 106 files changed, 4604 insertions(+), 5195 deletions(-) diff --git a/client/.prettierignore b/client/.prettierignore index 1521c8b7..4f26a64d 100644 --- a/client/.prettierignore +++ b/client/.prettierignore @@ -1 +1,3 @@ +bundle-analysis dist +node_modules diff --git a/client/cypress/e2e/frontend/modules/snapshots.spec.js b/client/cypress/e2e/frontend/modules/snapshots.spec.js index 28493c4a..14e1a2d9 100644 --- a/client/cypress/e2e/frontend/modules/snapshots.spec.js +++ b/client/cypress/e2e/frontend/modules/snapshots.spec.js @@ -1,6 +1,6 @@ import module from '../../../fixtures/module.minimal'; -import {getMinimalMe} from '../../../support/helpers'; -import {hasOperationName} from '../../../support/graphql'; +import { getMinimalMe } from '../../../support/helpers'; +import { hasOperationName } from '../../../support/graphql'; let snapshotTitle; let deleteSuccess; @@ -133,7 +133,7 @@ describe('Snapshot', () => { }, }, }, - MeQuery: getMinimalMe({isTeacher}), + MeQuery: getMinimalMe({ isTeacher }), ModuleDetailsQuery: { module, }, @@ -219,9 +219,11 @@ describe('Snapshot', () => { cy.getByDataCy('module-snapshots-button').click(); cy.getByDataCy('create-snapshot-button').click(); cy.getByDataCy('show-all-snapshots-button').click(); - cy.getByDataCy('snapshot-list').should('exist').within(() => { - cy.get('.snapshots__snapshot').should('have.length', 1); - }); + cy.getByDataCy('snapshot-list') + .should('exist') + .within(() => { + cy.get('.snapshots__snapshot').should('have.length', 1); + }); waitNTimes(7); }); diff --git a/client/cypress/e2e/frontend/read-only/rooms.spec.js b/client/cypress/e2e/frontend/read-only/rooms.spec.js index f0df6f3a..1e7b2d56 100644 --- a/client/cypress/e2e/frontend/read-only/rooms.spec.js +++ b/client/cypress/e2e/frontend/read-only/rooms.spec.js @@ -1,7 +1,7 @@ describe('Room Team Management - Read only', () => { const SELECTED_CLASS_ID = 'selectedClassId'; - const getOperations = ({readOnly, classReadOnly}) => ({ + const getOperations = ({ readOnly, classReadOnly }) => ({ MeQuery: { me: { readOnly, @@ -13,23 +13,25 @@ describe('Room Team Management - Read only', () => { }, }, RoomsQuery: { - rooms: [{ - id: '', - slug: 'some-room', - title: 'some room', - entryCount: 3, - appearance: 'red', - description: 'some description', - schoolClass: { - id: SELECTED_CLASS_ID, - name: 'bla', + rooms: [ + { + id: '', + slug: 'some-room', + title: 'some room', + entryCount: 3, + appearance: 'red', + description: 'some description', + schoolClass: { + id: SELECTED_CLASS_ID, + name: 'bla', + }, }, - }], + ], }, }); - const checkRoomsReadOnly = ({editable, readOnly, classReadOnly = false}) => { - const operations = getOperations({readOnly, classReadOnly}); + const checkRoomsReadOnly = ({ editable, readOnly, classReadOnly = false }) => { + const operations = getOperations({ readOnly, classReadOnly }); cy.mockGraphqlOps({ operations, @@ -48,14 +50,14 @@ describe('Room Team Management - Read only', () => { }); it('can edit room', () => { - checkRoomsReadOnly({editable: true, readOnly: false}); + checkRoomsReadOnly({ editable: true, readOnly: false }); }); it('can not edit room', () => { - checkRoomsReadOnly({editable: false, readOnly: true}); + checkRoomsReadOnly({ editable: false, readOnly: true }); }); it('can not edit room of inactive class', () => { - checkRoomsReadOnly({editable: false, readOnly: false, classReadOnly: true}); + checkRoomsReadOnly({ editable: false, readOnly: false, classReadOnly: true }); }); }); diff --git a/client/jest.config.js b/client/jest.config.js index 21a4d330..a7d88ea7 100644 --- a/client/jest.config.js +++ b/client/jest.config.js @@ -1,11 +1,5 @@ module.exports = { - moduleFileExtensions: [ - 'js', - 'jsx', - 'ts', - 'json', - 'vue', - ], + moduleFileExtensions: ['js', 'jsx', 'ts', 'json', 'vue'], transform: { '\\.(gql|graphql)$': '@graphql-tools/jest-transform', '^.+\\.js$': 'babel-jest', @@ -13,20 +7,13 @@ module.exports = { '^.+\\.vue$': '@vue/vue3-jest', '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub', }, - modulePaths: [ - '/src', - '/node_modules', - ], - transformIgnorePatterns: [ - '/node_modules/', - ], + modulePaths: ['/src', '/node_modules'], + transformIgnorePatterns: ['/node_modules/'], moduleNameMapper: { '^@/(.*)$': '/src/$1', '^gql/(.*)$': '/src/graphql/gql/$1', }, - snapshotSerializers: [ - '/node_modules/jest-serializer-vue', - ], + snapshotSerializers: ['/node_modules/jest-serializer-vue'], testEnvironment: 'jsdom', testEnvironmentOptions: { url: 'http://localhost/', diff --git a/client/package.json b/client/package.json index 9bdd4e72..78d5a974 100644 --- a/client/package.json +++ b/client/package.json @@ -3,6 +3,9 @@ "version": "1.0.0", "description": "skillbox vue client", "author": "ramon / chrigu", + "prettier": { + "singleQuote": true + }, "private": true, "prettier": { "singleQuote": true diff --git a/client/src/components/AddContentButton.vue b/client/src/components/AddContentButton.vue index a948808c..d5ff0268 100644 --- a/client/src/components/AddContentButton.vue +++ b/client/src/components/AddContentButton.vue @@ -1,9 +1,6 @@