mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-23 23:33:54 +00:00
Disable table of contents toggle on VE activation
While the table of contents is not updated by VisualEditor we should hide it. Bug: T307900 Change-Id: I246fbe0069329ef78735147b8d3f280433155158
This commit is contained in:
parent
93e8cfcd90
commit
5fdd66fa3b
|
@ -323,6 +323,14 @@ module.exports = function tableOfContents( props ) {
|
|||
|
||||
// Bind event listeners.
|
||||
bindClickListener();
|
||||
|
||||
// Hide TOC button on VE activation
|
||||
mw.hook( 've.activationStart' ).add( () => {
|
||||
const tocButton = document.getElementById( 'vector-toc-collapsed-button' );
|
||||
if ( tocButton ) {
|
||||
tocButton.style.display = 'none';
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
initialize();
|
||||
|
|
|
@ -95,6 +95,13 @@ describe( 'Table of contents', () => {
|
|||
beforeEach( () => {
|
||||
// @ts-ignore
|
||||
global.window.matchMedia = jest.fn( () => ( {} ) );
|
||||
|
||||
// @ts-ignore
|
||||
global.mw = {
|
||||
hook: jest.fn( () => ( {
|
||||
add: () => {}
|
||||
} ) )
|
||||
};
|
||||
} );
|
||||
|
||||
describe( 'renders', () => {
|
||||
|
@ -190,6 +197,7 @@ describe( 'Table of contents', () => {
|
|||
const toggleButton = /** @type {HTMLElement} */ ( barSection.querySelector( `.${toc.TOGGLE_CLASS}` ) );
|
||||
|
||||
expect( toggleButton.getAttribute( 'aria-expanded' ) ).toEqual( 'true' );
|
||||
expect( mw.hook ).toBeCalledWith( 've.activationStart' );
|
||||
} );
|
||||
|
||||
test( 'when expanding sections', () => {
|
||||
|
|
Loading…
Reference in a new issue