Merge pull request #987 from Safelite/feature/richardson/INSR-7917
Updates for sub caption on textbox
This commit is contained in:
commit
19c34ac240
5 changed files with 22 additions and 4 deletions
|
|
@ -686,7 +686,7 @@ describe('TextboxQuestion', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.questionText).toBe(cmsContent);
|
expect(wrapper.vm.questionTextForAria).toBe(cmsContent);
|
||||||
});
|
});
|
||||||
describe('"value" should', () => {
|
describe('"value" should', () => {
|
||||||
test('get the modelValue prop', () => {
|
test('get the modelValue prop', () => {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<label
|
<label
|
||||||
v-if="displayQuestionText"
|
v-if="displayQuestionText"
|
||||||
:for="inputId"
|
:for="inputId"
|
||||||
:aria-label="questionText"
|
:aria-label="questionTextForAria"
|
||||||
class="form-label"
|
class="form-label"
|
||||||
:class="[questionAlignment === 'center' ? 'text-center w-100 mb-5' : '']"
|
:class="[questionAlignment === 'center' ? 'text-center w-100 mb-5' : '']"
|
||||||
v-html="questionText"></label>
|
v-html="questionText"></label>
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
:aria-disabled="isDisabled"
|
:aria-disabled="isDisabled"
|
||||||
:disabled="isDisabled"
|
:disabled="isDisabled"
|
||||||
:aria-required="isRequired"
|
:aria-required="isRequired"
|
||||||
:aria-label="questionText"
|
:aria-label="questionTextForAria"
|
||||||
:min="min"
|
:min="min"
|
||||||
:max="max"
|
:max="max"
|
||||||
:required="isRequired"
|
:required="isRequired"
|
||||||
|
|
@ -72,6 +72,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { useField, validate } from 'vee-validate';
|
import { useField, validate } from 'vee-validate';
|
||||||
|
import { extractSpanText } from '@/helpers/text-helper';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'textbox-question',
|
name: 'textbox-question',
|
||||||
|
|
@ -154,6 +155,9 @@ export default {
|
||||||
questionText() {
|
questionText() {
|
||||||
return this.getCmsContent(this.cmsWidgetName, 'QuestionText');
|
return this.getCmsContent(this.cmsWidgetName, 'QuestionText');
|
||||||
},
|
},
|
||||||
|
questionTextForAria() {
|
||||||
|
return extractSpanText(this.getCmsContent(this.cmsWidgetName, 'QuestionText'));
|
||||||
|
},
|
||||||
value: {
|
value: {
|
||||||
get() {
|
get() {
|
||||||
return this.modelValue;
|
return this.modelValue;
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,12 @@ export function stripRteStyle(stringWithStyleTag) {
|
||||||
return stringWithStyleTag.replace(regexExp, '');
|
return stringWithStyleTag.replace(regexExp, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function extractSpanText(spanElement) {
|
||||||
|
const tempContainer = document.createElement('div');
|
||||||
|
tempContainer.innerHTML = spanElement;
|
||||||
|
return tempContainer.textContent || tempContainer.innerText || '';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @function createOrderedListFromStringOfParagraphs
|
* @function createOrderedListFromStringOfParagraphs
|
||||||
* @summary
|
* @summary
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@
|
||||||
cmsWidgetName="HelpTextWidget"
|
cmsWidgetName="HelpTextWidget"
|
||||||
linkType="navigation"
|
linkType="navigation"
|
||||||
href="javascript:void(0)"
|
href="javascript:void(0)"
|
||||||
class="mt-3 text-left"
|
class="mb-5 text-left"
|
||||||
@clickEvent="handleHelpLinkClick" />
|
@clickEvent="handleHelpLinkClick" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,14 @@ body {
|
||||||
width: 58.33333333%;
|
width: 58.33333333%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.textbox-question {
|
||||||
|
label {
|
||||||
|
span.sub-caption {
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue