From ffe6dc7736013f61336c8035b9ad30e0fdd2c487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Fri, 2 Aug 2019 13:33:09 +0200 Subject: [PATCH] Add MutationObserver to fix tests Our build server failed because of frontend tests. However, all our fullstack tests are passing... So maybe an issue in our test setup, not reproducible in a real browser? This commit: https://github.com/scrumpy/tiptap/commit/ee4f132b0f5a82575c1c7c2db093d0c3dd49a01b#diff-0806c5f3fdae5e139222967601c7faca adds MutationObserver to their test setup. Adding it to our test suites that touch the `editor` directly fixes our tests, too! From what I can tell is that prosemirror is calling `this.observer.takeRecords()`. Probably `tiptap` updated its dependencies at some point and that's where `this.observer` was introduced? Hard to tell. It really looks just like an issue only present in test environments, so I think it's safe not to investigate any further. --- .../ContributionForm/ContributionForm.spec.js | 3 ++ webapp/components/Editor/Editor.spec.js | 4 +- .../components/comments/CommentForm/spec.js | 3 ++ webapp/package.json | 5 ++- webapp/yarn.lock | 41 +++++++++++-------- 5 files changed, 37 insertions(+), 19 deletions(-) diff --git a/webapp/components/ContributionForm/ContributionForm.spec.js b/webapp/components/ContributionForm/ContributionForm.spec.js index 3f9384d27..199d6ab18 100644 --- a/webapp/components/ContributionForm/ContributionForm.spec.js +++ b/webapp/components/ContributionForm/ContributionForm.spec.js @@ -6,6 +6,9 @@ import PostMutations from '~/graphql/PostMutations.js' import CategoriesSelect from '~/components/CategoriesSelect/CategoriesSelect' import Filters from '~/plugins/vue-filters' import TeaserImage from '~/components/TeaserImage/TeaserImage' +import MutationObserver from 'mutation-observer' + +global.MutationObserver = MutationObserver const localVue = createLocalVue() diff --git a/webapp/components/Editor/Editor.spec.js b/webapp/components/Editor/Editor.spec.js index d457609bd..866b96aba 100644 --- a/webapp/components/Editor/Editor.spec.js +++ b/webapp/components/Editor/Editor.spec.js @@ -1,8 +1,10 @@ import { mount, createLocalVue } from '@vue/test-utils' import Editor from './Editor' import Vuex from 'vuex' - import Styleguide from '@human-connection/styleguide' +import MutationObserver from 'mutation-observer' + +global.MutationObserver = MutationObserver const localVue = createLocalVue() localVue.use(Vuex) diff --git a/webapp/components/comments/CommentForm/spec.js b/webapp/components/comments/CommentForm/spec.js index 8420c97ba..2d212c91d 100644 --- a/webapp/components/comments/CommentForm/spec.js +++ b/webapp/components/comments/CommentForm/spec.js @@ -2,6 +2,9 @@ import { mount, createLocalVue } from '@vue/test-utils' import CommentForm from './index.vue' import Styleguide from '@human-connection/styleguide' import Vuex from 'vuex' +import MutationObserver from 'mutation-observer' + +global.MutationObserver = MutationObserver const localVue = createLocalVue() localVue.use(Vuex) diff --git a/webapp/package.json b/webapp/package.json index c2ec400c6..a8fda5905 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -70,8 +70,8 @@ "nuxt-env": "~0.1.0", "stack-utils": "^1.0.2", "string-hash": "^1.1.3", - "tiptap": "1.24.0", - "tiptap-extensions": "1.22.2", + "tiptap": "~1.24.0", + "tiptap-extensions": "~1.26.0", "v-tooltip": "~2.0.2", "vue-count-to": "~1.0.13", "vue-izitoast": "1.1.2", @@ -104,6 +104,7 @@ "flush-promises": "^1.0.2", "fuse.js": "^3.4.5", "jest": "~24.8.0", + "mutation-observer": "^1.0.3", "node-sass": "~4.12.0", "nodemon": "~1.19.1", "prettier": "~1.18.2", diff --git a/webapp/yarn.lock b/webapp/yarn.lock index 76ec9ff29..596fdc05f 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -8472,6 +8472,11 @@ mustache@^2.3.0: resolved "https://registry.yarnpkg.com/mustache/-/mustache-2.3.2.tgz#a6d4d9c3f91d13359ab889a812954f9230a3d0c5" integrity sha512-KpMNwdQsYz3O/SBS1qJ/o3sqUJ5wSb8gb0pul8CO0S56b9Y2ALm8zCfsjPXsqGFfoNBkDwZuZIAjhsZI03gYVQ== +mutation-observer@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/mutation-observer/-/mutation-observer-1.0.3.tgz#42e9222b101bca82e5ba9d5a7acf4a14c0f263d0" + integrity sha512-M/O/4rF2h776hV7qGMZUH3utZLO/jK7p8rnNgGkjKUw8zCGjRQPxB8z6+5l8+VjRUQ3dNYu4vjqXYLr+U8ZVNA== + mute-stream@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" @@ -10313,17 +10318,21 @@ prosemirror-transform@^1.0.0, prosemirror-transform@^1.1.0, prosemirror-transfor dependencies: prosemirror-model "^1.0.0" -prosemirror-utils@^0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/prosemirror-utils/-/prosemirror-utils-0.9.0.tgz#3ab616c94ccd61fcb18968f0d5aa273a9f1f28e4" - integrity sha512-YcvmHcq7phbn+OagJSvmne92qZG9dOVfb3zfuA1HuyWUif3hUDt2Yfu299BHqVkEkUCF6FN7Gi9folDQntMhxA== - prosemirror-utils@^0.9.4: version "0.9.5" resolved "https://registry.yarnpkg.com/prosemirror-utils/-/prosemirror-utils-0.9.5.tgz#34d7e5bc12f3e6774261cc664bac9499899663d4" integrity sha512-JT3H//Cq2ljNhWadMYRMdlNj2gylFA7L4RC0zmUF9l0IgDpc/gTpPRCmfcDUomDgCrciz57C3MCnZ+058hSTaA== -prosemirror-view@^1.0.0, prosemirror-view@^1.1.0, prosemirror-view@^1.9.12, prosemirror-view@^1.9.8: +prosemirror-view@^1.0.0, prosemirror-view@^1.1.0: + version "1.9.8" + resolved "https://registry.yarnpkg.com/prosemirror-view/-/prosemirror-view-1.9.8.tgz#47b961204a0b2e8ff87370c270d4f82598e81273" + integrity sha512-yS4yrqxydvi7ddz9VFLeJgbfVd5g3/bMcRxb1PbWtG0i9OrPSsiHaEBJHLVeTbraGqRlAu+tbNLakO7RhUhp1w== + dependencies: + prosemirror-model "^1.1.0" + prosemirror-state "^1.0.0" + prosemirror-transform "^1.1.0" + +prosemirror-view@^1.9.12: version "1.9.13" resolved "https://registry.yarnpkg.com/prosemirror-view/-/prosemirror-view-1.9.13.tgz#8f146038e776fd0aa6d7811c8b9cb11813b9e319" integrity sha512-afJxCZR4EH04u4thl7xYHSIgyQiGALstLi+5SW9t3868ghrgcFhpQvbJAN17Yb9nwtnltD64t15Msk2UlXkPeQ== @@ -11952,7 +11961,7 @@ tippy.js@^4.3.5: dependencies: popper.js "^1.14.7" -tiptap-commands@^1.10.11, tiptap-commands@^1.10.7: +tiptap-commands@^1.10.11: version "1.10.11" resolved "https://registry.yarnpkg.com/tiptap-commands/-/tiptap-commands-1.10.11.tgz#9df1ef7b553e601598892074f9faa6d836fd8238" integrity sha512-SD1Ep18qKGiCOodUttQrJtOfEC4/sx1pQWfROc4t8xeuxS5FLcrXZ+u9mELRSHkBJ+nDAJsn/ewG+yo58T1+Xg== @@ -11966,10 +11975,10 @@ tiptap-commands@^1.10.11, tiptap-commands@^1.10.7: prosemirror-utils "^0.9.4" tiptap-utils "^1.6.0" -tiptap-extensions@1.22.2: - version "1.22.2" - resolved "https://registry.yarnpkg.com/tiptap-extensions/-/tiptap-extensions-1.22.2.tgz#66b24ef63653481da16419efdf6459c7a9f518f7" - integrity sha512-JJe2yAnbaKBWO/16+lfFphePphG9UYhp3wAUkzhSefJx3dtIdDfCmp5jBzZ6NLahUHNT/Z9WeYdhQmngAeVhoA== +tiptap-extensions@~1.26.0: + version "1.26.0" + resolved "https://registry.yarnpkg.com/tiptap-extensions/-/tiptap-extensions-1.26.0.tgz#d3ee033d121c7243a7e8648c69ec6343a2853ccc" + integrity sha512-icQYbfl6Cu3XkAoz9y+4x1URuB/EzryF2rZT6GsURghcelaxpjIPoMDBMyi00zlSIKJUvkS14NbnjJ2eT0CG6w== dependencies: lowlight "^1.12.1" prosemirror-collab "^1.1.2" @@ -11978,10 +11987,10 @@ tiptap-extensions@1.22.2: prosemirror-state "^1.2.3" prosemirror-tables "^0.8.1" prosemirror-transform "^1.1.3" - prosemirror-utils "^0.9.0" - prosemirror-view "^1.9.8" - tiptap "^1.22.2" - tiptap-commands "^1.10.7" + prosemirror-utils "^0.9.4" + prosemirror-view "^1.9.12" + tiptap "^1.24.0" + tiptap-commands "^1.10.11" tiptap-utils@^1.6.0: version "1.6.0" @@ -11993,7 +12002,7 @@ tiptap-utils@^1.6.0: prosemirror-tables "^0.8.1" prosemirror-utils "^0.9.4" -tiptap@1.24.0, tiptap@^1.22.2: +tiptap@^1.24.0, tiptap@~1.24.0: version "1.24.0" resolved "https://registry.yarnpkg.com/tiptap/-/tiptap-1.24.0.tgz#f386c8fca71275a4794a0e95eca2ea37267d370d" integrity sha512-izw0FM5bbOQRtNczqEgo9/EoUI7X/TAj1LEsteMuDqxaZKmYn6so482UnnQUv13+4DtXHYGj5U+60lVNuZlWJw==