From e2512534af58eed1e65f7ea53f5f5ee7ece1a03c Mon Sep 17 00:00:00 2001 From: manavagr1108 Date: Tue, 25 Apr 2023 02:38:29 +0530 Subject: [PATCH 1/4] - [feat]: disable checkbox based on policyAccepted; --- .../frontend/shared/views/policies/PoliciesModal.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/contentcuration/contentcuration/frontend/shared/views/policies/PoliciesModal.vue b/contentcuration/contentcuration/frontend/shared/views/policies/PoliciesModal.vue index 3d19d882f4..ed4716cc9f 100644 --- a/contentcuration/contentcuration/frontend/shared/views/policies/PoliciesModal.vue +++ b/contentcuration/contentcuration/frontend/shared/views/policies/PoliciesModal.vue @@ -29,6 +29,7 @@ :text="$tr('continueButton')" :primary="true" :style="{ 'display': 'block', 'margin-left': 'auto' }" + :disabled="!policyAccepted" data-test="continue-button" @click="onPolicyAccept" /> From 468c4e6cbf8e388eb03ce62dc80d4ff9dc3fc3fc Mon Sep 17 00:00:00 2001 From: manavagr1108 Date: Tue, 25 Apr 2023 13:49:35 +0530 Subject: [PATCH 2/4] - [remove]: red error message on the checkbox; --- .../frontend/shared/views/policies/PoliciesModal.vue | 6 ------ 1 file changed, 6 deletions(-) diff --git a/contentcuration/contentcuration/frontend/shared/views/policies/PoliciesModal.vue b/contentcuration/contentcuration/frontend/shared/views/policies/PoliciesModal.vue index ed4716cc9f..4f8de84787 100644 --- a/contentcuration/contentcuration/frontend/shared/views/policies/PoliciesModal.vue +++ b/contentcuration/contentcuration/frontend/shared/views/policies/PoliciesModal.vue @@ -20,9 +20,6 @@ data-test="accept-checkbox" @change="togglePolicyAccepted" /> -
- {{ $tr('checkboxValidationErrorMessage') }} -
Date: Wed, 26 Apr 2023 01:31:52 +0530 Subject: [PATCH 3/4] - [update]: test for disable continue button; --- .../views/policies/__tests__/policiesModal.spec.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/contentcuration/contentcuration/frontend/shared/views/policies/__tests__/policiesModal.spec.js b/contentcuration/contentcuration/frontend/shared/views/policies/__tests__/policiesModal.spec.js index 7dadb02723..c34a4648ec 100644 --- a/contentcuration/contentcuration/frontend/shared/views/policies/__tests__/policiesModal.spec.js +++ b/contentcuration/contentcuration/frontend/shared/views/policies/__tests__/policiesModal.spec.js @@ -89,16 +89,8 @@ describe('PoliciesModal', () => { }); describe('when accept policy checkbox is not checked', () => { - it('clicking continue button should display validation error', () => { - wrapper.find('[data-test="continue-button"]').trigger('click'); - - expect(wrapper.text()).toContain('Field is required'); - }); - - it("clicking continue button shouldn't emit accept event", () => { - wrapper.find('[data-test="continue-button"]').trigger('click'); - - expect(wrapper.emitted().accept).toBeFalsy(); + it('disable continue button', () => { + expect(wrapper.find('[data-test="continue-button"]').attributes().disabled).toEqual('disabled') }); }); From 8b88e7c7faa854714e84f79567cb64f120ead9f5 Mon Sep 17 00:00:00 2001 From: manavagr1108 Date: Wed, 26 Apr 2023 02:34:44 +0530 Subject: [PATCH 4/4] - [lint]: lint fixes; --- .../shared/views/policies/__tests__/policiesModal.spec.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contentcuration/contentcuration/frontend/shared/views/policies/__tests__/policiesModal.spec.js b/contentcuration/contentcuration/frontend/shared/views/policies/__tests__/policiesModal.spec.js index c34a4648ec..41f29a1890 100644 --- a/contentcuration/contentcuration/frontend/shared/views/policies/__tests__/policiesModal.spec.js +++ b/contentcuration/contentcuration/frontend/shared/views/policies/__tests__/policiesModal.spec.js @@ -90,7 +90,9 @@ describe('PoliciesModal', () => { describe('when accept policy checkbox is not checked', () => { it('disable continue button', () => { - expect(wrapper.find('[data-test="continue-button"]').attributes().disabled).toEqual('disabled') + expect(wrapper.find('[data-test="continue-button"]').attributes().disabled).toEqual( + 'disabled' + ); }); });