Merge pull request #5352 from nextcloud/backport/5351/stable28
This commit is contained in:
@@ -252,4 +252,52 @@ describe('Card', function() {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('Card actions', () => {
|
||||||
|
beforeEach(function() {
|
||||||
|
cy.login(user)
|
||||||
|
useModal(false).then(() => {
|
||||||
|
cy.visit(`/apps/deck/#/board/${boardId}`)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Custom card actions', () => {
|
||||||
|
const myAction = {
|
||||||
|
label: 'Test action',
|
||||||
|
icon: 'icon-user',
|
||||||
|
callback(card) {
|
||||||
|
console.log('Called callback', card)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
cy.spy(myAction, 'callback').as('myAction.callback')
|
||||||
|
|
||||||
|
cy.window().then(win => {
|
||||||
|
win.OCA.Deck.registerCardAction(myAction)
|
||||||
|
})
|
||||||
|
|
||||||
|
cy.get('.card:contains("Hello world")').should('be.visible').click()
|
||||||
|
cy.get('#app-sidebar-vue')
|
||||||
|
.find('.ProseMirror h1').contains('Hello world').should('be.visible')
|
||||||
|
|
||||||
|
cy.get('.app-sidebar-header .action-item__menutoggle').click()
|
||||||
|
cy.get('.v-popper__popper button:contains("Test action")').click()
|
||||||
|
|
||||||
|
cy.get('@myAction.callback')
|
||||||
|
.should('be.called')
|
||||||
|
.its('firstCall.args.0')
|
||||||
|
.as('args')
|
||||||
|
|
||||||
|
cy.url().then(url => {
|
||||||
|
const cardId = url.split('/').pop()
|
||||||
|
cy.get('@args').should('have.property', 'name', 'Hello world')
|
||||||
|
cy.get('@args').should('have.property', 'stackname', 'TestList')
|
||||||
|
cy.get('@args').should('have.property', 'boardname', 'MyTestBoard')
|
||||||
|
cy.get('@args').its('link').then((url) => {
|
||||||
|
expect(url.split('/').pop() === cardId).to.be.true
|
||||||
|
cy.visit(url)
|
||||||
|
cy.get('#app-sidebar-vue')
|
||||||
|
.find('.ProseMirror h1').contains('Hello world').should('be.visible')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -83,7 +83,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { NcActionButton, NcAppSidebar, NcAppSidebarTab } from '@nextcloud/vue'
|
import { NcActionButton, NcAppSidebar, NcAppSidebarTab } from '@nextcloud/vue'
|
||||||
import { generateUrl } from '@nextcloud/router'
|
|
||||||
import { mapState, mapGetters } from 'vuex'
|
import { mapState, mapGetters } from 'vuex'
|
||||||
import CardSidebarTabDetails from './CardSidebarTabDetails.vue'
|
import CardSidebarTabDetails from './CardSidebarTabDetails.vue'
|
||||||
import CardSidebarTabAttachments from './CardSidebarTabAttachments.vue'
|
import CardSidebarTabAttachments from './CardSidebarTabAttachments.vue'
|
||||||
@@ -160,15 +159,6 @@ export default {
|
|||||||
subtitleTooltip() {
|
subtitleTooltip() {
|
||||||
return t('deck', 'Modified') + ': ' + this.formatDate(this.currentCard.lastModified) + '\n' + t('deck', 'Created') + ': ' + this.formatDate(this.currentCard.createdAt)
|
return t('deck', 'Modified') + ': ' + this.formatDate(this.currentCard.lastModified) + '\n' + t('deck', 'Created') + ': ' + this.formatDate(this.currentCard.createdAt)
|
||||||
},
|
},
|
||||||
cardRichObject() {
|
|
||||||
return {
|
|
||||||
id: '' + this.currentCard.id,
|
|
||||||
name: this.currentCard.title,
|
|
||||||
boardname: this.currentBoard.title,
|
|
||||||
stackname: this.stackById(this.currentCard.stackId)?.title,
|
|
||||||
link: window.location.protocol + '//' + window.location.host + generateUrl('/apps/deck/') + `#/board/${this.currentBoard.id}/card/${this.currentCard.id}`,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
cardDetailsInModal: {
|
cardDetailsInModal: {
|
||||||
get() {
|
get() {
|
||||||
return this.$store.getters.config('cardDetailsInModal')
|
return this.$store.getters.config('cardDetailsInModal')
|
||||||
|
|||||||
@@ -136,6 +136,8 @@ export default {
|
|||||||
'isArchived',
|
'isArchived',
|
||||||
'boards',
|
'boards',
|
||||||
'cardActions',
|
'cardActions',
|
||||||
|
'stackById',
|
||||||
|
'boardById',
|
||||||
]),
|
]),
|
||||||
...mapState({
|
...mapState({
|
||||||
showArchived: state => state.showArchived,
|
showArchived: state => state.showArchived,
|
||||||
@@ -165,7 +167,17 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
boardId() {
|
boardId() {
|
||||||
return this.card?.boardId ? this.card.boardId : this.$route.params.id
|
return this.card?.boardId ? this.card.boardId : Number(this.$route.params.id)
|
||||||
|
},
|
||||||
|
|
||||||
|
cardRichObject() {
|
||||||
|
return {
|
||||||
|
id: '' + this.card.id,
|
||||||
|
name: this.card.title,
|
||||||
|
boardname: this.boardById(this.boardId)?.title,
|
||||||
|
stackname: this.stackById(this.card.stackId)?.title,
|
||||||
|
link: window.location.protocol + '//' + window.location.host + generateUrl('/apps/deck/') + `card/${this.card.id}`,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
Reference in New Issue
Block a user