File tree Expand file tree Collapse file tree 2 files changed +5
-16
lines changed
contentcuration/contentcuration/frontend/shared/views/policies Expand file tree Collapse file tree 2 files changed +5
-16
lines changed Original file line number Diff line number Diff line change 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 />
8785 data () {
8886 return {
8987 policyAccepted: false ,
90- showError: false ,
9188 };
9289 },
9390 computed: {
104101 this .$emit (' close' );
105102 },
106103 validate () {
107- this .showError = ! this .policyAccepted ;
108104 return this .policyAccepted ;
109105 },
110106 onPolicyAccept () {
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 };
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments