Skip to content

Commit

Permalink
Merge pull request #5290 from nextcloud/bugfix/collection-2
Browse files Browse the repository at this point in the history
  • Loading branch information
juliushaertl committed Nov 14, 2023
2 parents 304dd01 + 4463604 commit eca1b87
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 9 deletions.
33 changes: 33 additions & 0 deletions cypress/e2e/cardFeatures.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,39 @@ describe('Card', function() {
cy.get(`.card:contains("${newCardTitle}")`).find('[data-due-state]').should('not.exist')
})

it('Add a label', function() {
const newCardTitle = 'Card with labels'

cy.get('.button-vue[aria-label*="Add card"]')
.first().click()
cy.get('.stack__card-add form input#new-stack-input-main')
.type(newCardTitle)
cy.get('.stack__card-add form input[type=submit]')
.first().click()
cy.get(`.card:contains("${newCardTitle}")`).should('be.visible').click()

cy.get('#app-sidebar-vue [data-test="tag-selector"]').should('be.visible').click()
cy.get('.multiselect__option:contains("Action needed")').should('be.visible').click()

cy.get('[data-test="tag-selector"] .selector-wrapper--icon').click()
cy.get('.multiselect__option:contains("Action needed")').should('not.be.visible')

cy.get('[data-test="tag-selector"] .multiselect__tags .tag:contains("Action needed")')
.should('be.visible')

cy.get(`.card:contains("${newCardTitle}")`).find('.labels li:contains("Action needed")')
.should('be.visible')

cy.get('#app-sidebar-vue [data-test="tag-selector"]').should('be.visible').click()
cy.get('.multiselect__option:contains("Later")').should('be.visible').click()
cy.get('.multiselect__option:contains("Action needed")').should('be.visible').click()

cy.get(`.card:contains("${newCardTitle}")`).find('.labels li:contains("Later")')
.should('be.visible')
cy.get(`.card:contains("${newCardTitle}")`).find('.labels li:contains("Action needed")')
.should('not.exist')
})

})

})
30 changes: 29 additions & 1 deletion cypress/e2e/deckDashboard.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { randUser } from '../utils/index.js'
import { sampleBoard } from '../utils/sampleBoard'
const user = randUser()

describe('Deck dashboard', function() {
Expand All @@ -8,16 +9,18 @@ describe('Deck dashboard', function() {

beforeEach(function() {
cy.login(user)
cy.visit('/apps/deck')
})

it('Can show the right title on the dashboard', function() {
cy.visit('/apps/deck')
cy.get('.board-title h2')
.should('have.length', 1).first()
.should($el => expect($el.text().trim()).to.equal('Upcoming cards'))
})

it('Can see the default "Personal Board" created for user by default', function() {
cy.visit('/apps/deck')

const defaultBoard = 'Personal'

cy.get('.app-navigation-entry-wrapper[icon=icon-deck]')
Expand All @@ -26,4 +29,29 @@ describe('Deck dashboard', function() {
.contains(defaultBoard)
.should('be.visible')
})

it('Shows a card with due date on the overview', function() {
cy.createExampleBoard({
user,
board: sampleBoard(),
}).then((board) => {
cy.visit(`/apps/deck/#/board/${board.id}`)

cy.intercept({ method: 'PUT', url: '**/apps/deck/cards/**' }).as('updateCard')

const newCardTitle = 'Hello world'
cy.get(`.card:contains("${newCardTitle}")`).should('be.visible').click()
cy.get('#app-sidebar-vue [data-cy-due-date-actions]').should('be.visible').click()
cy.get('[data-cy-due-date-shortcut="tomorrow"] button').should('be.visible').click()

cy.wait('@updateCard')

cy.get('button[title="Close sidebar"]').click()
cy.get('.app-navigation-entry:contains("Upcoming cards") a').click()

cy.get(`.card:contains("${newCardTitle}")`).should('be.visible')
cy.get('.dashboard-column:contains("Tomorrow")').should('be.visible')
cy.get('.dashboard-column:contains("Tomorrow") .card:contains("Hello world")').should('be.visible')
})
})
})
2 changes: 1 addition & 1 deletion src/components/card/AssignmentSelector.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="selector-wrapper" :aria-label="t('deck', 'Assign to users/groups/circles')">
<div class="selector-wrapper" :aria-label="t('deck', 'Assign to users/groups/circles')" data-test="assignment-selector">
<div class="selector-wrapper--icon">
<AccountMultiple :size="20" />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/card/Description.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
-->

<template>
<div>
<div data-test="description">
<h5>
{{ t('deck', 'Description') }}
<span v-if="descriptionLastEdit && !descriptionSaving">{{ t('deck', '(Unsaved)') }}</span>
Expand Down
2 changes: 1 addition & 1 deletion src/components/card/DueDateSelector.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<CardDetailEntry :label="t('deck', 'Assign a due date to this card…')">
<CardDetailEntry :label="t('deck', 'Assign a due date to this card…')" data-test="due-date-selector">
<Calendar v-if="!card.done" slot="icon" :size="20" />
<CalendarCheck v-else slot="icon" :size="20" />
<template v-if="!card.done && !card.archived">
Expand Down
6 changes: 3 additions & 3 deletions src/components/card/TagSelector.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<div class="selector-wrapper" :aria-label="t('deck', 'Assign a tag to this card…')">
<div class="selector-wrapper" :aria-label="t('deck', 'Assign a tag to this card…')" data-test="tag-selector">
<div class="selector-wrapper--icon">
<TagMultiple :size="20" />
</div>
<NcMultiselect v-model="assignedLabels"
<NcMultiselect :value="assignedLabels"
class="selector-wrapper--selector"
:multiple="true"
:disabled="disabled"
Expand Down Expand Up @@ -63,7 +63,7 @@ export default {
return [...this.labels].sort((a, b) => (a.title < b.title) ? -1 : 1)
},
assignedLabels() {
return [...this.card.labels].local((a, b) => (a.title < b.title) ? -1 : 1)
return [...this.card.labels].sort((a, b) => (a.title < b.title) ? -1 : 1)
},
},
methods: {
Expand Down
4 changes: 2 additions & 2 deletions src/store/overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ export default {
const promise = (async () => {
commit('setCurrentBoard', null)
const assignedCards = await apiClient.get('upcoming')
const assignedCardsFlat = assignedCards.flat()
const assignedCardsFlat = Object.values(assignedCards).flat()
for (const i in assignedCardsFlat) {
commit('addCard', assignedCardsFlat[i])
}
commit('setAssignedCards', assignedCardsFlat)
commit('setAssignedCards', assignedCards)
commit('setLoading', false)
})()
commit('setLoading', promise)
Expand Down

0 comments on commit eca1b87

Please sign in to comment.