Remove VectorTableOfContentsBeginning flag

Bug: T334969
Change-Id: I9e931b7cdc443e73a41c92f5368f81b35285437e
This commit is contained in:
bwang 2023-05-08 17:10:52 -05:00 committed by Jdlrobson
parent 934a448c0a
commit 6f13caa775
7 changed files with 3 additions and 28 deletions

View file

@ -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(

View file

@ -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}}

View file

@ -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
};
}

View file

@ -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
}

View file

@ -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."

View file

@ -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,

View file

@ -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,