Skip to content

Commit

Permalink
fix: conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Luka Trovic <luka@nextcloud.com>
  • Loading branch information
luka-nextcloud committed Dec 22, 2022
1 parent 7255672 commit 3a29c9f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 45 deletions.
22 changes: 13 additions & 9 deletions cypress/e2e/workspace.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('Workspace', function() {
cy.get('.nav-recent')
.click()
cy.get('#rich-workspace .ProseMirror')
.should('not.exist')
.should('not.visible')
})

it('adds a Readme.md', function() {
Expand Down Expand Up @@ -126,6 +126,7 @@ describe('Workspace', function() {
})
})


it('creates lists', function() {
cy.visit(`apps/files?dir=/${encodeURIComponent(currentFolder)}`)
cy.openWorkspace()
Expand Down Expand Up @@ -160,14 +161,14 @@ describe('Workspace', function() {
it('emoji picker', () => {
cy.visit(`apps/files?dir=/${encodeURIComponent(currentFolder)}`)
cy.openWorkspace()
.type('# Let\'s smile together{enter}## ')
.type('# Let\'s smile together{enter}## ', {force: true})

cy.getMenuEntry('emoji-picker')
.click()

cy.get('#emoji-mart-list button[aria-label="😀, grinning"]')
.first()
.click()
.click({force: true})

cy.getEditor()
.find('h2')
Expand Down Expand Up @@ -217,8 +218,12 @@ describe('Workspace', function() {
const types = ['info', 'warn', 'error', 'success']

beforeEach(function() {
<<<<<<< HEAD
cy.visit(`apps/files?dir=/${encodeURIComponent(currentFolder)}`)
cy.openWorkspace().type('Callout')
=======
cy.openWorkspace().type('Callout', {force: true})
>>>>>>> 161e4c7fe (fix: cypress errors and lint issues)
})
// eslint-disable-next-line cypress/no-async-tests
it('create callout', () => {
Expand Down Expand Up @@ -289,18 +294,17 @@ describe('Workspace', function() {
cy.uploadFile('test.md', 'text/markdown', `${Cypress.currentTest.title}/Anleitung.md`)
cy.visit(`apps/files?dir=/${encodeURIComponent(currentFolder)}`)
cy.get('.files-fileList').should('contain', 'Anleitung.md')
cy.get('.empty-workspace').should('contain', 'Ajoutez des notes, listes ou liens')
})
})

describe('create Readme.md', () => {
const checkContent = () => {
const txt = Cypress.currentTest.title

cy.getEditor().find('[data-text-el="editor-content-wrapper"]').click()
cy.getEditor().find('[data-text-el="editor-content-wrapper"]').click({force: true})

cy.getContent()
.type(txt)
.type(txt, {force: true})
.should('contain', txt)
}

Expand All @@ -309,17 +313,17 @@ describe('Workspace', function() {
})

it('click', () => {
cy.get('#rich-workspace .empty-workspace').click()
cy.openWorkspace().click({force: true})
checkContent()
})

it('enter', () => {
cy.get('#rich-workspace .empty-workspace').type('{enter}')
cy.openWorkspace().type('{enter}', {force: true})
checkContent()
})

it('spacebar', () => {
cy.get('#rich-workspace .empty-workspace')
cy.openWorkspace()
.trigger('keyup', {
keyCode: 32,
which: 32,
Expand Down
10 changes: 5 additions & 5 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ Cypress.Commands.add('getFile', fileName => {
})

Cypress.Commands.add('deleteFile', fileName => {
cy.get(`.files-fileList tr[data-file="${fileName}"] a.name .action-menu`).click()
cy.get(`.files-fileList tr[data-file="${fileName}"] a.name + .popovermenu .action-delete`).click()
cy.get(`.files-fileList tr[data-file="${fileName}"]`).should('not.exist')
cy.get(`.files-fileList tr[data-file="${ fileName }"] a.name .action-menu`).click()
cy.get(`.files-fileList tr[data-file="${ fileName }"] a.name + .popovermenu .action-delete`).click()
cy.get(`.files-fileList tr[data-file="${ fileName }"]`).should('not.exist')
})

Cypress.Commands.add('getModal', () => {
Expand Down Expand Up @@ -364,7 +364,7 @@ Cypress.Commands.add('showHiddenFiles', () => {
})

Cypress.Commands.add('createDescription', () => {
const url = `**/remote.php/dav/files/**`
const url = '**/remote.php/dav/files/**'
cy.intercept({ method: 'PUT', url })
.as('addDescription')

Expand All @@ -375,4 +375,4 @@ Cypress.Commands.add('createDescription', () => {
cy.get('.newFileMenu a.menuitem input.icon-confirm[type="submit"]').click()
})
cy.wait('@addDescription')
})
})
36 changes: 6 additions & 30 deletions src/helpers/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ import { subscribe } from '@nextcloud/event-bus'
import { openMimetypes } from './mime.js'
import { getSharingToken } from './token.js'
import RichWorkspace from '../views/RichWorkspace.vue'
import { generateOcsUrl, imagePath } from '@nextcloud/router'
import { imagePath } from '@nextcloud/router'
import store from '../store/index.js'
import axios from '@nextcloud/axios'

const FILE_ACTION_IDENTIFIER = 'Edit with text app'

Expand Down Expand Up @@ -148,29 +147,6 @@ const newRichWorkspaceFileMenuPlugin = {
return
}

// menu.render = function() {
// this.$el.html(this.template({
// uploadMaxHumanFileSize: 'TODO',
// uploadLabel: t('files', 'Upload file'),
// items: this._menuItems,
// }))

// // Trigger upload action also with keyboard navigation on enter
// this.$el.find('[for="file_upload_start"]').on('keyup', function(event) {
// if (event.key === ' ' || event.key === 'Enter') {
// document.getElementById('file_upload_start').click()
// }
// })
// // this.$el.find('[data-action="rich-workspace-init"]').on('click', function() {
// // window.FileList
// // .createFile('Readme.md', { scrollTo: false, animate: false })
// // .then(() => {
// // menu.removeMenuEntry('rich-workspace-init')
// // OC.hideMenus()
// // })
// // })
// }

// register the new menu entry
menu.addMenuEntry({
id: 'rich-workspace-init',
Expand All @@ -186,16 +162,16 @@ const newRichWorkspaceFileMenuPlugin = {
})
},
shouldShow() {
const descriptionFile = 'Readme.md';
if (fileList.findFile(descriptionFile)) return false;
return true;
}
const descriptionFile = 'Readme.md'
if (fileList.findFile(descriptionFile)) return false
return true
},
})
},
}

const addMenuRichWorkspace = () => {
OC.Plugins.register('OCA.Files.NewFileMenu', newRichWorkspaceFileMenuPlugin);
OC.Plugins.register('OCA.Files.NewFileMenu', newRichWorkspaceFileMenuPlugin)
}

const FilesWorkspacePlugin = {
Expand Down
1 change: 0 additions & 1 deletion src/views/RichWorkspace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ export default {
<style lang="scss" scoped>
#rich-workspace {
border: 2px solid red;
padding: 0 50px;
/* Slightly reduce vertical space */
margin-bottom: -24px;
Expand Down

0 comments on commit 3a29c9f

Please sign in to comment.