Remove forced NoBreak's and associated test

This commit is contained in:
Bill Richardson 2024-05-22 13:33:17 -04:00
parent 4bbb7d877f
commit 8d20205e53
2 changed files with 1 additions and 47 deletions

View file

@ -46,32 +46,6 @@ describe('dropdownQuestion.vue', () => {
expect(label.text()).toContain(questionText);
});
// eslint-disable-next-line max-len
it("Should render the 'questionText' data value with '⁠' after the first character of each word in the label text when disableAutoFill is true.", async () => {
// Arrange
const wrapper = shallowMount(dropdownQuestion, {
propsData: {
options: {},
disableAutoFill: true
},
mixins: [mockMixin]
});
// Mock CMS content ...
// Trust me, the below instance of the string "Question Text"
// actually has the & NoBreak; in it.You just can't see it
// Don't believe me? Copy and paste it into Google.
// Then inspect the search field element in Dev Tools,
// you will see "Q⁠uestion T⁠ext"
const expectedQuestionText = 'Question Text';
// Act
const label = wrapper.find('label');
// Assert
expect(label.text()).toContain(expectedQuestionText);
});
it('Should return input id as the id of the select field', async () => {
// Arrange
const wrapper = shallowMount(dropdownQuestion, {

View file

@ -6,7 +6,7 @@
:for="inputId"
:aria-label="questionText"
class="form-label"
v-html="labelText"></label>
v-html="questionText"></label>
<select
:id="inputId"
v-model="selectedOption"
@ -107,26 +107,6 @@ export default {
set(newValue) {
this.$emit('update:modelValue', newValue);
}
},
labelText: {
get() {
const noBreakChar = '&NoBreak;';
let questionText = '';
if (this.disableAutoFill) {
const words = this.questionText.toString().split(/[ ]+/);
words.forEach((word) => {
const position = 1;
const newWord = [word.toString().slice(0, position), noBreakChar, word.toString().slice(position)].join('');
questionText += `${newWord} `;
});
questionText = questionText.trimEnd();
} else {
questionText = this.questionText.toString();
}
return questionText;
}
}
},
watch: {