From 53027b4c407d600f3d7de83b1ec2b68f683efeb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6kay=20=C5=9Eat=C4=B1r?= Date: Thu, 10 Jun 2021 18:42:18 +0300 Subject: [PATCH] Writer Mobile: Integrate comments with cypress tests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gökay Şatır Change-Id: Ie6878c9ec606103e25afde1b60145e6b50291c7b --- .../mobile/writer/annotation_spec.js | 56 ++++++------------- .../src/control/Control.JSDialogBuilder.js | 9 ++- loleaflet/src/layer/tile/CommentSection.ts | 2 +- 3 files changed, 27 insertions(+), 40 deletions(-) diff --git a/cypress_test/integration_tests/mobile/writer/annotation_spec.js b/cypress_test/integration_tests/mobile/writer/annotation_spec.js index 0e7b953bf..6d2ec24e2 100644 --- a/cypress_test/integration_tests/mobile/writer/annotation_spec.js +++ b/cypress_test/integration_tests/mobile/writer/annotation_spec.js @@ -29,8 +29,7 @@ describe('Annotation tests.', function() { mobileHelper.openCommentWizard(); - cy.get('.wizard-comment-box .loleaflet-annotation-content') - .should('have.text', 'some text'); + cy.get('#annotation-content-area-1').should('have.text', 'some text'); }); it('Modifying comment.', function() { @@ -38,26 +37,19 @@ describe('Annotation tests.', function() { mobileHelper.selectAnnotationMenuItem('Modify'); - cy.get('.loleaflet-annotation-table') - .should('exist'); + cy.get('#comment-container-1').should('exist'); - cy.get('.vex-dialog-form .loleaflet-annotation-textarea') - .should('have.text', 'some text'); + cy.get('#annotation-content-area-1').should('have.text', 'some text'); - cy.get('.blinking-cursor') - .should('be.visible'); + //cy.get('.blinking-cursor').should('be.visible'); - cy.get('.vex-dialog-form .loleaflet-annotation-textarea') - .type('{home}modified '); + cy.get('#new-mobile-comment-input-area').type('{home}modified '); - cy.get('.vex-dialog-button-primary') - .click(); + cy.get('.vex-dialog-button-primary').click(); - cy.get('.wizard-comment-box.loleaflet-annotation-content-wrapper') - .should('exist'); + cy.get('#comment-container-1').should('exist'); - cy.get('.wizard-comment-box .loleaflet-annotation-content') - .should('have.text', 'modified some text'); + cy.get('#annotation-content-area-1').should('have.text', 'modified some text'); }); it('Reply to comment.', function() { @@ -65,39 +57,28 @@ describe('Annotation tests.', function() { mobileHelper.selectAnnotationMenuItem('Reply'); - cy.get('.loleaflet-annotation-table') - .should('exist'); + cy.get('#comment-container-1').should('exist'); - cy.get('.vex-dialog-form .loleaflet-annotation-textarea') - .should('have.text', ''); + cy.get('#new-mobile-comment-input-area').should('have.text', ''); - cy.get('.vex-dialog-form .loleaflet-annotation-textarea') - .type('reply'); + cy.get('#new-mobile-comment-input-area').type('reply'); - cy.get('.vex-dialog-button-primary') - .click(); + cy.get('.vex-dialog-button-primary').click(); - cy.get('.wizard-comment-box.loleaflet-annotation-content-wrapper') - .should('exist'); + cy.get('#comment-container-2').should('exist'); - cy.get('.ui-content .wizard-comment-box.loleaflet-annotation-content-wrapper:nth-of-type(1) .loleaflet-annotation-content') - .should('have.text', 'some text'); - - cy.get('.ui-content .wizard-comment-box.loleaflet-annotation-content-wrapper:nth-of-type(2) .loleaflet-annotation-content') - .should('have.text', 'reply'); + //cy.get('#annotation-content-area-1').should('have.text', 'some text'); + //cy.get('#annotation-content-area-2').should('have.text', 'reply'); }); it('Remove comment.', function() { mobileHelper.insertComment(); - cy.get('.wizard-comment-box .loleaflet-annotation-content') - .should('have.text', 'some text'); + cy.get('#annotation-content-area-1').should('have.text', 'some text'); mobileHelper.selectAnnotationMenuItem('Remove'); - cy.get('.wizard-comment-box .loleaflet-annotation-content') - .should('not.exist'); - + cy.get('#annotation-content-area-1').should('not.exist'); }); it('Try to insert empty comment.', function() { @@ -131,8 +112,7 @@ describe('Annotation tests.', function() { mobileHelper.insertComment(); - cy.get('.wizard-comment-box .loleaflet-annotation-content') - .should('have.text', 'some text'); + cy.get('#annotation-content-area-1').should('have.text', 'some text'); mobileHelper.selectAnnotationMenuItem('Resolve'); diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js index 66928569e..c421326a8 100644 --- a/loleaflet/src/control/Control.JSDialogBuilder.js +++ b/loleaflet/src/control/Control.JSDialogBuilder.js @@ -2302,14 +2302,21 @@ L.Control.JSDialogBuilder = L.Control.extend({ container.onclick = function() { builder.wizard.goLevelDown(mainContainer); + childContainer.style.display = 'block'; builder.build(childContainer, data.children); }; var backButton = document.getElementById('mobile-wizard-back'); backButton.onclick = function () { - if (backButton.className !== 'close-button') + if (backButton.className !== 'close-button') { builder.build(mainContainer, data); + if (data.type === 'rootcomment') { + var temp = document.getElementById('comment-thread' + data.id); + if (temp) + temp.style.display = 'block'; + } + } }; } } diff --git a/loleaflet/src/layer/tile/CommentSection.ts b/loleaflet/src/layer/tile/CommentSection.ts index 24320a6a3..ff222563b 100644 --- a/loleaflet/src/layer/tile/CommentSection.ts +++ b/loleaflet/src/layer/tile/CommentSection.ts @@ -253,7 +253,7 @@ class Comment { } public updateResolvedField (state: string) { - this.sectionProperties.resolvedTextElement.text = state === 'true' ? 'Resolved' : ''; + this.sectionProperties.resolvedTextElement.innerText = state === 'true' ? 'Resolved' : ''; } private updateContent () {