Skip to content

Commit 6005ecb

Browse files
committed
add a test for text button; set textContent instead of innerText
1 parent 4f4b69b commit 6005ecb

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/widgets/buttons.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ export function button (dom: HTMLDocument, iconURI: string | undefined, text: st
561561
img.title = text
562562
button.setAttribute('style', style.buttonStyle)
563563
} else {
564-
button.innerText = text.toLocaleUpperCase()
564+
button.textContent = text.toLocaleUpperCase()
565565
const style = getButtonStyle(options)
566566
const { classes } = getClasses(dom.head, {
567567
textButton: style

test/unit/widgets/buttons.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ describe('button', () => {
140140
const buttonElt = button(domWithHead(), iconURI, text, handler)
141141
buttonElt.dispatchEvent(clickEvent)
142142
})
143+
it('text button with upper-cased caption', () => {
144+
const buttonElt = button(domWithHead(), undefined, 'Click me', () => {})
145+
expect(buttonElt.innerHTML).toBe('CLICK ME')
146+
})
143147
})
144148

145149
describe('cancelButton', () => {

0 commit comments

Comments
 (0)