mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-23 23:33:54 +00:00
Remove VectorTableOfContentsBeginning flag
Bug: T334969 Change-Id: I9e931b7cdc443e73a41c92f5368f81b35285437e
This commit is contained in:
parent
934a448c0a
commit
6f13caa775
|
@ -85,9 +85,6 @@ class VectorComponentTableOfContents implements VectorComponent {
|
|||
|
||||
return $pinnableElement->getTemplateData() +
|
||||
array_merge( $this->tocData, [
|
||||
'is-vector-toc-beginning-enabled' => $this->config->get(
|
||||
'VectorTableOfContentsBeginning'
|
||||
),
|
||||
'vector-is-collapse-sections-enabled' =>
|
||||
count( $this->tocData['array-sections'] ) > 3 &&
|
||||
$this->tocData[ 'number-section-count'] >= $this->config->get(
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
<ul class="vector-toc-contents" id="mw-panel-toc-list">
|
||||
{{#is-vector-toc-beginning-enabled}}
|
||||
<li id="toc-mw-content-text"
|
||||
class="vector-toc-list-item vector-toc-level-1">
|
||||
<a href="#" class="vector-toc-link">
|
||||
<div class="vector-toc-text">{{ msg-vector-toc-beginning }}</div>
|
||||
</a>
|
||||
</li>
|
||||
{{/is-vector-toc-beginning-enabled}}
|
||||
{{#array-sections}}
|
||||
{{>TableOfContents__line}}
|
||||
{{/array-sections}}
|
||||
|
|
|
@ -81,7 +81,6 @@ const TOC_CONTENTS_ID = 'mw-panel-toc-list';
|
|||
|
||||
/**
|
||||
* @typedef {Object} SectionsListData
|
||||
* @property {boolean} is-vector-toc-beginning-enabled
|
||||
* @property {Section[]} array-sections
|
||||
* @property {boolean} vector-is-collapse-sections-enabled
|
||||
* @property {string} msg-vector-toc-beginning
|
||||
|
@ -570,8 +569,7 @@ module.exports = function tableOfContents( props ) {
|
|||
return {
|
||||
'msg-vector-toc-beginning': mw.message( 'vector-toc-beginning' ).text(),
|
||||
'array-sections': tableOfContentsLevel1Sections,
|
||||
'vector-is-collapse-sections-enabled': tableOfContentsLevel1Sections.length > 3 && sections.length >= tableOfContentsConfig.VectorTableOfContentsCollapseAtCount,
|
||||
'is-vector-toc-beginning-enabled': tableOfContentsConfig.VectorTableOfContentsBeginning
|
||||
'vector-is-collapse-sections-enabled': tableOfContentsLevel1Sections.length > 3 && sections.length >= tableOfContentsConfig.VectorTableOfContentsCollapseAtCount
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"@doc": "This is a virtual JSON generated by ResourceLoader. This file is used by Jest.",
|
||||
"VectorTableOfContentsCollapseAtCount": 20,
|
||||
"VectorTableOfContentsBeginning": true
|
||||
"VectorTableOfContentsCollapseAtCount": 20
|
||||
}
|
||||
|
|
|
@ -379,8 +379,7 @@
|
|||
{
|
||||
"name": "resources/skins.vector.js/tableOfContentsConfig.json",
|
||||
"config": [
|
||||
"VectorTableOfContentsCollapseAtCount",
|
||||
"VectorTableOfContentsBeginning"
|
||||
"VectorTableOfContentsCollapseAtCount"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -597,10 +596,6 @@
|
|||
"value": true,
|
||||
"description": "@var boolean Temporary feature flag that promotes the 'Add topic' link in the views menu, to a button in the page title bar."
|
||||
},
|
||||
"VectorTableOfContentsBeginning": {
|
||||
"value": true,
|
||||
"description": "@var boolean Temporary feature flag that controls link to beginning of article."
|
||||
},
|
||||
"VectorTableOfContentsCollapseAtCount": {
|
||||
"value": 28,
|
||||
"description": "@var The minimum number of headings required to collapse all headings in the sticky table of contents by default."
|
||||
|
|
|
@ -70,7 +70,6 @@ const SECTIONS = [
|
|||
*/
|
||||
function render( templateProps = {} ) {
|
||||
const templateData = Object.assign( {
|
||||
'is-vector-toc-beginning-enabled': true,
|
||||
'msg-vector-toc-beginning': 'Beginning',
|
||||
'vector-is-collapse-sections-enabled': false,
|
||||
'array-sections': SECTIONS,
|
||||
|
|
|
@ -36,7 +36,6 @@ class VectorComponentTableOfContentsTest extends \MediaWikiUnitTestCase {
|
|||
|
||||
public function provideGetTocData() {
|
||||
$config = [
|
||||
'VectorTableOfContentsBeginning' => true,
|
||||
'VectorTableOfContentsCollapseAtCount' => 1
|
||||
];
|
||||
$tocData = [
|
||||
|
@ -107,7 +106,6 @@ class VectorComponentTableOfContentsTest extends \MediaWikiUnitTestCase {
|
|||
];
|
||||
|
||||
$expectedConfigData = [
|
||||
'is-vector-toc-beginning-enabled' => $config[ 'VectorTableOfContentsBeginning' ],
|
||||
'vector-is-collapse-sections-enabled' =>
|
||||
count( $tocData['array-sections'] ) > 3 &&
|
||||
$tocData[ 'number-section-count' ] >= $config[ 'VectorTableOfContentsCollapseAtCount' ],
|
||||
|
@ -155,15 +153,6 @@ class VectorComponentTableOfContentsTest extends \MediaWikiUnitTestCase {
|
|||
// 'vector-is-collapse-sections-enabled' value is true
|
||||
array_merge( $tocData, $expectedConfigData )
|
||||
],
|
||||
// When "Beginning" TOC section is configured to be turned off
|
||||
[
|
||||
$tocData,
|
||||
array_merge( $config, [ 'VectorTableOfContentsBeginning' => false ] ),
|
||||
// 'is-vector-toc-beginning-enabled' value is false
|
||||
array_merge( $tocData, $expectedConfigData, [
|
||||
'is-vector-toc-beginning-enabled' => false
|
||||
] )
|
||||
],
|
||||
// When TOC has sections with top level parent sections
|
||||
[
|
||||
$nestedTocData,
|
||||
|
|
Loading…
Reference in a new issue