30 parent::__construct(
'JavaScriptTest' );
37 $out->disallowUserJs();
42 $out->allowClickjacking();
45 if ( $par ===
'qunit/export' ) {
52 if ( $par ===
null || $par ===
'' || $par ===
'qunit' || $par ===
'qunit/plain' ) {
58 $out->setStatusCode( 404 );
59 $out->setPageTitle( $this->
msg(
'javascripttest' ) );
62 . $this->
msg(
'javascripttest-pagetext-unknownaction' )
63 ->plaintextParams( $par )->parseAsBlock()
74 $summary = $this->
msg(
'javascripttest-qunit-intro' )
75 ->params(
'https://www.mediawiki.org/wiki/Manual:JavaScript_unit_testing' )
77 return "<div id=\"mw-javascripttest-summary\">$summary</div>";
94 $rl =
$out->getResourceLoader();
98 'skin' => $this->
getSkin()->getSkinName(),
103 $query[
'only'] =
'scripts';
108 $modules = $rl->getTestModuleNames(
'qunit' );
113 $qunitConfig =
'QUnit.config.autostart = false;'
114 .
'if (window.__karma__) {'
118 .
'window.__karma__.loaded = function () {};'
122 $startup = $rl->makeModuleResponse( $startupContext, [
123 'startup' => $rl->getModule(
'startup' ),
130 $code .= $rl->makeModuleResponse( $embedContext, [
131 'user.options' => $rl->getModule(
'user.options' ),
132 'user.tokens' => $rl->getModule(
'user.tokens' ),
140 var start = window.__karma__ ? window.__karma__.start : QUnit.start;
143 .always(
function () {
146 .fail(
function (
e ) {
147 setTimeout(
function () {
158 header(
'Content-Type: text/javascript; charset=utf-8' );
159 header(
'Cache-Control: private, no-cache, must-revalidate' );
160 header(
'Pragma: no-cache' );
171 $styles =
$out->makeResourceLoaderLink(
'jquery.qunit',
178 $scripts =
$out->makeResourceLoaderLink(
'jquery.qunit',
180 [
'raw' =>
true,
'sync' =>
true ]
183 $head = implode(
"\n", [ $styles, $scripts ] );
193 $url = $this->
getPageTitle(
'qunit/export' )->getFullURL( [
196 $html .=
"\n" . Html::linkedScript( $url );
198 header(
'Content-Type: text/html; charset=utf-8' );
WebRequest clone which takes values from a provided array.
Object passed around to modules which contains information about the state of a specific loader reque...
static makeLoaderConditionalScript( $script)
Wraps JavaScript code to run after startup and base modules.
static inDebugMode()
Determine whether debug mode was requested Order of priority is 1) request param, 2) cookie,...
static makeConfigSetScript(array $configuration)
Returns JS code which will set the MediaWiki configuration array to the given value.
exportQUnit()
Generate self-sufficient JavaScript payload to run the tests elsewhere.
execute( $par)
Default execute method Checks user permissions.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getSummaryHtml()
Get summary text wrapped in a container.
Parent class for all special pages.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getSkin()
Shortcut to get the skin being used for this instance.
msg( $key)
Wrapper around wfMessage that sets the current context.
getPageTitle( $subpage=false)
Get a self-referential title object.
getLanguage()
Shortcut to get user's language.
in this case you re responsible for computing and outputting the entire conflict i e
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query