From: Timo Tijhof Date: Tue, 2 Dec 2014 21:48:21 +0000 (+0000) Subject: SpecialJavaScriptTest: Add export feature X-Git-Tag: 1.31.0-rc.0~12797 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=ba50b32556fa1f2983c80cc6c06b5908f46f7cf4;p=lhc%2Fweb%2Fwiklou.git 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
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 --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 07fa94bfa5..f8d5ab7e41 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2729,7 +2729,7 @@ class OutputPage extends ContextSource { * call rather than a "