Skip to content

Commit 464150d

Browse files
committed
Enum Renderer - Set values as options' innerText
For every option created in the enum control, the enum literal's label is now also set as the option element's innerText. This allows proper display of the enum for stylings that rely on the innerText instead of the label of an option element.
1 parent ed7c79b commit 464150d

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/renderers/controls/enum.control.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export class EnumControl extends BaseControl<HTMLSelectElement> {
3535
const option = document.createElement('option');
3636
option.value = optionValue;
3737
option.label = optionValue;
38+
option.innerText = optionValue;
3839
input.appendChild(option);
3940
});
4041
}

test/renderers/enum.control.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ test('EnumControl static', t => {
169169
t.is(input.value, 'a');
170170
t.is(input.options.length, 2);
171171
t.is(input.options.item(0).value, 'a');
172+
t.is(input.options.item(0).innerText, 'a');
172173
t.is(input.options.item(1).value, 'b');
174+
t.is(input.options.item(1).innerText, 'b');
173175
const validation = result.children[2];
174176
t.is(validation.tagName, 'DIV');
175177
t.is(validation.children.length, 0);
@@ -200,7 +202,9 @@ test('EnumControl static no label', t => {
200202
t.is(input.value, 'b');
201203
t.is(input.options.length, 2);
202204
t.is(input.options.item(0).value, 'a');
205+
t.is(input.options.item(0).innerText, 'a');
203206
t.is(input.options.item(1).value, 'b');
207+
t.is(input.options.item(1).innerText, 'b');
204208
const validation = result.children[2];
205209
t.is(validation.tagName, 'DIV');
206210
t.is(validation.children.length, 0);

0 commit comments

Comments
 (0)