From fed88dec27162fd8e3c276bb6520d4326578d458 Mon Sep 17 00:00:00 2001 From: Anurudra Shukla Date: Mon, 20 Nov 2023 17:03:11 +0530 Subject: [PATCH 1/6] FORMS-11276: fix of the setFocus issue for text --- .../samples/setfocus/.content.xml | 4 +- .../samples/setfocus/.content.xml | 199 +++++++----------- .../v1/text/clientlibs/site/js/textview.js | 1 + .../specs/setFocusTests.runtime.spec.js | 18 -- 4 files changed, 77 insertions(+), 145 deletions(-) diff --git a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/setfocus/.content.xml b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/setfocus/.content.xml index b35abde581..33b665d142 100644 --- a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/setfocus/.content.xml +++ b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/setfocus/.content.xml @@ -3,7 +3,7 @@ jcr:primaryType="dam:Asset"> + title="setFocusTest"/> diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/setfocus/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/setfocus/.content.xml index 28a016478b..e8ad7ea3a2 100644 --- a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/setfocus/.content.xml +++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/setfocus/.content.xml @@ -3,13 +3,13 @@ jcr:primaryType="cq:Page"> + title="setFocusTest"> + name="accordion1700458871063"> - + - - - + - - - - + - + + + name="accordion_1010145121700458947194"> - - + - - - - - - - - + jcr:title="Text" + sling:resourceType="forms-components-examples/components/form/text" + fieldType="plain-text" + name="text1700458998152" + textIsRich="true" + unboundFormElement="{Boolean}false" + value="<p>adsgsg</p> " + visible="{Boolean}true"/> + diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/text/v1/text/clientlibs/site/js/textview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/text/v1/text/clientlibs/site/js/textview.js index bf4762f1ec..6f37bac225 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/text/v1/text/clientlibs/site/js/textview.js +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/text/v1/text/clientlibs/site/js/textview.js @@ -60,6 +60,7 @@ setFocus() { this.setActive(); + this.element.scrollIntoView({ behavior: 'instant', block: 'start' }); } updateValue(value) { diff --git a/ui.tests/test-module/specs/setFocusTests.runtime.spec.js b/ui.tests/test-module/specs/setFocusTests.runtime.spec.js index d96a8ae034..36e9151a95 100644 --- a/ui.tests/test-module/specs/setFocusTests.runtime.spec.js +++ b/ui.tests/test-module/specs/setFocusTests.runtime.spec.js @@ -25,24 +25,6 @@ describe("Form with multipe components", () => { }) }); - const checkHTML = (id, state, view, count) => { - const visible = state.visible; - const passVisibleCheck = `${visible === true ? "" : "not."}be.visible`; - cy.get(`#${id}`) - .should(passVisibleCheck) - .invoke('attr', 'data-cmp-visible') - .should('eq', visible.toString()); - cy.get(`#${id}`) - .invoke('attr', 'data-cmp-enabled') - .should('eq', state.enabled.toString()); - expect(state.items.length, "model has children equal to count").to.equal(count); - if (count == 0) { - return cy.get(`.${childBemBlock}`).should('not.exist'); - } else { - return cy.get(`.${childBemBlock}`).should('have.length', count); - } - }; - it("check if first tab activated if focus call from other tab", () => { const firstChildComponentId = formContainer._model.items[7].items[1].items[0].id; const firstChildComponentButtonId = formContainer._model.items[0].id ; From db36436cca7fd1ba755b9dd2e142cb17e6c9668d Mon Sep 17 00:00:00 2001 From: Anurudra Shukla Date: Mon, 20 Nov 2023 19:28:45 +0530 Subject: [PATCH 2/6] FROMS-11276 : minor change in test case --- ui.tests/test-module/specs/setFocusTests.runtime.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui.tests/test-module/specs/setFocusTests.runtime.spec.js b/ui.tests/test-module/specs/setFocusTests.runtime.spec.js index 36e9151a95..ccf38f1da3 100644 --- a/ui.tests/test-module/specs/setFocusTests.runtime.spec.js +++ b/ui.tests/test-module/specs/setFocusTests.runtime.spec.js @@ -26,7 +26,7 @@ describe("Form with multipe components", () => { }); it("check if first tab activated if focus call from other tab", () => { - const firstChildComponentId = formContainer._model.items[7].items[1].items[0].id; + const firstChildComponentId = formContainer._model.items[10].items[1].items[0].id; const firstChildComponentButtonId = formContainer._model.items[0].id ; cy.get(`#${firstChildComponentButtonId}`).click(); cy.get(`#${firstChildComponentId}`).isElementInViewport().should("eq", true); From 42d8a76db39acae228f73936e77fec3c4985237c Mon Sep 17 00:00:00 2001 From: Anurudra Shukla Date: Tue, 21 Nov 2023 10:19:26 +0530 Subject: [PATCH 3/6] FORMS-11276 : minor change in testcase --- ui.tests/test-module/specs/setFocusTests.runtime.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui.tests/test-module/specs/setFocusTests.runtime.spec.js b/ui.tests/test-module/specs/setFocusTests.runtime.spec.js index ccf38f1da3..2bc56c0e26 100644 --- a/ui.tests/test-module/specs/setFocusTests.runtime.spec.js +++ b/ui.tests/test-module/specs/setFocusTests.runtime.spec.js @@ -26,7 +26,7 @@ describe("Form with multipe components", () => { }); it("check if first tab activated if focus call from other tab", () => { - const firstChildComponentId = formContainer._model.items[10].items[1].items[0].id; + const firstChildComponentId = formContainer._model.items[10].items[2].items[0].id; const firstChildComponentButtonId = formContainer._model.items[0].id ; cy.get(`#${firstChildComponentButtonId}`).click(); cy.get(`#${firstChildComponentId}`).isElementInViewport().should("eq", true); From 58d0bd23f5623a353b8cf5000808e043cb2a2295 Mon Sep 17 00:00:00 2001 From: Anurudra Shukla Date: Wed, 22 Nov 2023 12:19:11 +0530 Subject: [PATCH 4/6] FORMS-11276 : test cases --- .../samples/setfocus/.content.xml | 41 +- .../samples/setfocus/.content.xml | 490 ++++++++++++------ .../specs/setFocusTests.runtime.spec.js | 4 +- 3 files changed, 347 insertions(+), 188 deletions(-) diff --git a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/setfocus/.content.xml b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/setfocus/.content.xml index 33b665d142..b5f739889d 100644 --- a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/setfocus/.content.xml +++ b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/setfocus/.content.xml @@ -1,23 +1,24 @@ - - - +jcr:primaryType="dam:Asset"> + + + + \ No newline at end of file diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/setfocus/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/setfocus/.content.xml index e8ad7ea3a2..5353bccbb4 100644 --- a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/setfocus/.content.xml +++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/setfocus/.content.xml @@ -1,170 +1,326 @@ - - - - - - - - - - - - - - - - - - - - +jcr:primaryType="cq:Page"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ui.tests/test-module/specs/setFocusTests.runtime.spec.js b/ui.tests/test-module/specs/setFocusTests.runtime.spec.js index 2bc56c0e26..ed8e5b12d9 100644 --- a/ui.tests/test-module/specs/setFocusTests.runtime.spec.js +++ b/ui.tests/test-module/specs/setFocusTests.runtime.spec.js @@ -26,7 +26,9 @@ describe("Form with multipe components", () => { }); it("check if first tab activated if focus call from other tab", () => { - const firstChildComponentId = formContainer._model.items[10].items[2].items[0].id; + cy.log("test"+formContainer._model.items[10]); + console.log(formContainer._model.items[10]); + const firstChildComponentId = formContainer._model.items[8].items[2].items[0].id; const firstChildComponentButtonId = formContainer._model.items[0].id ; cy.get(`#${firstChildComponentButtonId}`).click(); cy.get(`#${firstChildComponentId}`).isElementInViewport().should("eq", true); From 5b5514b501ec10b254a022ccfbf227309b1b7c4a Mon Sep 17 00:00:00 2001 From: Anurudra Shukla Date: Wed, 22 Nov 2023 12:25:28 +0530 Subject: [PATCH 5/6] FORMS-11276: changed behaviour as smooth --- .../components/form/text/v1/text/clientlibs/site/js/textview.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/text/v1/text/clientlibs/site/js/textview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/text/v1/text/clientlibs/site/js/textview.js index 6f37bac225..6f0591c7a6 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/text/v1/text/clientlibs/site/js/textview.js +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/text/v1/text/clientlibs/site/js/textview.js @@ -60,7 +60,7 @@ setFocus() { this.setActive(); - this.element.scrollIntoView({ behavior: 'instant', block: 'start' }); + this.element.scrollIntoView({ behavior: 'smooth', block: 'start' }); } updateValue(value) { From 891351d95cd3225b8520bc6be18ad32830118d30 Mon Sep 17 00:00:00 2001 From: Anurudra Shukla Date: Wed, 22 Nov 2023 12:57:35 +0530 Subject: [PATCH 6/6] FORMS-11276: test case changes --- ui.tests/test-module/specs/setFocusTests.runtime.spec.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/ui.tests/test-module/specs/setFocusTests.runtime.spec.js b/ui.tests/test-module/specs/setFocusTests.runtime.spec.js index ed8e5b12d9..f1a8948044 100644 --- a/ui.tests/test-module/specs/setFocusTests.runtime.spec.js +++ b/ui.tests/test-module/specs/setFocusTests.runtime.spec.js @@ -26,8 +26,6 @@ describe("Form with multipe components", () => { }); it("check if first tab activated if focus call from other tab", () => { - cy.log("test"+formContainer._model.items[10]); - console.log(formContainer._model.items[10]); const firstChildComponentId = formContainer._model.items[8].items[2].items[0].id; const firstChildComponentButtonId = formContainer._model.items[0].id ; cy.get(`#${firstChildComponentButtonId}`).click();