Add data-event-name attributes to legacy and sidebar TOC
Bug: T302934 Depends-on: I5ef98d5f5713d3d99bc5f7f8112ba2d1e0f62e22 Change-Id: I5806c346abf0375c85248659c636ae3b2d73f661
This commit is contained in:
parent
eb0e05dff1
commit
ac54984d75
|
@ -1,4 +1,4 @@
|
|||
<nav id="mw-panel-toc" class="sidebar-toc" role="navigation" aria-labelledby="sidebar-toc-header">
|
||||
<nav id="mw-panel-toc" class="sidebar-toc" role="navigation" aria-labelledby="sidebar-toc-header" data-event-name="ui.sidebar-toc">
|
||||
<div class="sidebar-toc-header">
|
||||
<h2 class="sidebar-toc-title" aria-hidden="true">{{ msg-vector-toc-heading }}</h2>
|
||||
</div>
|
||||
|
|
|
@ -8,6 +8,7 @@ const
|
|||
initTableOfContents = require( './tableOfContents.js' ),
|
||||
deferUntilFrame = require( './deferUntilFrame.js' ),
|
||||
TOC_ID = 'mw-panel-toc',
|
||||
LEGACY_TOC_ID = 'toc',
|
||||
BODY_CONTENT_ID = 'bodyContent',
|
||||
HEADLINE_SELECTOR = '.mw-headline',
|
||||
TOC_SECTION_ID_PREFIX = 'toc-';
|
||||
|
@ -68,8 +69,14 @@ const main = () => {
|
|||
|
||||
// Table of contents
|
||||
const tocElement = document.getElementById( TOC_ID );
|
||||
const legacyTOCElement = document.getElementById( LEGACY_TOC_ID );
|
||||
const bodyContent = document.getElementById( BODY_CONTENT_ID );
|
||||
|
||||
// Add event data attributes to legacy TOC
|
||||
if ( legacyTOCElement ) {
|
||||
legacyTOCElement.setAttribute( 'data-event-name', 'ui.toc' );
|
||||
}
|
||||
|
||||
if ( !(
|
||||
tocElement &&
|
||||
bodyContent &&
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Table of contents when \`vector-is-collapse-sections-enabled\` is false renders 1`] = `
|
||||
"<nav id=\\"mw-panel-toc\\" class=\\"sidebar-toc\\" role=\\"navigation\\" aria-labelledby=\\"sidebar-toc-header\\">
|
||||
"<nav id=\\"mw-panel-toc\\" class=\\"sidebar-toc\\" role=\\"navigation\\" aria-labelledby=\\"sidebar-toc-header\\" data-event-name=\\"ui.sidebar-toc\\">
|
||||
<div class=\\"sidebar-toc-header\\">
|
||||
<h2 class=\\"sidebar-toc-title\\" aria-hidden=\\"true\\">Contents</h2>
|
||||
</div>
|
||||
|
@ -53,7 +53,7 @@ exports[`Table of contents when \`vector-is-collapse-sections-enabled\` is false
|
|||
`;
|
||||
|
||||
exports[`Table of contents when \`vector-is-collapse-sections-enabled\` is true renders 1`] = `
|
||||
"<nav id=\\"mw-panel-toc\\" class=\\"sidebar-toc\\" role=\\"navigation\\" aria-labelledby=\\"sidebar-toc-header\\">
|
||||
"<nav id=\\"mw-panel-toc\\" class=\\"sidebar-toc\\" role=\\"navigation\\" aria-labelledby=\\"sidebar-toc-header\\" data-event-name=\\"ui.sidebar-toc\\">
|
||||
<div class=\\"sidebar-toc-header\\">
|
||||
<h2 class=\\"sidebar-toc-title\\" aria-hidden=\\"true\\">Contents</h2>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue