mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-12-12 06:15:27 +00:00
Merge "CodeMirrorPanel: specify type="button"
for ToggleButton"
This commit is contained in:
commit
c3689196ad
|
@ -167,6 +167,7 @@ class CodeMirrorPanel {
|
|||
// * cdx-toggle-button--toggled-off
|
||||
btn.className = 'cdx-toggle-button cdx-toggle-button--framed ' +
|
||||
`cdx-toggle-button--toggled-${ checked ? 'on' : 'off' } cm-mw-panel--toggle-button`;
|
||||
btn.type = 'button';
|
||||
btn.dataset.checked = String( checked );
|
||||
btn.setAttribute( 'aria-pressed', checked );
|
||||
// The following messages may be used here:
|
||||
|
|
|
@ -75,6 +75,7 @@ describe( 'CodeMirrorPanel', () => {
|
|||
expect( toggleButtonOn.className ).toBe(
|
||||
'cdx-toggle-button cdx-toggle-button--framed cdx-toggle-button--toggled-on cm-mw-panel--toggle-button'
|
||||
);
|
||||
expect( toggleButtonOn.type ).toBe( 'button' );
|
||||
expect( toggleButtonOn.dataset.checked ).toBe( 'true' );
|
||||
expect( toggleButtonOn.getAttribute( 'aria-pressed' ) ).toBe( 'true' );
|
||||
expect( toggleButtonOn.title ).toBe( 'bar' );
|
||||
|
@ -88,6 +89,7 @@ describe( 'CodeMirrorPanel', () => {
|
|||
expect( toggleButtonOff.className ).toBe(
|
||||
'cdx-toggle-button cdx-toggle-button--framed cdx-toggle-button--toggled-off cm-mw-panel--toggle-button'
|
||||
);
|
||||
expect( toggleButtonOff.type ).toBe( 'button' );
|
||||
expect( toggleButtonOff.dataset.checked ).toBe( 'false' );
|
||||
expect( toggleButtonOff.getAttribute( 'aria-pressed' ) ).toBe( 'false' );
|
||||
} );
|
||||
|
|
Loading…
Reference in a new issue