Disable image uploading when input is disabled.
This commit is contained in:
parent
1e101eeaaf
commit
913b9098eb
2 changed files with 44 additions and 13 deletions
|
|
@ -330,4 +330,33 @@ describe("textboxQuestion.vue", () => {
|
||||||
expect(wrapper.vm.handleChange).not.toHaveBeenCalled();
|
expect(wrapper.vm.handleChange).not.toHaveBeenCalled();
|
||||||
expect(wrapper.emitted()).toHaveProperty("imageLookupError");
|
expect(wrapper.emitted()).toHaveProperty("imageLookupError");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Should not display camera or spinner icon when disabled", () => {
|
||||||
|
// Arrange
|
||||||
|
const inputId = "test";
|
||||||
|
|
||||||
|
const wrapper = shallowMount(textboxQuestion, {
|
||||||
|
global: {
|
||||||
|
directives: {
|
||||||
|
maska: maska,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
propsData: {
|
||||||
|
modelValue: "",
|
||||||
|
includeCameraIcon: true,
|
||||||
|
inputId: inputId,
|
||||||
|
isDisabled: true,
|
||||||
|
},
|
||||||
|
mixins: [mockMixin],
|
||||||
|
attachTo: document.body,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const cameraIcon = wrapper.find('[data-test="image-upload"]');
|
||||||
|
const loadingIcon = wrapper.findComponent('loader');
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(cameraIcon.exists()).toBe(false);
|
||||||
|
expect(loadingIcon.exists()).toBe(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -36,19 +36,21 @@
|
||||||
:maxlength="maxLength ? maxLength : '999'"
|
:maxlength="maxLength ? maxLength : '999'"
|
||||||
@focus="$emit('focus', $event.target.value)" />
|
@focus="$emit('focus', $event.target.value)" />
|
||||||
<button v-if="includeSearchIcon" type="submit" aria-label="Search button" />
|
<button v-if="includeSearchIcon" type="submit" aria-label="Search button" />
|
||||||
<label class="camera-icon-input" v-show="includeCameraIcon && !isLoading">
|
<template v-if="!isDisabled">
|
||||||
<input
|
<label class="camera-icon-input" v-show="includeCameraIcon && !isLoading">
|
||||||
type="file"
|
<input
|
||||||
id="vin-input"
|
type="file"
|
||||||
accept="image/jpeg,image/png"
|
id="vin-input"
|
||||||
aria-label="Camera icon/button"
|
accept="image/jpeg,image/png"
|
||||||
data-test="image-upload"
|
aria-label="Camera icon/button"
|
||||||
@change="submitImage" />
|
data-test="image-upload"
|
||||||
</label>
|
@change="submitImage" />
|
||||||
<loader
|
</label>
|
||||||
v-show="includeCameraIcon && isLoading"
|
<loader
|
||||||
loaderColor="blue"
|
v-show="includeCameraIcon && isLoading"
|
||||||
class="loading-icon"></loader>
|
loaderColor="blue"
|
||||||
|
class="loading-icon"></loader>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div v-show="errorMessage" class="row my-2 form-test-error">
|
<div v-show="errorMessage" class="row my-2 form-test-error">
|
||||||
<span class="d-inline-flex mt-0" role="alert">{{ errorMessage }}</span>
|
<span class="d-inline-flex mt-0" role="alert">{{ errorMessage }}</span>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue