Class names with hyphens preferred over camel case

The classes were recently changed so provided this is merged before
next branch cut no need to worry about cached HTML.

Bug: T249073
Change-Id: Ib20c7a359bda858df89ebb245e682d321dd5acd0
This commit is contained in:
jdlrobson 2020-05-07 09:51:46 -07:00
parent 0ac61e7ae5
commit 4dfe4a97c9
8 changed files with 22 additions and 20 deletions

View file

@ -460,10 +460,12 @@ class VectorTemplate extends BaseTemplate {
bool $setLabelToSelected = false
) : array {
$class = ( count( $urls ) == 0 ) ? 'emptyPortlet' : '';
// FIXME: All menus should carry vector-menu, but this can only be done when
// Menu.less CSS has been generalised to not include layout.
$extraClasses = [
self::MENU_TYPE_DROPDOWN => 'vectorMenu-dropdown vectorMenu',
self::MENU_TYPE_TABS => 'vectorMenu-tabs vectorTabs',
self::MENU_TYPE_DEFAULT => 'vectorMenu-default',
self::MENU_TYPE_DROPDOWN => 'vector-menu-dropdown vectorMenu',
self::MENU_TYPE_TABS => 'vector-menu-tabs vectorTabs',
self::MENU_TYPE_DEFAULT => 'vector-menu',
];
$props = [

View file

@ -2,7 +2,7 @@
@import 'mediawiki.mixins.less';
/* Personal */
.vectorMenu-default,
.vector-menu,
/* FIXME: Remove p-personal selector when cache has cleared. */
#p-personal {
position: absolute;

View file

@ -4,7 +4,7 @@
/* Variants and Actions */
// FIXME: For cached HTML
.vectorMenu,
.vectorMenu-dropdown {
.vector-menu-dropdown {
direction: ltr;
float: left;
cursor: pointer;

View file

@ -8,7 +8,7 @@
/* Namespaces and Views */
// FIXME: For cached HTML
.vectorTabs,
.vectorMenu-tabs {
.vector-menu-tabs {
// Tab separator: Outer start border (left in LTR) of tab row.
background-position: left bottom;
float: left;

View file

@ -6,7 +6,7 @@ import { htmluserlangattributes } from './utils';
*/
const loggedOut = {
id: 'p-personal',
class: 'vectorMenu-default',
class: 'vector-menu',
'label-id': 'p-personal-label',
label: 'Personal tools',
'html-userlangattributes': htmluserlangattributes,
@ -18,7 +18,7 @@ const loggedOut = {
*/
const loggedInWithEcho = {
id: 'p-personal',
class: 'vectorMenu-default',
class: 'vector-menu',
'label-id': 'p-personal-label',
label: 'Personal tools',
'html-userlangattributes': htmluserlangattributes,
@ -32,7 +32,7 @@ const ULS_LANGUAGE_SELECTOR = '<li class="uls-trigger active"><a href="#">Englis
*/
const defaultMenu = {
id: 'p-generic',
class: 'vectorMenu-default',
class: 'vector-menu',
'label-id': 'p-generic-label',
label: 'Menu label',
'html-userlangattributes': htmluserlangattributes,
@ -46,7 +46,7 @@ const defaultMenu = {
*/
const loggedInWithULS = {
id: 'p-personal',
class: 'vectorMenu-default',
class: 'vector-menu',
'label-id': 'p-personal-label',
label: 'Personal tools',
'html-userlangattributes': htmluserlangattributes,

View file

@ -8,7 +8,7 @@ export { vectorMenuTemplate };
*/
export const moreData = {
'is-dropdown': true,
class: 'vectorMenu-dropdown vectorMenu',
class: 'vector-menu-dropdown',
label: 'More',
id: 'p-cactions',
'label-id': 'p-cactions-label',
@ -32,7 +32,7 @@ export const moreData = {
*/
export const variantsData = {
'is-dropdown': true,
class: 'vectorMenu-dropdown vectorMenu',
class: 'vector-menu-dropdown',
label: '新加坡简体',
id: 'p-variants',
'label-id': 'p-variants-label',

View file

@ -5,7 +5,7 @@ import { htmluserlangattributes } from './utils';
*/
export const pageActionsData = {
id: 'p-views',
class: 'vectorMenu-tabs vectorTabs',
class: 'vector-menu-tabs vectorTabs',
'label-id': 'p-views-label',
label: 'Views',
'html-userlangattributes': htmluserlangattributes,
@ -27,7 +27,7 @@ You can view its source [⌃⌥e]" accesskey="e">View source</a></li>
*/
export const namespaceTabsData = {
id: 'p-namespaces',
class: 'vectorMenu-tabs vectorTabs',
class: 'vector-menu-tabs vectorTabs',
'label-id': 'p-namespaces-label',
label: 'Namespaces',
'html-userlangattributes': htmluserlangattributes,

View file

@ -154,25 +154,25 @@ class VectorTemplateTest extends MediaWikiIntegrationTestCase {
$this->assertSame( $views, [
'id' => 'p-views',
'class' => 'emptyPortlet vectorMenu-tabs vectorTabs',
'class' => 'emptyPortlet vector-menu-tabs vectorTabs',
'label-id' => 'p-views-label',
'label' => 'Views',
'html-userlangattributes' => $langAttrs,
'html-items' => '',
'class' => 'emptyPortlet vectorMenu-tabs vectorTabs',
'class' => 'emptyPortlet vector-menu-tabs vectorTabs',
'is-dropdown' => false,
] );
$variants = $props['data-variants'];
$actions = $props['data-page-actions-more'];
$this->assertSame( $namespaces['class'],
'emptyPortlet vectorMenu-tabs vectorTabs' );
'emptyPortlet vector-menu-tabs vectorTabs' );
$this->assertSame( $variants['class'],
'emptyPortlet vectorMenu-dropdown vectorMenu' );
'emptyPortlet vector-menu-dropdown vectorMenu' );
$this->assertSame( $actions['class'],
'emptyPortlet vectorMenu-dropdown vectorMenu' );
'emptyPortlet vector-menu-dropdown vectorMenu' );
$this->assertSame( $props['data-personal-menu']['class'],
'emptyPortlet vectorMenu-default' );
'emptyPortlet vector-menu' );
}
}