Trevor Parscal has submitted this change and it was merged. Change subject: Update OOjs UI to v0.11.7 ......................................................................
Update OOjs UI to v0.11.7 Release notes: https://git.wikimedia.org/blob/oojs%2Fui.git/v0.11.7/History.md Change-Id: I0b78334f118ff351277652a5af0d240ef262769c --- M composer.json M composer.lock M composer/installed.json M oojs/oojs-ui/History.md M oojs/oojs-ui/README.md M oojs/oojs-ui/composer.json M oojs/oojs-ui/demos/pages/dialogs.js M oojs/oojs-ui/demos/pages/toolbars.js M oojs/oojs-ui/demos/pages/widgets.js M oojs/oojs-ui/i18n/eu.json M oojs/oojs-ui/i18n/fi.json A oojs/oojs-ui/i18n/hrx.json M oojs/oojs-ui/i18n/ku-latn.json M oojs/oojs-ui/i18n/nb.json M oojs/oojs-ui/i18n/sv.json M oojs/oojs-ui/i18n/yue.json M oojs/oojs-ui/package.json M oojs/oojs-ui/php/Element.php M oojs/oojs-ui/php/Theme.php M oojs/oojs-ui/src/themes/apex/tools.less M oojs/oojs-ui/src/themes/apex/windows.less M oojs/oojs-ui/src/themes/mediawiki/MediaWikiTheme.js M oojs/oojs-ui/src/themes/mediawiki/elements.less M oojs/oojs-ui/src/themes/mediawiki/images/icons/advanced.svg M oojs/oojs-ui/src/themes/mediawiki/tools.less M oojs/oojs-ui/src/themes/mediawiki/windows.less M oojs/oojs-ui/src/widgets/OptionWidget.js M oojs/oojs-ui/src/widgets/OutlineControlsWidget.js M oojs/oojs-ui/src/widgets/OutlineSelectWidget.js M oojs/oojs-ui/src/widgets/TabSelectWidget.js A oojs/oojs-ui/tests/phpunit/DummyWidget.php A oojs/oojs-ui/tests/phpunit/ElementTest.php A oojs/oojs-ui/tests/phpunit/TestCase.php 33 files changed, 306 insertions(+), 100 deletions(-) Approvals: Trevor Parscal: Verified; Looks good to me, approved diff --git a/composer.json b/composer.json index e8a7c8e..b0398cc 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "mediawiki/at-ease": "1.0.0", "monolog/monolog": "1.14.0", "ruflin/elastica": "1.3.0.0", - "oojs/oojs-ui": "0.11.6", + "oojs/oojs-ui": "0.11.7", "wikimedia/cdb": "1.0.1", "wikimedia/ip-set": "1.0.0", "wikimedia/assert": "0.2.2", diff --git a/composer.lock b/composer.lock index d2a122f..da11e67 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "03703b606ab21a36fcb6f8972b44c0d1", + "hash": "8bf717e642c6d53f4c2e3b77f335d75e", "packages": [ { "name": "cssjanus/cssjanus", @@ -287,16 +287,16 @@ }, { "name": "oojs/oojs-ui", - "version": "v0.11.6", + "version": "v0.11.7", "source": { "type": "git", "url": "https://github.com/wikimedia/oojs-ui.git", - "reference": "847c492f2ae8228a4b9ae866dc21212c60813820" + "reference": "6b0f7ec2c918db5029f697d0a3bc152991dbfc98" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/oojs-ui/zipball/847c492f2ae8228a4b9ae866dc21212c60813820", - "reference": "847c492f2ae8228a4b9ae866dc21212c60813820", + "url": "https://api.github.com/repos/wikimedia/oojs-ui/zipball/6b0f7ec2c918db5029f697d0a3bc152991dbfc98", + "reference": "6b0f7ec2c918db5029f697d0a3bc152991dbfc98", "shasum": "" }, "require": { @@ -319,7 +319,7 @@ ], "description": "Provides library of common widgets, layouts, and windows.", "homepage": "https://www.mediawiki.org/wiki/OOjs_UI", - "time": "2015-06-23 19:46:56" + "time": "2015-07-01 18:19:38" }, { "name": "psr/log", diff --git a/composer/installed.json b/composer/installed.json index b09eaa2..3beed6a 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -552,44 +552,6 @@ "description": "A Thin Wrapper for the Python Pygments" }, { - "name": "oojs/oojs-ui", - "version": "v0.11.6", - "version_normalized": "0.11.6.0", - "source": { - "type": "git", - "url": "https://github.com/wikimedia/oojs-ui.git", - "reference": "847c492f2ae8228a4b9ae866dc21212c60813820" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wikimedia/oojs-ui/zipball/847c492f2ae8228a4b9ae866dc21212c60813820", - "reference": "847c492f2ae8228a4b9ae866dc21212c60813820", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "jakub-onderka/php-parallel-lint": "0.9", - "mediawiki/mediawiki-codesniffer": "0.3.0", - "phpunit/phpunit": "~4.5" - }, - "time": "2015-06-23 19:46:56", - "type": "library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "php/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Provides library of common widgets, layouts, and windows.", - "homepage": "https://www.mediawiki.org/wiki/OOjs_UI" - }, - { "name": "monolog/monolog", "version": "1.14.0", "version_normalized": "1.14.0.0", @@ -759,5 +721,43 @@ ], "description": "Efficiently match IP addresses against a set of CIDR specifications.", "homepage": "https://github.com/wikimedia/IPSet" + }, + { + "name": "oojs/oojs-ui", + "version": "v0.11.7", + "version_normalized": "0.11.7.0", + "source": { + "type": "git", + "url": "https://github.com/wikimedia/oojs-ui.git", + "reference": "6b0f7ec2c918db5029f697d0a3bc152991dbfc98" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wikimedia/oojs-ui/zipball/6b0f7ec2c918db5029f697d0a3bc152991dbfc98", + "reference": "6b0f7ec2c918db5029f697d0a3bc152991dbfc98", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "jakub-onderka/php-parallel-lint": "0.9", + "mediawiki/mediawiki-codesniffer": "0.3.0", + "phpunit/phpunit": "~4.5" + }, + "time": "2015-07-01 18:19:38", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "php/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Provides library of common widgets, layouts, and windows.", + "homepage": "https://www.mediawiki.org/wiki/OOjs_UI" } ] diff --git a/oojs/oojs-ui/History.md b/oojs/oojs-ui/History.md index bac6382..86287ce 100644 --- a/oojs/oojs-ui/History.md +++ b/oojs/oojs-ui/History.md @@ -1,5 +1,19 @@ # OOjs UI Release History +## v0.11.7 / 2015-07-01 +* Element.php: Strip all namespaces from infused PHP widgets (Kunal Mehta) +* OptionWidget: Explicitly set aria-selected to 'false' on init (Bartosz Dziewoński) + +* MediaWiki theme: Add support for frameless primary buttons (Ed Sanders) +* MediaWiki theme: Align and center the advanced icon (Roan Kattouw) +* MediaWiki, Apex themes: Fix styling for frameless process dialog actions (Ed Sanders) + +* Element.php: Add test case to verify class name in infused widgets (Kunal Mehta) +* Element.php: Only variables may be passed by reference (Kunal Mehta) +* Theme.php: Actually make abstract in PHP (Kunal Mehta) +* Theme.php: Add missing doc comments (Kunal Mehta) +* documentation: Use bold in comments instead of h4 (Ed Sanders) + ## v0.11.6 / 2015-06-23 * NumberInputWidget: Don't use `Math.sign()` (Brad Jorsch) * SelectWidget: Fix invalid escape sequence '`\s`' (Roan Kattouw) diff --git a/oojs/oojs-ui/README.md b/oojs/oojs-ui/README.md index e537752..8969947 100644 --- a/oojs/oojs-ui/README.md +++ b/oojs/oojs-ui/README.md @@ -52,7 +52,7 @@ $ git checkout -B release -t origin/master # Ensure tests pass -$ npm install && npm test +$ npm install && composer update && npm test # Avoid using "npm version patch" because that creates # both a commit and a tag, and we shouldn't tag until after diff --git a/oojs/oojs-ui/composer.json b/oojs/oojs-ui/composer.json index 47a601a..c53c6fa 100644 --- a/oojs/oojs-ui/composer.json +++ b/oojs/oojs-ui/composer.json @@ -16,6 +16,12 @@ "php/" ] }, + "autoload-dev": { + "classmap": [ + "tests/phpunit/TestCase.php", + "tests/phpunit/DummyWidget.php" + ] + }, "scripts": { "test": [ "parallel-lint . --exclude vendor", diff --git a/oojs/oojs-ui/demos/pages/dialogs.js b/oojs/oojs-ui/demos/pages/dialogs.js index 6e9da3f..0a51051 100644 --- a/oojs/oojs-ui/demos/pages/dialogs.js +++ b/oojs/oojs-ui/demos/pages/dialogs.js @@ -39,7 +39,8 @@ ProcessDialog.static.title = 'Process dialog'; ProcessDialog.static.actions = [ { action: 'save', label: 'Done', flags: [ 'primary', 'progressive' ] }, - { action: 'cancel', label: 'Cancel', flags: 'safe' } + { action: 'cancel', label: 'Cancel', flags: 'safe' }, + { action: 'other', label: 'Other', flags: 'other' } ]; ProcessDialog.prototype.initialize = function () { ProcessDialog.super.prototype.initialize.apply( this, arguments ); @@ -59,6 +60,15 @@ ProcessDialog.prototype.getBodyHeight = function () { return this.content.$element.outerHeight( true ); }; + + function FramelessProcessDialog( config ) { + FramelessProcessDialog.super.call( this, config ); + } + OO.inheritClass( FramelessProcessDialog, ProcessDialog ); + FramelessProcessDialog.static.actions = OO.copy( FramelessProcessDialog.static.actions ); + FramelessProcessDialog.static.actions.forEach( function ( action ) { + action.framed = false; + } ); function SearchWidgetDialog( config ) { SearchWidgetDialog.super.call( this, config ); @@ -451,6 +461,13 @@ } }, { + name: 'Process dialog (frameless buttons)', + dialogClass: FramelessProcessDialog, + config: { + size: 'medium' + } + }, + { name: 'Process dialog (full)', dialogClass: ProcessDialog, config: { diff --git a/oojs/oojs-ui/demos/pages/toolbars.js b/oojs/oojs-ui/demos/pages/toolbars.js index 550d812..4a58a33 100644 --- a/oojs/oojs-ui/demos/pages/toolbars.js +++ b/oojs/oojs-ui/demos/pages/toolbars.js @@ -1,5 +1,5 @@ OO.ui.Demo.static.pages.toolbars = function ( demo ) { - var i, toolGroups, saveButton, actionButton, actionButtonDisabled, PopupTool, ToolGroupTool, + var i, toolGroups, saveButton, deleteButton, actionButton, actionButtonDisabled, PopupTool, ToolGroupTool, $demo = demo.$element, $containers = $(), toolFactories = [], @@ -217,14 +217,15 @@ } ] ); - saveButton = new OO.ui.ButtonWidget( { label: 'Save', flags: [ 'progressive', 'primary' ] } ); + saveButton = new OO.ui.ButtonWidget( { label: 'Save', framed: false, flags: [ 'progressive', 'primary' ] } ); + deleteButton = new OO.ui.ButtonWidget( { label: 'Delete', framed: false, flags: [ 'destructive' ] } ); actionButton = new OO.ui.ButtonWidget( { label: 'Action' } ); actionButtonDisabled = new OO.ui.ButtonWidget( { label: 'Disabled', disabled: true } ); toolbars[ 1 ].$actions .append( actionButton.$element, actionButtonDisabled.$element ); toolbars[ 3 ].$actions - .append( toolbars[ 2 ].$element, saveButton.$element ); + .append( toolbars[ 2 ].$element, deleteButton.$element, saveButton.$element ); for ( i = 0; i < toolbars.length; i++ ) { toolbars[ i ].emit( 'updateState' ); diff --git a/oojs/oojs-ui/demos/pages/widgets.js b/oojs/oojs-ui/demos/pages/widgets.js index 5c0843c..d4880b5 100644 --- a/oojs/oojs-ui/demos/pages/widgets.js +++ b/oojs/oojs-ui/demos/pages/widgets.js @@ -418,6 +418,18 @@ new OO.ui.FieldLayout( new OO.ui.ButtonWidget( { framed: false, + flags: [ 'progressive', 'primary' ], + icon: 'check', + label: 'Primary' + } ), + { + label: 'ButtonWidget (frameless, primary, progressive)\u200E', + align: 'top' + } + ), + new OO.ui.FieldLayout( + new OO.ui.ButtonWidget( { + framed: false, flags: [ 'warning' ], icon: 'alert', label: 'Warning' diff --git a/oojs/oojs-ui/i18n/eu.json b/oojs/oojs-ui/i18n/eu.json index d6a06bb..fe6e997 100644 --- a/oojs/oojs-ui/i18n/eu.json +++ b/oojs/oojs-ui/i18n/eu.json @@ -4,17 +4,20 @@ "An13sa", "Unai Fdz. de Betoño", "Xabier Armendaritz", - "Subi" + "Subi", + "Sator" ] }, "ooui-outline-control-move-down": "Mugitu itema beherantz", "ooui-outline-control-move-up": "Mugitu itema gorantz", + "ooui-outline-control-remove": "Elementua kendu", "ooui-toolbar-more": "Gehiago", "ooui-toolgroup-expand": "Gehiago", "ooui-toolgroup-collapse": "Gutxiago", "ooui-dialog-message-accept": "Ados", "ooui-dialog-message-reject": "Utzi", "ooui-dialog-process-error": "Zerbaitek huts egin du", + "ooui-dialog-process-dismiss": "Utzi", "ooui-dialog-process-retry": "Saiatu berriro", "ooui-dialog-process-continue": "Jarraitu", "ooui-selectfile-placeholder": "Ez da fitxategirik hautatu" diff --git a/oojs/oojs-ui/i18n/fi.json b/oojs/oojs-ui/i18n/fi.json index 3fb4110..d00254c 100644 --- a/oojs/oojs-ui/i18n/fi.json +++ b/oojs/oojs-ui/i18n/fi.json @@ -27,5 +27,7 @@ "ooui-dialog-process-error": "Jokin meni pieleen", "ooui-dialog-process-dismiss": "Hylkää", "ooui-dialog-process-retry": "Yritä uudelleen", - "ooui-dialog-process-continue": "Jatka" + "ooui-dialog-process-continue": "Jatka", + "ooui-selectfile-not-supported": "Tiedoston valitsemista ei tueta", + "ooui-selectfile-placeholder": "Tiedostoa ei ole valittu" } diff --git a/oojs/oojs-ui/i18n/hrx.json b/oojs/oojs-ui/i18n/hrx.json new file mode 100644 index 0000000..1534af7 --- /dev/null +++ b/oojs/oojs-ui/i18n/hrx.json @@ -0,0 +1,12 @@ +{ + "@metadata": { + "authors": [ + "Midnight Gambler" + ] + }, + "ooui-toolbar-more": "Meahr", + "ooui-toolgroup-expand": "Meahr", + "ooui-dialog-message-accept": "OK", + "ooui-dialog-message-reject": "Abbreche", + "ooui-dialog-process-dismiss": "Ausblenne" +} diff --git a/oojs/oojs-ui/i18n/ku-latn.json b/oojs/oojs-ui/i18n/ku-latn.json index a2bdbd5..94b4687 100644 --- a/oojs/oojs-ui/i18n/ku-latn.json +++ b/oojs/oojs-ui/i18n/ku-latn.json @@ -11,5 +11,6 @@ "ooui-dialog-message-accept": "Baş e", "ooui-dialog-message-reject": "Betal bike", "ooui-dialog-process-retry": "Dîsa hewl bide", - "ooui-dialog-process-continue": "Bidomîne" + "ooui-dialog-process-continue": "Bidomîne", + "ooui-selectfile-placeholder": "Ti dosye nehatiye hilbijartin" } diff --git a/oojs/oojs-ui/i18n/nb.json b/oojs/oojs-ui/i18n/nb.json index 9e77392..9e2d8f2 100644 --- a/oojs/oojs-ui/i18n/nb.json +++ b/oojs/oojs-ui/i18n/nb.json @@ -21,5 +21,6 @@ "ooui-dialog-process-error": "Noe gikk galt", "ooui-dialog-process-dismiss": "Lukk", "ooui-dialog-process-retry": "Prøv igjen", - "ooui-dialog-process-continue": "Fortsett" + "ooui-dialog-process-continue": "Fortsett", + "ooui-selectfile-placeholder": "Ingen fil er valgt" } diff --git a/oojs/oojs-ui/i18n/sv.json b/oojs/oojs-ui/i18n/sv.json index d499427..c2422ba 100644 --- a/oojs/oojs-ui/i18n/sv.json +++ b/oojs/oojs-ui/i18n/sv.json @@ -25,5 +25,6 @@ "ooui-dialog-process-error": "Något gick fel", "ooui-dialog-process-dismiss": "Stäng", "ooui-dialog-process-retry": "Försök igen", - "ooui-dialog-process-continue": "Fortsätt" + "ooui-dialog-process-continue": "Fortsätt", + "ooui-selectfile-placeholder": "Ingen fil är vald" } diff --git a/oojs/oojs-ui/i18n/yue.json b/oojs/oojs-ui/i18n/yue.json index 81ad9a9..d328e6e 100644 --- a/oojs/oojs-ui/i18n/yue.json +++ b/oojs/oojs-ui/i18n/yue.json @@ -1,16 +1,21 @@ { "@metadata": { "authors": [ - "Deryck Chan" + "Deryck Chan", + "William915" ] }, "ooui-outline-control-move-down": "向下搬", "ooui-outline-control-move-up": "向上搬", "ooui-outline-control-remove": "拎走", "ooui-toolbar-more": "仲有...", + "ooui-toolgroup-expand": "更多", "ooui-dialog-message-accept": "好", "ooui-dialog-message-reject": "取消", "ooui-dialog-process-error": "唔對路", "ooui-dialog-process-dismiss": "閂咗佢", - "ooui-dialog-process-retry": "再試過" + "ooui-dialog-process-retry": "再試過", + "ooui-dialog-process-continue": "繼續", + "ooui-selectfile-not-supported": "未有文件選擇功能", + "ooui-selectfile-placeholder": "無揀到文件" } diff --git a/oojs/oojs-ui/package.json b/oojs/oojs-ui/package.json index 7e54ce5..4ea4c75 100644 --- a/oojs/oojs-ui/package.json +++ b/oojs/oojs-ui/package.json @@ -1,6 +1,6 @@ { "name": "oojs-ui", - "version": "0.11.6", + "version": "0.11.7", "description": "User interface classes built on the OOjs framework.", "keywords": [ "oojs-plugin", diff --git a/oojs/oojs-ui/php/Element.php b/oojs/oojs-ui/php/Element.php index 7c87cdd..7a8cee1 100644 --- a/oojs/oojs-ui/php/Element.php +++ b/oojs/oojs-ui/php/Element.php @@ -247,7 +247,9 @@ }; array_walk_recursive( $config, $replaceElements ); // Set '_' last to ensure that subclasses can't accidentally step on it. - $config['_'] = preg_replace( '/^OOUI\\\\/', '', get_class( $this ) ); + // Strip all namespaces from the class name + $exploded = explode( '\\', get_class( $this ) ); + $config['_'] = end( $exploded ); return $config; } diff --git a/oojs/oojs-ui/php/Theme.php b/oojs/oojs-ui/php/Theme.php index d36b6d8..3aa7781 100644 --- a/oojs/oojs-ui/php/Theme.php +++ b/oojs/oojs-ui/php/Theme.php @@ -7,7 +7,7 @@ * * @abstract */ -class Theme { +abstract class Theme { /* Members */ @@ -15,10 +15,17 @@ /* Static Methods */ - public static function setSingleton( Theme $theme ) { + /** + * @param Theme|null $theme + */ + public static function setSingleton( Theme $theme = null ) { self::$singleton = $theme; } + /** + * @return Theme + * @throws Exception + */ public static function singleton() { if ( !self::$singleton ) { throw new Exception( __METHOD__ . ' was called with no singleton theme set.' ); diff --git a/oojs/oojs-ui/src/themes/apex/tools.less b/oojs/oojs-ui/src/themes/apex/tools.less index 913bb51..ca78a57 100644 --- a/oojs/oojs-ui/src/themes/apex/tools.less +++ b/oojs/oojs-ui/src/themes/apex/tools.less @@ -12,16 +12,29 @@ } &-actions { - > .oo-ui-buttonElement { + > .oo-ui-buttonElement-framed, + > .oo-ui-buttonElement-framed:last-child { margin-top: 0.4em; margin-bottom: 0.4em; - } - - > .oo-ui-buttonElement:last-child { margin-right: 0.5em; } + + > .oo-ui-buttonElement-frameless, + > .oo-ui-buttonElement-frameless:last-child { + &.oo-ui-labelElement { + margin: 0; + > .oo-ui-buttonElement-button { + margin: 0; + padding: 1.1953125em 0.3125em; + > .oo-ui-labelElement-label { + margin: 0 1em; + } + } + } + } } + &-shadow { .oo-ui-background-image('@{oo-ui-default-image-path}/toolbar-shadow.png'); bottom: -9px; diff --git a/oojs/oojs-ui/src/themes/apex/windows.less b/oojs/oojs-ui/src/themes/apex/windows.less index a73ec02..de5437f 100644 --- a/oojs/oojs-ui/src/themes/apex/windows.less +++ b/oojs/oojs-ui/src/themes/apex/windows.less @@ -176,9 +176,19 @@ } &.oo-ui-buttonElement-framed { - margin: 0.75em 0 0.75em 0.75em; + margin: 0.75em; .oo-ui-buttonElement-button { padding: 0 1em; + vertical-align: middle; + /* Adjust for border so text aligns with title */ + margin: -1px; + } + } + + &.oo-ui-buttonElement-frameless { + margin: 0; + .oo-ui-buttonElement-button { + padding: 0.75em 1em; vertical-align: middle; } } @@ -194,14 +204,6 @@ &:active { background-color: rgba(0,0,0,0.1); - } - - &.oo-ui-buttonElement-framed { - margin: 0.75em; - .oo-ui-buttonElement-button { - /* Adjust for border so text aligns with title */ - margin: -1px; - } } &.oo-ui-flaggedElement { @@ -241,6 +243,14 @@ } } } + + &-other { + .oo-ui-actionWidget { + &.oo-ui-buttonElement { + margin-right: 0; + } + } + } } > .oo-ui-window-frame { diff --git a/oojs/oojs-ui/src/themes/mediawiki/MediaWikiTheme.js b/oojs/oojs-ui/src/themes/mediawiki/MediaWikiTheme.js index edad3f8..9e2a7cb 100644 --- a/oojs/oojs-ui/src/themes/mediawiki/MediaWikiTheme.js +++ b/oojs/oojs-ui/src/themes/mediawiki/MediaWikiTheme.js @@ -34,7 +34,10 @@ if ( element.supports( [ 'hasFlag' ] ) ) { isFramed = element.supports( [ 'isFramed' ] ) && element.isFramed(); - if ( isFramed && ( element.isDisabled() || element.hasFlag( 'primary' ) ) ) { + if ( + ( isFramed && ( element.isDisabled() || element.hasFlag( 'primary' ) ) ) || + ( !isFramed && element.hasFlag( 'primary' ) ) + ) { variants.invert = true; } else { variants.progressive = element.hasFlag( 'progressive' ); diff --git a/oojs/oojs-ui/src/themes/mediawiki/elements.less b/oojs/oojs-ui/src/themes/mediawiki/elements.less index edf944b..fa1b9d7 100644 --- a/oojs/oojs-ui/src/themes/mediawiki/elements.less +++ b/oojs/oojs-ui/src/themes/mediawiki/elements.less @@ -29,7 +29,7 @@ height: @icon-size; } - &-frameless { + &-frameless:not( .oo-ui-flaggedElement-primary ) { > .oo-ui-buttonElement-button { &:focus { box-shadow: inset 0 0 0 1px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.2); @@ -98,6 +98,25 @@ margin: 0.1em 0; padding: 0.2em 0.8em; border-radius: @border-radius; + } + + // Support <input/> from ButtonInputWidget + > input.oo-ui-buttonElement-button, + &.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-labelElement-label { + line-height: @icon-size; + } + + &.oo-ui-widget-disabled > .oo-ui-buttonElement-button { + border: 1px solid @disabled-background; + } + + &.oo-ui-widget-enabled > .oo-ui-buttonElement-button { + border: @neutral-button-border; + } + } + + &-framed, &-frameless.oo-ui-flaggedElement-primary { + > .oo-ui-buttonElement-button { &:hover, &:focus { @@ -111,11 +130,6 @@ ); } - // Support <input/> from ButtonInputWidget - > input.oo-ui-buttonElement-button, - &.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-labelElement-label { - line-height: @icon-size; - } &.oo-ui-iconElement { > .oo-ui-buttonElement-button > .oo-ui-iconElement-icon { @@ -145,14 +159,12 @@ &.oo-ui-widget-disabled > .oo-ui-buttonElement-button { color: @disabled-framed-text; background: @disabled-background; - border: 1px solid @disabled-background; } &.oo-ui-widget-enabled { > .oo-ui-buttonElement-button { color: @text; background-color: @background; - border: @neutral-button-border; &:hover { background-color: darken(@background,8%); diff --git a/oojs/oojs-ui/src/themes/mediawiki/images/icons/advanced.svg b/oojs/oojs-ui/src/themes/mediawiki/images/icons/advanced.svg index 3159624..cdf07b2 100644 --- a/oojs/oojs-ui/src/themes/mediawiki/images/icons/advanced.svg +++ b/oojs/oojs-ui/src/themes/mediawiki/images/icons/advanced.svg @@ -1,4 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> - <path d="M20 14.5v-2.9l-1.8-.3c-.1-.4-.3-.8-.6-1.4l1.1-1.5-2.1-2.1-1.5 1.1c-.5-.3-1-.5-1.4-.6L13.5 5h-2.9l-.3 1.8c-.5.1-.9.3-1.4.6L7.4 6.3 5.3 8.4l1 1.5c-.3.5-.4.9-.6 1.4l-1.7.2v2.9l1.8.3c.1.5.3.9.6 1.4l-1 1.5 2.1 2.1 1.5-1c.4.2.9.4 1.4.6l.3 1.8h3l.3-1.8c.5-.1.9-.3 1.4-.6l1.5 1.1 2.1-2.1-1.1-1.5c.3-.5.5-1 .6-1.4l1.5-.3zM12 16c-1.7 0-3-1.3-3-3s1.3-3 3-3 3 1.3 3 3-1.3 3-3 3z"/> + <path d="M20 13.44v-2.88l-1.8-.3c-.1-.397-.3-.794-.6-1.39l1.1-1.49-2.1-2.088-1.5 1.093c-.5-.298-1-.497-1.4-.596L13.5 4h-2.9l-.3 1.79c-.5.098-.9.297-1.4.595L7.4 5.292 5.3 7.38l1 1.49c-.3.496-.4.894-.6 1.39l-1.7.2v2.882l1.8.298c.1.497.3.894.6 1.39l-1 1.492 2.1 2.087 1.5-.995c.4.2.9.397 1.4.596l.3 1.79h3l.3-1.79c.5-.098.9-.297 1.4-.595l1.5 1.093L19 16.62l-1.1-1.49c.3-.496.5-.993.6-1.39l1.5-.3zm-8 1.492c-1.7 0-3-1.292-3-2.982 0-1.69 1.3-2.98 3-2.98s3 1.29 3 2.98-1.3 2.982-3 2.982z"/> </svg> diff --git a/oojs/oojs-ui/src/themes/mediawiki/tools.less b/oojs/oojs-ui/src/themes/mediawiki/tools.less index fa5d6dd..9112c1a 100644 --- a/oojs/oojs-ui/src/themes/mediawiki/tools.less +++ b/oojs/oojs-ui/src/themes/mediawiki/tools.less @@ -24,14 +24,21 @@ } &-actions { - > .oo-ui-buttonElement { + > .oo-ui-buttonElement-framed, + > .oo-ui-buttonElement-framed:last-child { margin-top: 0.25em; margin-bottom: 0.25em; + margin-right: 0.5em; } - > .oo-ui-toolbar, - > .oo-ui-buttonElement:last-child { - margin-right: 0.5em; + > .oo-ui-buttonElement-frameless.oo-ui-labelElement { + margin: 0; + > .oo-ui-buttonElement-button { + padding: 1.0546875em 0.3125em; + > .oo-ui-labelElement-label { + margin: 0 1em; + } + } } } } diff --git a/oojs/oojs-ui/src/themes/mediawiki/windows.less b/oojs/oojs-ui/src/themes/mediawiki/windows.less index 52b5dfc..f097f7e 100644 --- a/oojs/oojs-ui/src/themes/mediawiki/windows.less +++ b/oojs/oojs-ui/src/themes/mediawiki/windows.less @@ -169,9 +169,19 @@ } &.oo-ui-buttonElement-framed { - margin: 0.75em 0 0.75em 0.75em; + margin: 0.75em; .oo-ui-buttonElement-button { padding: 0 1em; + vertical-align: middle; + /* Adjust for border so text aligns with title */ + margin: -1px; + } + } + + &.oo-ui-buttonElement-frameless { + margin: 0; + .oo-ui-buttonElement-button { + padding: 0.75em 1em; vertical-align: middle; } } @@ -187,14 +197,6 @@ &:active { background-color: rgba(0,0,0,0.1); - } - - &.oo-ui-buttonElement-framed { - margin: 0.75em; - .oo-ui-buttonElement-button { - /* Adjust for border so text aligns with title */ - margin: -1px; - } } &.oo-ui-flaggedElement { @@ -234,6 +236,14 @@ } } } + + &-other { + .oo-ui-actionWidget { + &.oo-ui-buttonElement { + margin-right: 0; + } + } + } } > .oo-ui-window-frame { diff --git a/oojs/oojs-ui/src/widgets/OptionWidget.js b/oojs/oojs-ui/src/widgets/OptionWidget.js index f85aaa1..b8f8488 100644 --- a/oojs/oojs-ui/src/widgets/OptionWidget.js +++ b/oojs/oojs-ui/src/widgets/OptionWidget.js @@ -35,6 +35,7 @@ this.$element .data( 'oo-ui-optionWidget', this ) .attr( 'role', 'option' ) + .attr( 'aria-selected', 'false' ) .addClass( 'oo-ui-optionWidget' ) .append( this.$label ); }; diff --git a/oojs/oojs-ui/src/widgets/OutlineControlsWidget.js b/oojs/oojs-ui/src/widgets/OutlineControlsWidget.js index e6bd614..ae90a3c 100644 --- a/oojs/oojs-ui/src/widgets/OutlineControlsWidget.js +++ b/oojs/oojs-ui/src/widgets/OutlineControlsWidget.js @@ -1,7 +1,8 @@ /** * OutlineControlsWidget is a set of controls for an {@link OO.ui.OutlineSelectWidget outline select widget}. * Controls include moving items up and down, removing items, and adding different kinds of items. - * ####Currently, this class is only used by {@link OO.ui.BookletLayout booklet layouts}.#### + * + * **Currently, this class is only used by {@link OO.ui.BookletLayout booklet layouts}.** * * @class * @extends OO.ui.Widget diff --git a/oojs/oojs-ui/src/widgets/OutlineSelectWidget.js b/oojs/oojs-ui/src/widgets/OutlineSelectWidget.js index cbf36c3..c00b026 100644 --- a/oojs/oojs-ui/src/widgets/OutlineSelectWidget.js +++ b/oojs/oojs-ui/src/widgets/OutlineSelectWidget.js @@ -2,7 +2,7 @@ * OutlineSelectWidget is a structured list that contains {@link OO.ui.OutlineOptionWidget outline options} * A set of controls can be provided with an {@link OO.ui.OutlineControlsWidget outline controls} widget. * - * ####Currently, this class is only used by {@link OO.ui.BookletLayout booklet layouts}.#### + * **Currently, this class is only used by {@link OO.ui.BookletLayout booklet layouts}.** * * @class * @extends OO.ui.SelectWidget diff --git a/oojs/oojs-ui/src/widgets/TabSelectWidget.js b/oojs/oojs-ui/src/widgets/TabSelectWidget.js index 7992e38..a696815 100644 --- a/oojs/oojs-ui/src/widgets/TabSelectWidget.js +++ b/oojs/oojs-ui/src/widgets/TabSelectWidget.js @@ -1,7 +1,7 @@ /** * TabSelectWidget is a list that contains {@link OO.ui.TabOptionWidget tab options} * - * ####Currently, this class is only used by {@link OO.ui.IndexLayout index layouts}.#### + * **Currently, this class is only used by {@link OO.ui.IndexLayout index layouts}.** * * @class * @extends OO.ui.SelectWidget diff --git a/oojs/oojs-ui/tests/phpunit/DummyWidget.php b/oojs/oojs-ui/tests/phpunit/DummyWidget.php new file mode 100644 index 0000000..3da9939 --- /dev/null +++ b/oojs/oojs-ui/tests/phpunit/DummyWidget.php @@ -0,0 +1,8 @@ +<?php + +namespace FooBarBaz; + +use OOUI\Widget; + +class MockWidget extends Widget { +} diff --git a/oojs/oojs-ui/tests/phpunit/ElementTest.php b/oojs/oojs-ui/tests/phpunit/ElementTest.php new file mode 100644 index 0000000..37746b2 --- /dev/null +++ b/oojs/oojs-ui/tests/phpunit/ElementTest.php @@ -0,0 +1,30 @@ +<?php + +namespace OOUI\Tests; + +use OOUI\Widget; + +class ElementTest extends TestCase { + + public static function provideGetSerializedConfig() { + return array( + array( + new Widget( array( 'infusable' => true ) ), + '"_":"Widget"' + ), + array( + new \FooBarBaz\MockWidget( array( 'infusable' => true ) ), + '"_":"MockWidget"' + ), + ); + } + + /** + * @covers Element::getSerializedConfig + * @dataProvider provideGetSerializedConfig + */ + public function testGetSerializedConfig( $widget, $expected ) { + $this->assertContains( $expected, (string)$widget ); + } +} + diff --git a/oojs/oojs-ui/tests/phpunit/TestCase.php b/oojs/oojs-ui/tests/phpunit/TestCase.php new file mode 100644 index 0000000..cea0fe5 --- /dev/null +++ b/oojs/oojs-ui/tests/phpunit/TestCase.php @@ -0,0 +1,27 @@ +<?php + +namespace OOUI\Tests; + +use OOUI\MediaWikiTheme; +use PHPUnit_Framework_TestCase; +use OOUI\Theme; + +class TestCase extends PHPUnit_Framework_TestCase { + /** + * Subclasses can override + * @return Theme + */ + protected function getTheme() { + return new MediaWikiTheme(); + } + + public function setUp() { + parent::setUp(); + Theme::setSingleton( $this->getTheme() ); + } + + public function tearDown() { + Theme::setSingleton( null ); + parent::tearDown(); + } +} -- To view, visit https://gerrit.wikimedia.org/r/222164 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0b78334f118ff351277652a5af0d240ef262769c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/vendor Gerrit-Branch: master Gerrit-Owner: Jforrester <[email protected]> Gerrit-Reviewer: Legoktm <[email protected]> Gerrit-Reviewer: Siebrand <[email protected]> Gerrit-Reviewer: Trevor Parscal <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
