Skip to content

Commit

Permalink
fix: merge conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Luka Trovic <[email protected]>
  • Loading branch information
luka-nextcloud committed Dec 7, 2023
1 parent 00698a7 commit f4d5a1a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 46 deletions.
48 changes: 3 additions & 45 deletions cypress/e2e/directediting.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,83 +53,41 @@ describe('direct editing', function() {
initUserAndFiles(user, 'test.md', 'empty.md', 'empty.txt')
})

it('Open an existing file, edit and close it', () => {
it('Open an existing file, edit it', () => {
createDirectEditingLink(user, 'empty.md')
.then((token) => {
cy.logout()
cy.visit(token)
})
const closeRequestAlias = 'closeRequest'
cy.intercept({ method: 'POST', url: '**/session/close' }).as(closeRequestAlias)
cy.intercept({ method: 'POST', url: '**/apps/text/session/sync' }).as('sync')
cy.getContent().type('# This is a headline')
cy.getContent().type('{enter}')
cy.getContent().type('Some text')
cy.getContent().type('{enter}')

// ensure we have received our own steps
cy.wait('@sync', { timeout: 7000 })
cy.wait('@sync', { timeout: 7000 })

cy.get('button.icon-close').click()
cy.wait(`@${closeRequestAlias}`).then(() => {
cy.getFileContent('empty.md').then((content) => {
expect(content).to.equal('# This is a headline\n\nSome text')
})
})
})

it('Create a file, edit and close it', () => {
it('Create a file, edit it', () => {
createDirectEditingLinkForNewFile(user, 'newfile.md')
.then((token) => {
cy.logout()
cy.visit(token)
})
const closeRequestAlias = 'closeRequest'
cy.intercept({ method: 'POST', url: '**/session/close' }).as(closeRequestAlias)
cy.intercept({ method: 'POST', url: '**/apps/text/session/sync' }).as('sync')

cy.getContent().type('# This is a headline')
cy.getContent().type('{enter}')
cy.getContent().type('Some text')
cy.getContent().type('{enter}')

// ensure we have received our own steps
cy.wait('@sync', { timeout: 7000 })
cy.wait('@sync', { timeout: 7000 })

cy.get('button.icon-close').click()
cy.wait(`@${closeRequestAlias}`).then(() => {
cy.getFileContent('newfile.md').then((content) => {
expect(content).to.equal('# This is a headline\n\nSome text')
})
})
})

it('Open an existing plain text file, edit and close it', () => {
it('Open an existing plain text file, edit it', () => {
createDirectEditingLink(user, 'empty.txt')
.then((token) => {
cy.logout()
cy.visit(token)
})
const closeRequestAlias = 'closeRequest'
cy.intercept({ method: 'POST', url: '**/session/close' }).as(closeRequestAlias)
cy.intercept({ method: 'POST', url: '**/apps/text/session/sync' }).as('sync')

cy.getContent().type('# This is a headline')
cy.getContent().type('{enter}')
cy.getContent().type('Some text')
cy.getContent().type('{enter}')

// ensure we have received our own steps
cy.wait('@sync', { timeout: 7000 })
cy.wait('@sync', { timeout: 7000 })

cy.get('button.icon-close').click()
cy.wait(`@${closeRequestAlias}`).then(() => {
cy.getFileContent('empty.txt').then((content) => {
expect(content).to.equal('# This is a headline\nSome text\n')
})
})
})
})
7 changes: 6 additions & 1 deletion src/views/DirectEditing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
:mime="initial.mimetype"
:is-direct-editing="true"
@ready="loaded">
<template #header>
<template v-if="isMobile" #header>
<button class="icon-share" @click="share" />
<button class="icon-close" @click="close" />
</template>
Expand Down Expand Up @@ -103,6 +103,11 @@ export default {
initialSession() {
return JSON.parse(this.initial.session) || null
},
isMobile() {
return (window.DirectEditingMobileInterface || (window.webkit
&& window.webkit.messageHandlers
&& window.webkit.messageHandlers.DirectEditingMobileInterface))
},
},
beforeMount() {
callMobileMessage('loading')
Expand Down

0 comments on commit f4d5a1a

Please sign in to comment.