Skip to content

Commit 6a90478

Browse files
authored
Merge pull request #4038 from manavagr1108/disable-continue-button-on-unchecked-terms
Disable checkbox based on policyAccepted
2 parents 6dfeae9 + 8b88e7c commit 6a90478

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

contentcuration/contentcuration/frontend/shared/views/policies/PoliciesModal.vue

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@
2020
data-test="accept-checkbox"
2121
@change="togglePolicyAccepted"
2222
/>
23-
<div class="red--text" :style="{ height: '14pt' }">
24-
<span v-if="showError">{{ $tr('checkboxValidationErrorMessage') }}</span>
25-
</div>
2623
</KGridItem>
2724
<KGridItem :layout="{ span: 1 }">
2825
<KButton
2926
:text="$tr('continueButton')"
3027
:primary="true"
3128
:style="{ 'display': 'block', 'margin-left': 'auto' }"
29+
:disabled="!policyAccepted"
3230
data-test="continue-button"
3331
@click="onPolicyAccept"
3432
/>
@@ -87,7 +85,6 @@
8785
data() {
8886
return {
8987
policyAccepted: false,
90-
showError: false,
9188
};
9289
},
9390
computed: {
@@ -104,7 +101,6 @@
104101
this.$emit('close');
105102
},
106103
validate() {
107-
this.showError = !this.policyAccepted;
108104
return this.policyAccepted;
109105
},
110106
onPolicyAccept() {
@@ -117,7 +113,6 @@
117113
lastUpdated: 'Last updated {date}',
118114
closeButton: 'Close',
119115
continueButton: 'Continue',
120-
checkboxValidationErrorMessage: 'Field is required',
121116
checkboxText: 'I have agreed to the above terms',
122117
},
123118
};

contentcuration/contentcuration/frontend/shared/views/policies/__tests__/policiesModal.spec.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,10 @@ describe('PoliciesModal', () => {
8989
});
9090

9191
describe('when accept policy checkbox is not checked', () => {
92-
it('clicking continue button should display validation error', () => {
93-
wrapper.find('[data-test="continue-button"]').trigger('click');
94-
95-
expect(wrapper.text()).toContain('Field is required');
96-
});
97-
98-
it("clicking continue button shouldn't emit accept event", () => {
99-
wrapper.find('[data-test="continue-button"]').trigger('click');
100-
101-
expect(wrapper.emitted().accept).toBeFalsy();
92+
it('disable continue button', () => {
93+
expect(wrapper.find('[data-test="continue-button"]').attributes().disabled).toEqual(
94+
'disabled'
95+
);
10296
});
10397
});
10498

0 commit comments

Comments
 (0)