mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-11 16:38:20 +00:00
Merge "Revert "tests: Adopt private require() for skins.minerva.scripts""
This commit is contained in:
commit
48c0eb44fb
|
@ -46,9 +46,7 @@ function init() {
|
|||
);
|
||||
}
|
||||
|
||||
if ( !window.QUnit ) {
|
||||
init();
|
||||
}
|
||||
init();
|
||||
|
||||
module.exports = {
|
||||
// Version number allows breaking changes to be detected by other extensions
|
||||
|
|
99
skin.json
99
skin.json
|
@ -522,8 +522,6 @@
|
|||
]
|
||||
},
|
||||
"skins.minerva.scripts": {
|
||||
"localBasePath": "resources/skins.minerva.scripts",
|
||||
"remoteSkinPath": "MinervaNeue/resources/skins.minerva.scripts",
|
||||
"dependencies": [
|
||||
"skins.minerva.mainMenu.icons",
|
||||
"skins.minerva.mainMenu.styles",
|
||||
|
@ -563,40 +561,40 @@
|
|||
"mobile-frontend-redirected-from"
|
||||
],
|
||||
"styles": [
|
||||
"styles.less"
|
||||
"resources/skins.minerva.scripts/styles.less"
|
||||
],
|
||||
"templates": {
|
||||
"IssueNotice.mustache": "page-issues/overlay/IssueNotice.mustache"
|
||||
"IssueNotice.mustache": "resources/skins.minerva.scripts/page-issues/overlay/IssueNotice.mustache"
|
||||
},
|
||||
"packageFiles": [
|
||||
"setup.js",
|
||||
"reportIfNightModeWasDisabledOnPage.js",
|
||||
"addPortletLink.js",
|
||||
"initMobile.js",
|
||||
"searchSuggestReveal.js",
|
||||
"drawers.js",
|
||||
"ctaDrawers.js",
|
||||
"menu.js",
|
||||
"preInit.js",
|
||||
"downloadPageAction.js",
|
||||
"page-issues/parser.js",
|
||||
"AB.js",
|
||||
"page-issues/overlay/IssueNotice.js",
|
||||
"page-issues/overlay/IssueList.js",
|
||||
"page-issues/overlay/pageIssuesOverlay.js",
|
||||
"page-issues/page/PageIssueLearnMoreLink.js",
|
||||
"page-issues/page/PageIssueLink.js",
|
||||
"page-issues/page/pageIssueFormatter.js",
|
||||
"page-issues/index.js",
|
||||
"UriUtil.js",
|
||||
"TitleUtil.js",
|
||||
"../../includes/Skins/ToggleList/ToggleList.js",
|
||||
"TabScroll.js",
|
||||
"Toolbar.js",
|
||||
"mobileRedirect.js",
|
||||
"search.js",
|
||||
"references.js",
|
||||
"watchstar.js"
|
||||
"resources/skins.minerva.scripts/setup.js",
|
||||
"resources/skins.minerva.scripts/reportIfNightModeWasDisabledOnPage.js",
|
||||
"resources/skins.minerva.scripts/addPortletLink.js",
|
||||
"resources/skins.minerva.scripts/initMobile.js",
|
||||
"resources/skins.minerva.scripts/searchSuggestReveal.js",
|
||||
"resources/skins.minerva.scripts/drawers.js",
|
||||
"resources/skins.minerva.scripts/ctaDrawers.js",
|
||||
"resources/skins.minerva.scripts/menu.js",
|
||||
"resources/skins.minerva.scripts/preInit.js",
|
||||
"resources/skins.minerva.scripts/downloadPageAction.js",
|
||||
"resources/skins.minerva.scripts/page-issues/parser.js",
|
||||
"resources/skins.minerva.scripts/AB.js",
|
||||
"resources/skins.minerva.scripts/page-issues/overlay/IssueNotice.js",
|
||||
"resources/skins.minerva.scripts/page-issues/overlay/IssueList.js",
|
||||
"resources/skins.minerva.scripts/page-issues/overlay/pageIssuesOverlay.js",
|
||||
"resources/skins.minerva.scripts/page-issues/page/PageIssueLearnMoreLink.js",
|
||||
"resources/skins.minerva.scripts/page-issues/page/PageIssueLink.js",
|
||||
"resources/skins.minerva.scripts/page-issues/page/pageIssueFormatter.js",
|
||||
"resources/skins.minerva.scripts/page-issues/index.js",
|
||||
"resources/skins.minerva.scripts/UriUtil.js",
|
||||
"resources/skins.minerva.scripts/TitleUtil.js",
|
||||
"includes/Skins/ToggleList/ToggleList.js",
|
||||
"resources/skins.minerva.scripts/TabScroll.js",
|
||||
"resources/skins.minerva.scripts/Toolbar.js",
|
||||
"resources/skins.minerva.scripts/mobileRedirect.js",
|
||||
"resources/skins.minerva.scripts/search.js",
|
||||
"resources/skins.minerva.scripts/references.js",
|
||||
"resources/skins.minerva.scripts/watchstar.js"
|
||||
]
|
||||
},
|
||||
"skins.minerva.messageBox.styles": {
|
||||
|
@ -622,26 +620,39 @@
|
|||
}
|
||||
},
|
||||
"QUnitTestModule": {
|
||||
"localBasePath": "tests/qunit/skins.minerva.scripts",
|
||||
"remoteSkinPath": "MinervaNeue/tests/qunit/skins.minerva.scripts",
|
||||
"localBasePath": "",
|
||||
"remoteSkinPath": "MinervaNeue",
|
||||
"dependencies": [
|
||||
"mediawiki.cookie",
|
||||
"skins.minerva.messageBox.styles",
|
||||
"skins.minerva.scripts",
|
||||
"mobile.startup",
|
||||
"mediawiki.user",
|
||||
"mediawiki.experiments",
|
||||
"mediawiki.Uri"
|
||||
],
|
||||
"scripts": [
|
||||
"integration.test.js",
|
||||
"downloadPageAction.test.js",
|
||||
"page-issues/parser.test.js",
|
||||
"AB.test.js",
|
||||
"page-issues/index.test.js",
|
||||
"UriUtil.test.js",
|
||||
"TitleUtil.test.js",
|
||||
"watchstar.test.js"
|
||||
"packageFiles": [
|
||||
"tests/qunit/skins.minerva.scripts/index.js",
|
||||
"tests/qunit/skins.minerva.scripts/integration.test.js",
|
||||
"resources/skins.minerva.scripts/page-issues/parser.js",
|
||||
"resources/skins.minerva.scripts/downloadPageAction.js",
|
||||
"resources/skins.minerva.scripts/AB.js",
|
||||
"resources/skins.minerva.scripts/page-issues/overlay/IssueNotice.js",
|
||||
"resources/skins.minerva.scripts/page-issues/overlay/IssueList.js",
|
||||
"resources/skins.minerva.scripts/page-issues/overlay/pageIssuesOverlay.js",
|
||||
"resources/skins.minerva.scripts/page-issues/page/PageIssueLearnMoreLink.js",
|
||||
"resources/skins.minerva.scripts/page-issues/page/PageIssueLink.js",
|
||||
"resources/skins.minerva.scripts/page-issues/page/pageIssueFormatter.js",
|
||||
"resources/skins.minerva.scripts/page-issues/index.js",
|
||||
"resources/skins.minerva.scripts/UriUtil.js",
|
||||
"resources/skins.minerva.scripts/TitleUtil.js",
|
||||
"resources/skins.minerva.scripts/watchstar.js",
|
||||
"tests/qunit/skins.minerva.scripts/downloadPageAction.test.js",
|
||||
"tests/qunit/skins.minerva.scripts/page-issues/parser.test.js",
|
||||
"tests/qunit/skins.minerva.scripts/AB.test.js",
|
||||
"tests/qunit/skins.minerva.scripts/page-issues/index.test.js",
|
||||
"tests/qunit/skins.minerva.scripts/UriUtil.test.js",
|
||||
"tests/qunit/skins.minerva.scripts/TitleUtil.test.js",
|
||||
"tests/qunit/skins.minerva.scripts/watchstar.test.js"
|
||||
]
|
||||
},
|
||||
"ServiceWiringFiles": [
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
( function () {
|
||||
|
||||
const AB = require( 'skins.minerva.scripts/AB.js' );
|
||||
const AB = require( '../../../resources/skins.minerva.scripts/AB.js' );
|
||||
const defaultConfig = {
|
||||
testName: 'WME.MinervaABTest',
|
||||
samplingRate: 0.5,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
( function () {
|
||||
const TitleUtil = require( 'skins.minerva.scripts/TitleUtil.js' );
|
||||
const TitleUtil = require( '../../../resources/skins.minerva.scripts/TitleUtil.js' );
|
||||
const mwUriOrg = mw.Uri;
|
||||
|
||||
QUnit.module( 'Minerva TitleUtil', QUnit.newMwEnvironment( {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
( function () {
|
||||
const UriUtil = require( 'skins.minerva.scripts/UriUtil.js' );
|
||||
const UriUtil = require( '../../../resources/skins.minerva.scripts/UriUtil.js' );
|
||||
const mwUriOrg = mw.Uri;
|
||||
|
||||
QUnit.module( 'Minerva UriUtil', {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
const Deferred = $.Deferred;
|
||||
const windowChrome = { chrome: true };
|
||||
const windowNotChrome = {};
|
||||
const downloadAction = require( 'skins.minerva.scripts/downloadPageAction.js' );
|
||||
const downloadAction = require( '../../../resources/skins.minerva.scripts/downloadPageAction.js' );
|
||||
const onClick = downloadAction.test.onClick;
|
||||
const isAvailable = downloadAction.test.isAvailable;
|
||||
|
||||
|
|
14
tests/qunit/skins.minerva.scripts/index.js
Normal file
14
tests/qunit/skins.minerva.scripts/index.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Since tests.minerva.scripts does
|
||||
// not pull in the entire module skins.minerva.scripts
|
||||
// we have to stub certain templates to make it appear like its been loaded.
|
||||
mw.template.add( 'skins.minerva.scripts', 'IssueNotice.mustache', '' );
|
||||
module.exports = [
|
||||
require( './integration.test.js' ),
|
||||
require( './downloadPageAction.test.js' ),
|
||||
require( './page-issues/parser.test.js' ),
|
||||
require( './AB.test.js' ),
|
||||
require( './page-issues/index.test.js' ),
|
||||
require( './UriUtil.test.js' ),
|
||||
require( './TitleUtil.test.js' ),
|
||||
require( './watchstar.test.js' )
|
||||
];
|
|
@ -1,28 +1,31 @@
|
|||
QUnit.module( 'Minerva pageIssues', () => {
|
||||
const mobile = require( 'mobile.startup' );
|
||||
const pageIssues = require( 'skins.minerva.scripts/page-issues/index.js' );
|
||||
const insertBannersOrNotice = pageIssues.test.insertBannersOrNotice;
|
||||
const PageHTMLParser = mobile.PageHTMLParser;
|
||||
const overlayManager = mobile.getOverlayManager();
|
||||
const $mockContainer = $(
|
||||
'<div id="bodyContent">' +
|
||||
'<table class="ambox ambox-content">' +
|
||||
'<tbody class="mbox-text">' +
|
||||
'<tr><td><span class="mbox-text-span"> ambox text span </span></td></tr>' +
|
||||
'</tbody>' +
|
||||
'</table>' +
|
||||
'</div>'
|
||||
);
|
||||
const labelText = 'label text';
|
||||
const inline = true;
|
||||
const SECTION = '0';
|
||||
const processedAmbox = insertBannersOrNotice(
|
||||
new PageHTMLParser( $mockContainer ),
|
||||
labelText, SECTION, inline, overlayManager
|
||||
).ambox;
|
||||
( function () {
|
||||
const
|
||||
mobile = require( 'mobile.startup' ),
|
||||
pageIssues = require( '../../../../resources/skins.minerva.scripts/page-issues/index.js' ),
|
||||
insertBannersOrNotice = pageIssues.test.insertBannersOrNotice,
|
||||
PageHTMLParser = mobile.PageHTMLParser,
|
||||
overlayManager = mobile.getOverlayManager(),
|
||||
$mockContainer = $(
|
||||
'<div id=\'bodyContent\'>' +
|
||||
'<table class=\'ambox ambox-content\'>' +
|
||||
'<tbody class=\'mbox-text\'>' +
|
||||
'<tr><td><span class=\'mbox-text-span\'> ambox text span </span></td></tr>' +
|
||||
'</tbody>' +
|
||||
'</table>' +
|
||||
'</div>'
|
||||
),
|
||||
labelText = 'label text',
|
||||
inline = true,
|
||||
SECTION = '0',
|
||||
processedAmbox = insertBannersOrNotice(
|
||||
new PageHTMLParser( $mockContainer ),
|
||||
labelText, SECTION, inline, overlayManager
|
||||
).ambox;
|
||||
|
||||
QUnit.module( 'Minerva pageIssues' );
|
||||
|
||||
QUnit.test( 'insertBannersOrNotice() should add a "learn more" message', ( assert ) => {
|
||||
assert.true( /(skin-minerva-issue-learn-more)/.test( processedAmbox.html() ) );
|
||||
assert.true( /⧼skin-minerva-issue-learn-more⧽/.test( processedAmbox.html() ) );
|
||||
} );
|
||||
|
||||
QUnit.test( 'insertBannersOrNotice() should add an icon', ( assert ) => {
|
||||
|
@ -32,4 +35,4 @@ QUnit.module( 'Minerva pageIssues', () => {
|
|||
processedAmbox.click();
|
||||
assert.strictEqual( window.location.hash, '#/issues/' + SECTION );
|
||||
} );
|
||||
} );
|
||||
}() );
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
( function () {
|
||||
const iconElement = document.createElement( 'div' ),
|
||||
pageIssuesParser = require( 'skins.minerva.scripts/page-issues/parser.js' ),
|
||||
pageIssuesParser = require( '../../../../resources/skins.minerva.scripts/page-issues/parser.js' ),
|
||||
extractMessage = pageIssuesParser.extract;
|
||||
|
||||
iconElement.classList.add( 'minerva-icon--issue-generic-defaultColor', 'minerva-ambox-icon' );
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* eslint-disable no-jquery/no-class-state */
|
||||
( function () {
|
||||
const watchstar = require( 'skins.minerva.scripts/watchstar.js' );
|
||||
const watchstar = require( '../../../resources/skins.minerva.scripts/watchstar.js' );
|
||||
const toggleClasses = watchstar.test.toggleClasses;
|
||||
const WATCHED_CLASS = watchstar.test.WATCHED_ICON_CLASS;
|
||||
const TEMP_WATCHED_CLASS = watchstar.test.TEMP_WATCHED_ICON_CLASS;
|
||||
|
|
Loading…
Reference in a new issue