wiki.techinc.nl/tests/qunit/QUnitTestResources.php

144 lines
5.8 KiB
PHP
Raw Normal View History

<?php
/* Modules registered when $wgEnableJavaScriptTest is true */
return [
/* Utilities */
'test.sinonjs' => [
'scripts' => [
'resources/lib/sinonjs/sinon-1.15.4.js',
// We want tests to work in IE, but can't include this as it
// will break the placeholders in Sinon because the hack it uses
// to hijack IE globals relies on running in the global scope
// and in ResourceLoader this won't be running in the global scope.
// Including it results (among other things) in sandboxed timers
// being broken due to Date inheritance being undefined.
// 'resources/lib/sinonjs/sinon-ie-1.15.4.js',
],
'targets' => [ 'desktop', 'mobile' ],
],
'test.mediawiki.qunit.testrunner' => [
'scripts' => [
'tests/qunit/data/testrunner.js',
],
'dependencies' => [
SpecialJavaScriptTest: Add export feature Add an 'export' subpage to SpecialJavaScriptTest which allows one to request a self-sufficient JavaScript payload that will bootstrap a ResourceLoader client and load the test suites. This is needed for using Karma (which only loads JavaScript, no full html pages). As such elements from the Skin and OutputPage will not exist. While all QUnit tests in MediaWiki core and most extensions I've seen already use #qunit-fixture, this is now required. This to prevent leakage of elements from one test to another, but it also prevents tests from depending on elements provided by the server. While the Karma setup is still in the pipeline (might land before this commit loses WIP status), for now this can be tested via the 'Special:JavaScriptTest/qunit/plain' subpage. Refactor: * Use HTTP status code 404 in the response for "noframework". * Simplify HTML footprint by using <div id="qunit"> instead of hardcoding the full structure. This feature was added to QUnit since v1.3.0 (Feb 2012), we're using v1.14.0 (Jan 2014). QUnit's header is automatically derived from document.title. * Remove redundant addModules() for 'test.mediawiki.qunit.testrunner'. This is already added by default. * Move allowClickjacking() call so that it applies to other modes as well. The exported javascript needs to have wgBreakFrame set to false so that test runners can frame it. * Change mediawiki.special.javaScriptTest to not depend on QUnit. It caused QUnit to load on error pages. And in theory the page is suited for other frameworks and shouldn't load QUnit this way. Bug: T74063 Change-Id: I3d4d0df43bb426d9579eb0349b8b5477281a7cfc
2014-12-02 21:48:21 +00:00
// Test runner configures QUnit but can't have it as dependency,
// see SpecialJavaScriptTest::viewQUnit.
'jquery.getAttrs',
'mediawiki.page.ready',
'mediawiki.page.startup',
'test.sinonjs',
'dom-level2-shim',
],
'position' => 'top',
'targets' => [ 'desktop', 'mobile' ],
],
/*
Test suites for MediaWiki core modules
These must have a dependency on test.mediawiki.qunit.testrunner!
*/
'test.mediawiki.qunit.suites' => [
'scripts' => [
'tests/qunit/suites/resources/startup.test.js',
'tests/qunit/suites/resources/jquery/jquery.accessKeyLabel.test.js',
'tests/qunit/suites/resources/jquery/jquery.autoEllipsis.test.js',
'tests/qunit/suites/resources/jquery/jquery.byteLength.test.js',
'tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js',
'tests/qunit/suites/resources/jquery/jquery.color.test.js',
'tests/qunit/suites/resources/jquery/jquery.colorUtil.test.js',
'tests/qunit/suites/resources/jquery/jquery.getAttrs.test.js',
Initial stab at responsive images for screen densities. * adds $wgResponsiveImages setting, defaulting to true, to enable the feature * adds 'srcset' attribute with 1.5x and 2x URLs to image links and image thumbs * adds jquery.hidpi plugin to check pixel density and implement partial 'srcset' polyfill ** $.devicePixelRatio() returns window.devicePixelRatio, with compat fallback for IE 10 ** $().hidpi() performs a 'srcset' polyfill for browsers with no native 'srcset' support * adds mediawiki.hidpi RL script to trigger hidpi loads after main images load Note that this is a work in progress. There will be places where this doesn't yet work which output their imgs differently. If moving from a low to high-DPI screen on a MacBook Pro Retina display, you won't see images load until you reload. Confirmed basic images and thumbs in wikitext appear to work in Safari 6, Chrome 21, Firefox 18 nightly on MacBook Pro Retina display, and IE 10 in Windows 8 at 150% zoom, 200% zoom, and 140% and 180%-ratio Metro tablet sizes. Internally this is still a bit of a hack; Linker::makeImageLink and Linker::makeThumbLink explicitly ask for 1.5x and 2x scaled versions and insert their URLs, if different, into the original thumbnail object which (in default handler) outputs the srcset. This means that a number of places that handle images differently won't see the higher-resolution versions, such as <gallery> and the large thumbnail on the File: description page. At some point we may wish to redo some of how the MediaHandler stuff works so that requesting a single thumbnail automatically produces the extra sizes in all circumstances. We might also consider outputting a 'srcset' or multiple src sizes in 'imageinfo' API requests, which would make ApiForeignRepo/InstantCommons more efficient. (Currently it has to make three requests for each image to get the three sizes.) Change-Id: Id80ebd07a1a9f401a2c2bfeb21aae987e5aa863b
2012-09-18 07:18:50 +00:00
'tests/qunit/suites/resources/jquery/jquery.hidpi.test.js',
'tests/qunit/suites/resources/jquery/jquery.highlightText.test.js',
'tests/qunit/suites/resources/jquery/jquery.localize.test.js',
'tests/qunit/suites/resources/jquery/jquery.makeCollapsible.test.js',
'tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js',
'tests/qunit/suites/resources/jquery/jquery.placeholder.test.js',
'tests/qunit/suites/resources/jquery/jquery.tabIndex.test.js',
'tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js',
'tests/qunit/suites/resources/jquery/jquery.tablesorter.parsers.test.js',
'tests/qunit/suites/resources/jquery/jquery.textSelection.test.js',
'tests/qunit/data/mediawiki.jqueryMsg.data.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.requestIdleCallback.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.errorLogger.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.jscompat.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.messagePoster.factory.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.RegExp.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.storage.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.template.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.template.mustache.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.html.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.Title.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.toc.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.track.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.Uri.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.user.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.viewport.test.js',
'tests/qunit/suites/resources/mediawiki.api/mediawiki.api.test.js',
'tests/qunit/suites/resources/mediawiki.api/mediawiki.api.category.test.js',
'tests/qunit/suites/resources/mediawiki.api/mediawiki.api.messages.test.js',
'tests/qunit/suites/resources/mediawiki.api/mediawiki.api.options.test.js',
'tests/qunit/suites/resources/mediawiki.api/mediawiki.api.parse.test.js',
'tests/qunit/suites/resources/mediawiki.api/mediawiki.api.upload.test.js',
'tests/qunit/suites/resources/mediawiki.api/mediawiki.api.watch.test.js',
'tests/qunit/suites/resources/mediawiki.api/mediawiki.ForeignApi.test.js',
'tests/qunit/suites/resources/mediawiki.special/mediawiki.special.recentchanges.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.language.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.cldr.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.cookie.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.experiments.test.js',
],
'dependencies' => [
'jquery.accessKeyLabel',
'jquery.autoEllipsis',
'jquery.byteLength',
'jquery.byteLimit',
'jquery.color',
'jquery.colorUtil',
'jquery.getAttrs',
Initial stab at responsive images for screen densities. * adds $wgResponsiveImages setting, defaulting to true, to enable the feature * adds 'srcset' attribute with 1.5x and 2x URLs to image links and image thumbs * adds jquery.hidpi plugin to check pixel density and implement partial 'srcset' polyfill ** $.devicePixelRatio() returns window.devicePixelRatio, with compat fallback for IE 10 ** $().hidpi() performs a 'srcset' polyfill for browsers with no native 'srcset' support * adds mediawiki.hidpi RL script to trigger hidpi loads after main images load Note that this is a work in progress. There will be places where this doesn't yet work which output their imgs differently. If moving from a low to high-DPI screen on a MacBook Pro Retina display, you won't see images load until you reload. Confirmed basic images and thumbs in wikitext appear to work in Safari 6, Chrome 21, Firefox 18 nightly on MacBook Pro Retina display, and IE 10 in Windows 8 at 150% zoom, 200% zoom, and 140% and 180%-ratio Metro tablet sizes. Internally this is still a bit of a hack; Linker::makeImageLink and Linker::makeThumbLink explicitly ask for 1.5x and 2x scaled versions and insert their URLs, if different, into the original thumbnail object which (in default handler) outputs the srcset. This means that a number of places that handle images differently won't see the higher-resolution versions, such as <gallery> and the large thumbnail on the File: description page. At some point we may wish to redo some of how the MediaHandler stuff works so that requesting a single thumbnail automatically produces the extra sizes in all circumstances. We might also consider outputting a 'srcset' or multiple src sizes in 'imageinfo' API requests, which would make ApiForeignRepo/InstantCommons more efficient. (Currently it has to make three requests for each image to get the three sizes.) Change-Id: Id80ebd07a1a9f401a2c2bfeb21aae987e5aa863b
2012-09-18 07:18:50 +00:00
'jquery.hidpi',
'jquery.highlightText',
'jquery.localize',
'jquery.makeCollapsible',
'jquery.mwExtension',
'jquery.placeholder',
'jquery.tabIndex',
'jquery.tablesorter',
'jquery.textSelection',
'mediawiki.api',
'mediawiki.api.category',
'mediawiki.api.messages',
'mediawiki.api.options',
'mediawiki.api.parse',
'mediawiki.api.upload',
'mediawiki.api.watch',
'mediawiki.ForeignApi.core',
'mediawiki.jqueryMsg',
'mediawiki.messagePoster',
'mediawiki.RegExp',
'mediawiki.storage',
'mediawiki.Title',
'mediawiki.toc',
'mediawiki.Uri',
'mediawiki.user',
'mediawiki.template.mustache',
'mediawiki.template',
'mediawiki.util',
'mediawiki.viewport',
'mediawiki.special.recentchanges',
'mediawiki.language',
'mediawiki.cldr',
'mediawiki.cookie',
'mediawiki.experiments',
'test.mediawiki.qunit.testrunner',
],
]
];