Adding condition to when change event occurs on radio buttons
This commit is contained in:
parent
56cda31f8c
commit
781a1f8967
9 changed files with 24 additions and 23 deletions
|
|
@ -19,7 +19,7 @@
|
||||||
:textPosition="textPosition"
|
:textPosition="textPosition"
|
||||||
:isMultiSelect="isMultiSelect"
|
:isMultiSelect="isMultiSelect"
|
||||||
:groupName="groupName"
|
:groupName="groupName"
|
||||||
:loaderEnabled="loaderEnabled"
|
:selectingInitiatesLoad="selectingInitiatesLoad"
|
||||||
:loaderColor="loaderColor"
|
:loaderColor="loaderColor"
|
||||||
:loaderPosition="loaderPosition"
|
:loaderPosition="loaderPosition"
|
||||||
:sizeInRem="sizeInRem"
|
:sizeInRem="sizeInRem"
|
||||||
|
|
@ -31,7 +31,6 @@
|
||||||
screenReaderOnlyText="(opens new window)"
|
screenReaderOnlyText="(opens new window)"
|
||||||
:colLength="this.answers.length < 3 ? '' : '-4'"
|
:colLength="this.answers.length < 3 ? '' : '-4'"
|
||||||
:selectedButtonIDs="selectedValues"
|
:selectedButtonIDs="selectedValues"
|
||||||
:newPageOnSelect="isOverflowScrollable"
|
|
||||||
data-test="button"
|
data-test="button"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -61,7 +60,7 @@ export default {
|
||||||
type: String,
|
type: String,
|
||||||
default: "text-center",
|
default: "text-center",
|
||||||
},
|
},
|
||||||
loaderEnabled: Boolean,
|
selectingInitiatesLoad: Boolean,
|
||||||
loaderColor: {
|
loaderColor: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "blue",
|
default: "blue",
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
<buttonQuestion
|
<buttonQuestion
|
||||||
class="radioQuestion"
|
class="radioQuestion"
|
||||||
isOverflowScrollable
|
isOverflowScrollable
|
||||||
|
selectingInitiatesLoad
|
||||||
:questionText="questionText"
|
:questionText="questionText"
|
||||||
:answers="makes"
|
:answers="makes"
|
||||||
groupName="Choose Vehicle Make"
|
groupName="Choose Vehicle Make"
|
||||||
textPosition="text-start"
|
textPosition="text-start"
|
||||||
:loaderEnabled="true"
|
|
||||||
v-model="selectedValueAsArray"
|
v-model="selectedValueAsArray"
|
||||||
isRequired=true
|
isRequired=true
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
<buttonQuestion
|
<buttonQuestion
|
||||||
class="radioQuestion"
|
class="radioQuestion"
|
||||||
isOverflowScrollable
|
isOverflowScrollable
|
||||||
|
selectingInitiatesLoad
|
||||||
:questionText="questionText"
|
:questionText="questionText"
|
||||||
:answers="models"
|
:answers="models"
|
||||||
groupName="Choose Vehicle Model"
|
groupName="Choose Vehicle Model"
|
||||||
textPosition="text-start"
|
textPosition="text-start"
|
||||||
:loaderEnabled="true"
|
|
||||||
v-model="selectedValueAsArray"
|
v-model="selectedValueAsArray"
|
||||||
isRequired=true
|
isRequired=true
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
<buttonQuestion
|
<buttonQuestion
|
||||||
class="radioQuestion"
|
class="radioQuestion"
|
||||||
isOverflowScrollable
|
isOverflowScrollable
|
||||||
|
selectingInitiatesLoad
|
||||||
:questionText="questionText"
|
:questionText="questionText"
|
||||||
:answers="styles"
|
:answers="styles"
|
||||||
groupName="Choose Vehicle Style"
|
groupName="Choose Vehicle Style"
|
||||||
textPosition="text-start"
|
textPosition="text-start"
|
||||||
:loaderEnabled="true"
|
|
||||||
v-model="selectedValueAsArray"
|
v-model="selectedValueAsArray"
|
||||||
isRequired=true
|
isRequired=true
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
<buttonQuestion
|
<buttonQuestion
|
||||||
class="radioQuestion"
|
class="radioQuestion"
|
||||||
isOverflowScrollable
|
isOverflowScrollable
|
||||||
|
selectingInitiatesLoad
|
||||||
:questionText="questionText"
|
:questionText="questionText"
|
||||||
:answers="years"
|
:answers="years"
|
||||||
groupName="Choose Vehicle Year"
|
groupName="Choose Vehicle Year"
|
||||||
textPosition="text-start"
|
textPosition="text-start"
|
||||||
:loaderEnabled="true"
|
|
||||||
v-model="selectedValueAsArray"
|
v-model="selectedValueAsArray"
|
||||||
isRequired=true
|
isRequired=true
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ describe("list-button-horizontal.vue", () => {
|
||||||
// Act
|
// Act
|
||||||
const wrapper = shallowMount(listButtonHorizontal, {
|
const wrapper = shallowMount(listButtonHorizontal, {
|
||||||
propsData: {
|
propsData: {
|
||||||
loaderEnabled: true,
|
selectingInitiatesLoad: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ describe("list-button-horizontal.vue", () => {
|
||||||
const wrapper = shallowMount(listButtonHorizontal, {
|
const wrapper = shallowMount(listButtonHorizontal, {
|
||||||
propsData: {
|
propsData: {
|
||||||
loaderColor: "blue",
|
loaderColor: "blue",
|
||||||
loaderEnabled: true,
|
selectingInitiatesLoad: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -135,7 +135,7 @@ describe("list-button-horizontal.vue", () => {
|
||||||
const wrapper = shallowMount(listButtonHorizontal, {
|
const wrapper = shallowMount(listButtonHorizontal, {
|
||||||
propsData: {
|
propsData: {
|
||||||
loaderPosition: "right",
|
loaderPosition: "right",
|
||||||
loaderEnabled: true,
|
selectingInitiatesLoad: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -157,7 +157,7 @@ describe("list-button-horizontal.vue", () => {
|
||||||
const wrapper = shallowMount(listButtonHorizontal, {
|
const wrapper = shallowMount(listButtonHorizontal, {
|
||||||
propsData: {
|
propsData: {
|
||||||
sizeInRem: 1,
|
sizeInRem: 1,
|
||||||
loaderEnabled: true,
|
selectingInitiatesLoad: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
:aria-required="isRequired"
|
:aria-required="isRequired"
|
||||||
:data-focus-target="groupName"
|
:data-focus-target="groupName"
|
||||||
v-model="checkValue"
|
v-model="checkValue"
|
||||||
@change="handleCheckChange"
|
@change="!selectingInitiatesLoad ? handleCheckChange : ''"
|
||||||
/>
|
/>
|
||||||
<label
|
<label
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
|
|
@ -60,7 +60,7 @@ export default {
|
||||||
buttonLabelSubCopy: String,
|
buttonLabelSubCopy: String,
|
||||||
screenReaderOnlyText: String,
|
screenReaderOnlyText: String,
|
||||||
textPosition: String,
|
textPosition: String,
|
||||||
loaderEnabled: Boolean,
|
selectingInitiatesLoad: Boolean,
|
||||||
loaderColor: String,
|
loaderColor: String,
|
||||||
loaderPosition: String,
|
loaderPosition: String,
|
||||||
sizeInRem: [Number, String],
|
sizeInRem: [Number, String],
|
||||||
|
|
@ -88,8 +88,9 @@ export default {
|
||||||
this.isLoaderDisplayed = true;
|
this.isLoaderDisplayed = true;
|
||||||
},
|
},
|
||||||
handleClick(value) {
|
handleClick(value) {
|
||||||
if (this.loaderEnabled) {
|
if(this.selectingInitiatesLoad) {
|
||||||
this.displayLoader();
|
this.displayLoader();
|
||||||
|
this.handleCheckChange();
|
||||||
}
|
}
|
||||||
this.handleChange(value);
|
this.handleChange(value);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ describe("list-button.vue", () => {
|
||||||
// Act
|
// Act
|
||||||
const wrapper = shallowMount(listButton, {
|
const wrapper = shallowMount(listButton, {
|
||||||
propsData: {
|
propsData: {
|
||||||
loaderEnabled: true,
|
selectingInitiatesLoad: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ describe("list-button.vue", () => {
|
||||||
const wrapper = shallowMount(listButton, {
|
const wrapper = shallowMount(listButton, {
|
||||||
propsData: {
|
propsData: {
|
||||||
loaderColor: "blue",
|
loaderColor: "blue",
|
||||||
loaderEnabled: true,
|
selectingInitiatesLoad: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -135,7 +135,7 @@ describe("list-button.vue", () => {
|
||||||
const wrapper = shallowMount(listButton, {
|
const wrapper = shallowMount(listButton, {
|
||||||
propsData: {
|
propsData: {
|
||||||
loaderPosition: "right",
|
loaderPosition: "right",
|
||||||
loaderEnabled: true,
|
selectingInitiatesLoad: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -157,7 +157,7 @@ describe("list-button.vue", () => {
|
||||||
const wrapper = shallowMount(listButton, {
|
const wrapper = shallowMount(listButton, {
|
||||||
propsData: {
|
propsData: {
|
||||||
sizeInRem: 1,
|
sizeInRem: 1,
|
||||||
loaderEnabled: true,
|
selectingInitiatesLoad: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
:aria-required="isRequired"
|
:aria-required="isRequired"
|
||||||
:data-focus-target="groupName"
|
:data-focus-target="groupName"
|
||||||
v-model="checkValue"
|
v-model="checkValue"
|
||||||
@change="!newPageOnSelect ? handleCheckChange : ''"
|
@change="!selectingInitiatesLoad ? handleCheckChange : ''"
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
|
|
@ -63,7 +63,7 @@ export default {
|
||||||
textPosition: String,
|
textPosition: String,
|
||||||
buttonLabelSubCopy: String,
|
buttonLabelSubCopy: String,
|
||||||
screenReaderOnlyText: String,
|
screenReaderOnlyText: String,
|
||||||
loaderEnabled: Boolean,
|
selectingInitiatesLoad: Boolean,
|
||||||
loaderColor: String,
|
loaderColor: String,
|
||||||
loaderPosition: String,
|
loaderPosition: String,
|
||||||
sizeInRem: [Number,String],
|
sizeInRem: [Number,String],
|
||||||
|
|
@ -73,7 +73,6 @@ export default {
|
||||||
default: "",
|
default: "",
|
||||||
},
|
},
|
||||||
selectedButtonIDs: [Array, String],
|
selectedButtonIDs: [Array, String],
|
||||||
newPageOnSelect: Boolean,
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -91,8 +90,10 @@ export default {
|
||||||
this.isLoaderDisplayed = true;
|
this.isLoaderDisplayed = true;
|
||||||
},
|
},
|
||||||
handleClick(value) {
|
handleClick(value) {
|
||||||
this.loaderEnabled ? this.displayLoader() : '';
|
if(this.selectingInitiatesLoad) {
|
||||||
this.newPageOnSelect ? this.handleCheckChange() : '';
|
this.displayLoader();
|
||||||
|
this.handleCheckChange();
|
||||||
|
}
|
||||||
this.handleChange(value);
|
this.handleChange(value);
|
||||||
},
|
},
|
||||||
handleCheckChange(newValue, oldValue){
|
handleCheckChange(newValue, oldValue){
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue