From b1ccb60cb6a0d9265e145f7db750add1e832e52d Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 1 Jun 2022 14:00:53 +0200 Subject: [PATCH] fix: various issues with conflict display * only import prosemirror css once. * disconnect after receiving a 409 response in polling backend. * clean up remains of `RichtextOptions`. * use the `isRichEditor` prop in Reader. * add cypress test for conflict display. Signed-off-by: Max --- cypress/e2e/conflict.spec.js | 58 +++++++++++++++++++++++++++++++ src/components/EditorWrapper.vue | 2 -- src/components/Reader.vue | 5 +-- src/components/RichTextReader.vue | 4 --- src/services/PollingBackend.js | 1 + 5 files changed, 60 insertions(+), 10 deletions(-) create mode 100644 cypress/e2e/conflict.spec.js diff --git a/cypress/e2e/conflict.spec.js b/cypress/e2e/conflict.spec.js new file mode 100644 index 00000000000..e5949c34c41 --- /dev/null +++ b/cypress/e2e/conflict.spec.js @@ -0,0 +1,58 @@ +/** + * @copyright Copyright (c) 2019 John Molakvoæ + * + * @author John Molakvoæ + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +import { randHash } from '../utils/' +const randUser = randHash() + +describe('Open test.md in viewer', function() { + before(function() { + // Init user + cy.nextcloudCreateUser(randUser, 'password') + cy.login(randUser, 'password') + + // Upload test files + cy.uploadFile('test.md', 'text/markdown') + }) + + beforeEach(function() { + cy.login(randUser, 'password') + }) + + it('displays conflicts', function() { + cy.openFile('test.md') + + cy.log('Inspect editor') + const viewer = cy.get('#viewer') + const editor = viewer.get('#editor .ProseMirror') + editor.type('Hello you cruel conflicting world') + cy.uploadFile('test.md', 'text/markdown') + + cy.get('#viewer .modal-header button.header-close').click() + cy.get('#viewer').should('not.exist') + cy.openFile('test.md') + cy.get('#editor-container .document-status .icon-error') + const wrapper = cy.get('#editor-wrapper.has-conflicts.is-rich-editor ') + wrapper.get('#read-only-editor h2').should('contain', 'Hello world') + wrapper.get('#editor h2').should('contain', 'Hello world') + cy.screenshot() + }) +}) diff --git a/src/components/EditorWrapper.vue b/src/components/EditorWrapper.vue index 56e6925f2ee..7b14178d604 100644 --- a/src/components/EditorWrapper.vue +++ b/src/components/EditorWrapper.vue @@ -77,7 +77,6 @@ @@ -563,7 +562,6 @@ export default { }), ], enableRichEditing: this.isRichEditor, - ...this.richTextOptions, }) this.$editor.on('focus', () => { this.$emit('focus') diff --git a/src/components/Reader.vue b/src/components/Reader.vue index 212e198d123..0532524b752 100644 --- a/src/components/Reader.vue +++ b/src/components/Reader.vue @@ -21,7 +21,7 @@ -->