Merge pull request #5290 from nextcloud/bugfix/collection-2

This commit is contained in:
Julius Härtl
2023-11-14 20:06:05 +01:00
committed by GitHub
7 changed files with 70 additions and 9 deletions

View File

@@ -217,6 +217,39 @@ describe('Card', function() {
cy.get(`.card:contains("${newCardTitle}")`).find('[data-due-state]').should('not.exist') 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')
})
}) })
}) })

View File

@@ -1,4 +1,5 @@
import { randUser } from '../utils/index.js' import { randUser } from '../utils/index.js'
import { sampleBoard } from '../utils/sampleBoard'
const user = randUser() const user = randUser()
describe('Deck dashboard', function() { describe('Deck dashboard', function() {
@@ -8,16 +9,18 @@ describe('Deck dashboard', function() {
beforeEach(function() { beforeEach(function() {
cy.login(user) cy.login(user)
cy.visit('/apps/deck')
}) })
it('Can show the right title on the dashboard', function() { it('Can show the right title on the dashboard', function() {
cy.visit('/apps/deck')
cy.get('.board-title h2') cy.get('.board-title h2')
.should('have.length', 1).first() .should('have.length', 1).first()
.should($el => expect($el.text().trim()).to.equal('Upcoming cards')) .should($el => expect($el.text().trim()).to.equal('Upcoming cards'))
}) })
it('Can see the default "Personal Board" created for user by default', function() { it('Can see the default "Personal Board" created for user by default', function() {
cy.visit('/apps/deck')
const defaultBoard = 'Personal' const defaultBoard = 'Personal'
cy.get('.app-navigation-entry-wrapper[icon=icon-deck]') cy.get('.app-navigation-entry-wrapper[icon=icon-deck]')
@@ -26,4 +29,29 @@ describe('Deck dashboard', function() {
.contains(defaultBoard) .contains(defaultBoard)
.should('be.visible') .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')
})
})
}) })

View File

@@ -1,5 +1,5 @@
<template> <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"> <div class="selector-wrapper--icon">
<AccountMultiple :size="20" /> <AccountMultiple :size="20" />
</div> </div>

View File

@@ -21,7 +21,7 @@
--> -->
<template> <template>
<div> <div data-test="description">
<h5> <h5>
{{ t('deck', 'Description') }} {{ t('deck', 'Description') }}
<span v-if="descriptionLastEdit && !descriptionSaving">{{ t('deck', '(Unsaved)') }}</span> <span v-if="descriptionLastEdit && !descriptionSaving">{{ t('deck', '(Unsaved)') }}</span>

View File

@@ -1,5 +1,5 @@
<template> <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" /> <Calendar v-if="!card.done" slot="icon" :size="20" />
<CalendarCheck v-else slot="icon" :size="20" /> <CalendarCheck v-else slot="icon" :size="20" />
<template v-if="!card.done && !card.archived"> <template v-if="!card.done && !card.archived">

View File

@@ -1,9 +1,9 @@
<template> <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"> <div class="selector-wrapper--icon">
<TagMultiple :size="20" /> <TagMultiple :size="20" />
</div> </div>
<NcMultiselect v-model="assignedLabels" <NcMultiselect :value="assignedLabels"
class="selector-wrapper--selector" class="selector-wrapper--selector"
:multiple="true" :multiple="true"
:disabled="disabled" :disabled="disabled"
@@ -63,7 +63,7 @@ export default {
return [...this.labels].sort((a, b) => (a.title < b.title) ? -1 : 1) return [...this.labels].sort((a, b) => (a.title < b.title) ? -1 : 1)
}, },
assignedLabels() { 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: { methods: {

View File

@@ -52,11 +52,11 @@ export default {
const promise = (async () => { const promise = (async () => {
commit('setCurrentBoard', null) commit('setCurrentBoard', null)
const assignedCards = await apiClient.get('upcoming') const assignedCards = await apiClient.get('upcoming')
const assignedCardsFlat = assignedCards.flat() const assignedCardsFlat = Object.values(assignedCards).flat()
for (const i in assignedCardsFlat) { for (const i in assignedCardsFlat) {
commit('addCard', assignedCardsFlat[i]) commit('addCard', assignedCardsFlat[i])
} }
commit('setAssignedCards', assignedCardsFlat) commit('setAssignedCards', assignedCards)
commit('setLoading', false) commit('setLoading', false)
})() })()
commit('setLoading', promise) commit('setLoading', promise)