Remove forced NoBreak's and associated test
This commit is contained in:
parent
4bbb7d877f
commit
8d20205e53
2 changed files with 1 additions and 47 deletions
|
|
@ -46,32 +46,6 @@ describe('dropdownQuestion.vue', () => {
|
||||||
expect(label.text()).toContain(questionText);
|
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 () => {
|
it('Should return input id as the id of the select field', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const wrapper = shallowMount(dropdownQuestion, {
|
const wrapper = shallowMount(dropdownQuestion, {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
:for="inputId"
|
:for="inputId"
|
||||||
:aria-label="questionText"
|
:aria-label="questionText"
|
||||||
class="form-label"
|
class="form-label"
|
||||||
v-html="labelText"></label>
|
v-html="questionText"></label>
|
||||||
<select
|
<select
|
||||||
:id="inputId"
|
:id="inputId"
|
||||||
v-model="selectedOption"
|
v-model="selectedOption"
|
||||||
|
|
@ -107,26 +107,6 @@ export default {
|
||||||
set(newValue) {
|
set(newValue) {
|
||||||
this.$emit('update:modelValue', newValue);
|
this.$emit('update:modelValue', newValue);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
labelText: {
|
|
||||||
get() {
|
|
||||||
const noBreakChar = '⁠';
|
|
||||||
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: {
|
watch: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue