Merge pull request #806 from Safelite/CSR-906-textbox-question-fixes

Update props and clean up code.
This commit is contained in:
bmauger 2022-11-08 14:38:42 -05:00 committed by GitHub
commit f3f2aa6012
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 14 deletions

View file

@ -53,7 +53,7 @@ describe("textboxQuestion.vue", () => {
expect(paragraph.attributes("class")).toContain("rounded-pill");
});
it.only("Should return text-center class", async () => {
it.only("Should return form-control class", async () => {
// Act
const wrapper = shallowMount(textboxQuestion, {
global: {
@ -70,7 +70,7 @@ describe("textboxQuestion.vue", () => {
// Assert
const paragraph = wrapper.find("input");
expect(paragraph.attributes("class")).toContain("text-center");
expect(paragraph.attributes("class")).toContain("form-control");
});
it("Should render the 'questionText' data value as the label text when disableAutoFill is false.", async () => {

View file

@ -4,7 +4,6 @@
:for="inputId"
:aria-label="questionText"
class="form-label"
:class="[questionAlignment ? 'mx-auto' : '']"
v-html="labelText"></label>
<div class="input-wrapper" :class="[includeSearchIcon ? 'has-search-icon' : '']">
<input
@ -23,8 +22,8 @@
:class="[
hasIcon ? 'has-icon' : '',
iconRight ? 'icon-right' : '',
questionAlignment ? 'text-center' : '',
isRoundedPill ? 'rounded-pill' : '',
questionAlignment === 'center' ? 'text-center' : '',
cornerStyle === 'rounded' ? 'rounded-pill' : '',
]"
:validationRules="validationRules"
@change="handleChange"
@ -66,9 +65,9 @@ export default {
},
validationRules: String,
cmsWidgetName: String,
maxLength: String, // Left or center. Default is left
questionAlignment: String, // Left or center. Default is left
cornerStyle: String, // Left or center. Default is left
maxLength: String,
questionAlignment: String, // Left or center. Left is default.
cornerStyle: String, // Rounded or square. Square is default.
includeSearchIcon: Boolean,
},
setup(props) {
@ -107,12 +106,6 @@ export default {
};
},
computed: {
isRoundedPill() {
return this.cornerStyle === "rounded";
},
isQuestionAlignment() {
return this.questionAlignment === "text";
},
questionText() {
return this.getCmsContent(this.cmsWidgetName, "QuestionText");
},