Merge "Add title attribute to settings gear icon"

This commit is contained in:
jenkins-bot 2021-04-02 19:57:18 +00:00 committed by Gerrit Code Review
commit cc1ba5b82a
10 changed files with 19 additions and 6 deletions

View file

@ -203,6 +203,7 @@
"popups-settings-save", "popups-settings-save",
"popups-settings-cancel", "popups-settings-cancel",
"popups-settings-enable", "popups-settings-enable",
"popups-settings-icon-gear-title",
"popups-settings-help", "popups-settings-help",
"popups-settings-help-ok", "popups-settings-help-ok",
"popups-preview-no-preview", "popups-preview-no-preview",

View file

@ -17,6 +17,7 @@
"popups-settings-cancel": "Cancel", "popups-settings-cancel": "Cancel",
"popups-settings-help": "You can turn previews back on using a link in the footer of the page.", "popups-settings-help": "You can turn previews back on using a link in the footer of the page.",
"popups-settings-enable": "Enable previews", "popups-settings-enable": "Enable previews",
"popups-settings-icon-gear-title": "Change page preview settings",
"popups-preview-no-preview": "There was an issue displaying this preview", "popups-preview-no-preview": "There was an issue displaying this preview",
"popups-preview-footer-read": "Go to this page", "popups-preview-footer-read": "Go to this page",
"popups-preview-disambiguation": "This title relates to more than one page", "popups-preview-disambiguation": "This title relates to more than one page",

View file

@ -27,6 +27,7 @@
"popups-settings-cancel": "Cancel button for the setting's dialog\n{{Identical|Cancel}}", "popups-settings-cancel": "Cancel button for the setting's dialog\n{{Identical|Cancel}}",
"popups-settings-help": "Help text explaining how to re-enable popups", "popups-settings-help": "Help text explaining how to re-enable popups",
"popups-settings-enable": "Link on the footer to enable popups if its disabled.\n\nSee also:\n* {{msg-mw|Popups-settings-option-off}}", "popups-settings-enable": "Link on the footer to enable popups if its disabled.\n\nSee also:\n* {{msg-mw|Popups-settings-option-off}}",
"popups-settings-icon-gear-title": "Title attribute of gear icon to change page preview settings.",
"popups-preview-no-preview": "The message shown to the user when a preview can't be generated.", "popups-preview-no-preview": "The message shown to the user when a preview can't be generated.",
"popups-preview-footer-read": "The link shown to the user when a preview can't be generated.", "popups-preview-footer-read": "The link shown to the user when a preview can't be generated.",
"popups-preview-disambiguation": "The description shown on a preview for a disambiguation page", "popups-preview-disambiguation": "The description shown on a preview for a disambiguation page",

View file

@ -67,7 +67,7 @@
"bundlesize": [ "bundlesize": [
{ {
"path": "resources/dist/index.js", "path": "resources/dist/index.js",
"maxSize": "14.1kB" "maxSize": "14.2kB"
} }
] ]
} }

Binary file not shown.

Binary file not shown.

View file

@ -174,10 +174,11 @@ function supportsCSSClipPath() {
function createPagePreview( model ) { function createPagePreview( model ) {
const thumbnail = createThumbnail( model.thumbnail, supportsCSSClipPath() ), const thumbnail = createThumbnail( model.thumbnail, supportsCSSClipPath() ),
hasThumbnail = thumbnail !== null, hasThumbnail = thumbnail !== null,
withCSSClipPath = supportsCSSClipPath(); withCSSClipPath = supportsCSSClipPath(),
linkTitle = mw.msg( 'popups-settings-icon-gear-title' );
return { return {
el: renderPagePreview( model, thumbnail, withCSSClipPath ), el: renderPagePreview( model, thumbnail, withCSSClipPath, linkTitle ),
hasThumbnail, hasThumbnail,
thumbnail, thumbnail,
isTall: hasThumbnail && thumbnail.isTall isTall: hasThumbnail && thumbnail.isTall

View file

@ -22,10 +22,11 @@ const templateHTML = `
* @param {ext.popups.PagePreviewModel} model * @param {ext.popups.PagePreviewModel} model
* @param {ext.popups.Thumbnail|null} thumbnail * @param {ext.popups.Thumbnail|null} thumbnail
* @param {boolean} withCSSClipPath * @param {boolean} withCSSClipPath
* @param {string} linkTitle
* @return {JQuery} * @return {JQuery}
*/ */
export function renderPagePreview( export function renderPagePreview(
model, thumbnail, withCSSClipPath model, thumbnail, withCSSClipPath, linkTitle
) { ) {
const $el = renderPopup( model.type, createNodeFromTemplate( templateHTML ) ); const $el = renderPopup( model.type, createNodeFromTemplate( templateHTML ) );
@ -36,6 +37,9 @@ export function renderPagePreview(
.attr( 'dir', model.languageDirection ) .attr( 'dir', model.languageDirection )
.attr( 'lang', model.languageCode ); .attr( 'lang', model.languageCode );
$el.find( '.mwe-popups-settings-icon' )
.attr( 'title', linkTitle );
if ( thumbnail ) { if ( thumbnail ) {
$el.find( '.mwe-popups-discreet' ).append( thumbnail.el ); $el.find( '.mwe-popups-discreet' ).append( thumbnail.el );
} else { } else {

View file

@ -156,6 +156,11 @@ QUnit.test( 'createPagePreview', ( assert ) => {
'ltr <"\'>', 'ltr <"\'>',
'Language direction is safely espaced' 'Language direction is safely espaced'
); );
assert.strictEqual(
preview.el.find( '.mwe-popups-settings-icon' ).attr( 'title' ),
'<popups-settings-icon-gear-title>',
'Title attribute is correct.'
);
} ); } );
QUnit.test( 'createEmptyPreview(model)', ( assert ) => { QUnit.test( 'createEmptyPreview(model)', ( assert ) => {

View file

@ -112,8 +112,8 @@ module.exports = ( env, argv ) => ( {
// Minified uncompressed size limits for chunks / assets and entrypoints. Keep these numbers // Minified uncompressed size limits for chunks / assets and entrypoints. Keep these numbers
// up-to-date and rounded to the nearest 10th of a kibibyte so that code sizing costs are // up-to-date and rounded to the nearest 10th of a kibibyte so that code sizing costs are
// well understood. Related to bundlesize minified, gzipped compressed file size tests. // well understood. Related to bundlesize minified, gzipped compressed file size tests.
maxAssetSize: 43.3 * 1024, maxAssetSize: 43.4 * 1024,
maxEntrypointSize: 43.3 * 1024, maxEntrypointSize: 43.4 * 1024,
// The default filter excludes map files but we rename ours. // The default filter excludes map files but we rename ours.
assetFilter: ( filename ) => !filename.endsWith( srcMapExt ) assetFilter: ( filename ) => !filename.endsWith( srcMapExt )