[vector] Menus: Make Tabs template fully-data driven to support upcoming navigation restructure work

- Template changes to use data driven links
- Template changes to use data driven list items
- Update unit tests
- Stop the hook from clearing data

Bug: T329794
Depends-On: Ide47c7ca7acabc21a94991d803f3683240a85f67
Change-Id: I523d7555b603b5382aa59eb25091338c7cc050ec
This commit is contained in:
Moh'd Khier Abualruz 2023-03-10 10:57:37 +01:00
parent 101176b001
commit 022954aff5
5 changed files with 17 additions and 5 deletions

View file

@ -1,5 +1,4 @@
<a data-mw="interface"
href="{{href}}"
{{{html-attributes}}}>{{!
<a data-mw="interface"{{!
}}{{#array-attributes}} {{key}}="{{value}}"{{/array-attributes}}>{{!
}}{{#icon}}{{>Icon}}{{/icon}}<span>{{text}}</span>{{!
}}</a>

View file

@ -3,5 +3,5 @@
}}
{{! DO NOT REMOVE vector-menu class. It is used for click tracking in Extension:WikimediaEvents }}
<div id="{{id}}" class="vector-menu vector-menu-tabs{{#class}} {{.}}{{/class}}" {{{html-tooltip}}} {{{html-user-language-attributes}}}>
{{>MenuContents}}
{{>TabsMenuContents}}
</div>

View file

@ -0,0 +1,6 @@
<li id="{{id}}" class="{{class}}">{{!
}}{{#array-links}}{{!
}}{{>Link}}{{!
}}{{/array-links}}{{!
}}{{text}}{{!
}}</li>

View file

@ -0,0 +1,7 @@
<div class="vector-menu-content">
{{{html-before-portal}}}
<ul class="vector-menu-content-list">
{{#array-items}}{{>TabsListItem}}{{/array-items}}
</ul>
{{{html-after-portal}}}
</div>

View file

@ -767,6 +767,6 @@ class VectorHooksTest extends MediaWikiIntegrationTestCase {
);
$updateItemData->setAccessible( true );
$data = $updateItemData->invokeArgs( null, [ $item, $buttonClassProp, $iconHtmlProp ] );
$this->assertEquals( $expected, $data );
$this->assertArraySubmapSame( $expected, $data );
}
}