WIP change data to props.
This commit is contained in:
parent
e7f59904e9
commit
bcd9e7dc81
4 changed files with 682 additions and 25487 deletions
26116
package-lock.json
generated
26116
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -13,6 +13,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@popperjs/core": "^2.10.2",
|
"@popperjs/core": "^2.10.2",
|
||||||
"axios": "^0.23.0",
|
"axios": "^0.23.0",
|
||||||
|
"babel-jest": "^24.9.0",
|
||||||
"bootstrap": "^5.1.1",
|
"bootstrap": "^5.1.1",
|
||||||
"canvas-confetti": "^1.4.0",
|
"canvas-confetti": "^1.4.0",
|
||||||
"core-js": "^3.6.5",
|
"core-js": "^3.6.5",
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,46 @@ describe("textboxQuestion.vue", () => {
|
||||||
expect(input.exists()).toBe(true);
|
expect(input.exists()).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Should return rounded-pill class", async () => {
|
||||||
|
// Act
|
||||||
|
const wrapper = shallowMount(textboxQuestion, {
|
||||||
|
global: {
|
||||||
|
directives: {
|
||||||
|
maska: maska,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mixins: [mockMixin],
|
||||||
|
propsData: {
|
||||||
|
cornerStyle: "rounded"
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
const paragraph = wrapper.find("input");
|
||||||
|
|
||||||
|
expect(paragraph.attributes("class")).toContain("rounded-pill");
|
||||||
|
});
|
||||||
|
|
||||||
|
it.only("Should return text-center class", async () => {
|
||||||
|
// Act
|
||||||
|
const wrapper = shallowMount(textboxQuestion, {
|
||||||
|
global: {
|
||||||
|
directives: {
|
||||||
|
maska: maska,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mixins: [mockMixin],
|
||||||
|
propsData: {
|
||||||
|
questionAlignment: "text"
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
const paragraph = wrapper.find("input");
|
||||||
|
|
||||||
|
expect(paragraph.attributes("class")).toContain("text-center");
|
||||||
|
});
|
||||||
|
|
||||||
it("Should render the 'questionText' data value as the label text when disableAutoFill is false.", async () => {
|
it("Should render the 'questionText' data value as the label text when disableAutoFill is false.", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const wrapper = shallowMount(textboxQuestion, {
|
const wrapper = shallowMount(textboxQuestion, {
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,10 @@
|
||||||
v-html="labelText"></label>
|
v-html="labelText"></label>
|
||||||
<div class="input-wrapper" :class="[includeSearchIcon ? 'has-search-icon' : '']">
|
<div class="input-wrapper" :class="[includeSearchIcon ? 'has-search-icon' : '']">
|
||||||
<input
|
<input
|
||||||
|
class="form-control"
|
||||||
v-model.trim="value"
|
v-model.trim="value"
|
||||||
v-maska="mask"
|
v-maska="mask"
|
||||||
:type="type"
|
:type="type"
|
||||||
class="form-control"
|
|
||||||
:ref="inputId"
|
:ref="inputId"
|
||||||
:id="inputId"
|
:id="inputId"
|
||||||
:name="inputId"
|
:name="inputId"
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
hasIcon ? 'has-icon' : '',
|
hasIcon ? 'has-icon' : '',
|
||||||
iconRight ? 'icon-right' : '',
|
iconRight ? 'icon-right' : '',
|
||||||
questionAlignment ? 'text-center' : '',
|
questionAlignment ? 'text-center' : '',
|
||||||
cornerStyle ? 'rounded-pill' : '',
|
isRoundedPill ? 'rounded-pill' : '',
|
||||||
]"
|
]"
|
||||||
:validationRules="validationRules"
|
:validationRules="validationRules"
|
||||||
@change="handleChange"
|
@change="handleChange"
|
||||||
|
|
@ -68,6 +68,7 @@ export default {
|
||||||
cmsWidgetName: String,
|
cmsWidgetName: String,
|
||||||
maxLength: String, // Left or center. Default is left
|
maxLength: String, // Left or center. Default is left
|
||||||
questionAlignment: String, // Left or center. Default is left
|
questionAlignment: String, // Left or center. Default is left
|
||||||
|
cornerStyle: String, // Left or center. Default is left
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const propsClone = Object.assign({}, props);
|
const propsClone = Object.assign({}, props);
|
||||||
|
|
@ -107,10 +108,15 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
includeSearchIcon: false,
|
includeSearchIcon: false,
|
||||||
cornerStyle: false,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
isRoundedPill() {
|
||||||
|
return this.cornerStyle === "rounded";
|
||||||
|
},
|
||||||
|
isQuestionAlignment() {
|
||||||
|
return this.questionAlignment === "text";
|
||||||
|
},
|
||||||
questionText() {
|
questionText() {
|
||||||
return this.getCmsContent(this.cmsWidgetName, "QuestionText");
|
return this.getCmsContent(this.cmsWidgetName, "QuestionText");
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue