mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 22:54:42 -04:00
fix: use actual noteTitle in DeleteNoteSidebarEntry (#1729)
fixes #1728 Signed-off-by: Philip Molares <philip.molares@udo.edu> Co-Authored-by: Philip Molares <philip.molares@udo.edu> Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
6f320d82a5
commit
4089f0c6ed
6 changed files with 151 additions and 42 deletions
50
cypress/integration/deleteNote.spec.ts
Normal file
50
cypress/integration/deleteNote.spec.ts
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
describe('Delete note', () => {
|
||||
beforeEach(() => {
|
||||
cy.visitTestEditor()
|
||||
})
|
||||
|
||||
it('correctly deletes a note', () => {
|
||||
cy.intercept('DELETE', '/mock-backend/api/private/notes/mock_note_id', {
|
||||
statusCode: 200
|
||||
})
|
||||
cy.getByCypressId('sidebar.deleteNote.button').click()
|
||||
cy.getByCypressId('sidebar.deleteNote.modal').should('be.visible')
|
||||
cy.getByCypressId('sidebar.deleteNote.modal.noteTitle').should('be.visible').text().should('eq', '')
|
||||
cy.getByCypressId('deletionModal.confirmButton').should('be.visible').click()
|
||||
cy.getByCypressId('sidebar.deleteNote.modal').should('not.be.exist')
|
||||
cy.getByCypressId('notification-toast').should('not.exist')
|
||||
})
|
||||
|
||||
it('displays an error notification if something goes wrong', () => {
|
||||
cy.getByCypressId('sidebar.deleteNote.button').click()
|
||||
cy.getByCypressId('sidebar.deleteNote.modal').should('be.visible')
|
||||
cy.getByCypressId('sidebar.deleteNote.modal.noteTitle').should('be.visible').text().should('eq', '')
|
||||
cy.getByCypressId('deletionModal.confirmButton').should('be.visible').click()
|
||||
cy.getByCypressId('sidebar.deleteNote.modal').should('not.exist')
|
||||
cy.getByCypressId('notification-toast').should('be.visible')
|
||||
})
|
||||
|
||||
describe('displays the note title coming from', () => {
|
||||
const title = 'mock_title'
|
||||
it('yaml metadata', () => {
|
||||
cy.setCodemirrorContent(`---\ntitle: ${title}\n---`)
|
||||
})
|
||||
it('opengraph', () => {
|
||||
cy.setCodemirrorContent(`---\nopengraph:\n title: ${title}\n---`)
|
||||
})
|
||||
it('just first heading', () => {
|
||||
cy.setCodemirrorContent(`# ${title}`)
|
||||
})
|
||||
afterEach(() => {
|
||||
cy.getByCypressId('sidebar.deleteNote.button').click()
|
||||
cy.getByCypressId('sidebar.deleteNote.modal').should('be.visible')
|
||||
cy.getByCypressId('sidebar.deleteNote.modal.noteTitle').should('be.visible').text().should('eq', title)
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue