CSR-1102 Match code to ISS and test flow.

This commit is contained in:
Bryan Mauger 2023-01-27 10:10:43 -05:00
parent f9413dc060
commit c54cf6e4a6

View file

@ -1,5 +1,5 @@
<template> <template>
<div class="dropdown-question" :class="errorMessage || hasError ? 'has-error' : ''"> <div class="dropdown-question" :class="(errors && errors.length) || hasError ? 'has-error' : ''">
<label <label
:for="inputId" :for="inputId"
:aria-label="questionText" :aria-label="questionText"
@ -13,7 +13,9 @@
:aria-disabled="isDisabled" :aria-disabled="isDisabled"
:disabled="isDisabled" :disabled="isDisabled"
:aria-required="isRequired" :aria-required="isRequired"
:validationRules="validationRules"> :validationRules="validationRules"
:placeHolderText="placeHolderText">
<option v-if="placeHolderText" value="" selected>{{ placeHolderText }}</option>
<option v-for="(value, name, index) in options" :value="name" :key="index"> <option v-for="(value, name, index) in options" :value="name" :key="index">
{{ value }} {{ value }}
</option> </option>
@ -38,9 +40,11 @@ export default {
}, },
isDisabled: Boolean, isDisabled: Boolean,
isRequired: Boolean, isRequired: Boolean,
disableAutoFill: Boolean,
validationRules: String, validationRules: String,
cmsWidgetName: String, cmsWidgetName: String,
hasError: Boolean, hasError: Boolean,
placeHolderText: String
}, },
setup(props) { setup(props) {
const propsClone = Object.assign({}, props); const propsClone = Object.assign({}, props);
@ -52,7 +56,7 @@ export default {
initialValue = modelValue; initialValue = modelValue;
break; break;
default: default:
initialValue = modelValue && modelValue.length > 0 ? modelValue : ""; initialValue = (modelValue && modelValue.length > 0) ? modelValue : "";
break; break;
} }
@ -62,7 +66,7 @@ export default {
initialValue: initialValue, initialValue: initialValue,
}; };
const { errorMessage, handleBlur, handleChange, meta } = useField( const {errorMessage, handleBlur, handleChange, meta, errors } = useField(
props.inputId, props.inputId,
props.validationRules, props.validationRules,
fieldOptions fieldOptions
@ -73,6 +77,7 @@ export default {
handleBlur, handleBlur,
handleChange, handleChange,
meta, meta,
errors
}; };
}, },
computed: { computed: {
@ -81,7 +86,7 @@ export default {
}, },
selectedOption: { selectedOption: {
get: function () { get: function () {
return this.modelValue; return !this.modelValue ? "" : this.modelValue;
}, },
set: function (newValue) { set: function (newValue) {
this.$emit("update:modelValue", newValue); this.$emit("update:modelValue", newValue);