diff --git a/client/cypress/e2e/frontend/modules/highlights.cy.ts b/client/cypress/e2e/frontend/modules/highlights.cy.ts index 106553ea..4465972d 100644 --- a/client/cypress/e2e/frontend/modules/highlights.cy.ts +++ b/client/cypress/e2e/frontend/modules/highlights.cy.ts @@ -201,4 +201,28 @@ describe('Highlights', () => { markText(); }); + + it('visits a module and highlights some text, then adds a note', () => { + cy.mockGraphqlOps({ + operations: { + ...operations, + ModuleDetailsQuery: { + module: getModule(defaultContents), + }, + }, + }); + + cy.visit('/module/my-module'); + + markText(); + cy.getByDataCy('highlight-note').click(); + cy.wait('@AddHighlight'); + const note = 'Some noteworthy stuff'; + cy.getByDataCy('highlight-note-input').should('have.value', '').type(note); + cy.getByDataCy('highlight-note-save').click(); + cy.wait('@UpdateHighlight'); + + cy.getByDataCy('highlight-note-save').should('not.exist'); + cy.getByDataCy('highlight-note-text').should('have.text', note); + }); }); diff --git a/client/cypress/fixtures/mocks.ts b/client/cypress/fixtures/mocks.ts index b4952d31..32d4e82a 100644 --- a/client/cypress/fixtures/mocks.ts +++ b/client/cypress/fixtures/mocks.ts @@ -118,4 +118,7 @@ export default { id: getInstrumentId(), bookmarks: null, }), + HighlightNode: () => ({ + note: null, + }), }; diff --git a/client/src/components/highlights/HighlightSidebar.vue b/client/src/components/highlights/HighlightSidebar.vue index 368ec93c..8760a7e9 100644 --- a/client/src/components/highlights/HighlightSidebar.vue +++ b/client/src/components/highlights/HighlightSidebar.vue @@ -22,19 +22,39 @@
@@ -58,10 +78,22 @@ const props = defineProps