mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Tests: Add support for running unit tests via grunt with karma
- Update QUnit to 1.23.1 - Remove unused dl#dl from test/index.html - Remove unused map#imgmap from test/index.html - Ensure all urls to data use baseURI - Add the 'grunt karma:main' task - customContextFile & customDebugFile - Add 'npm run jenkins' script Close gh-3744 Fixes gh-1999
This commit is contained in:
committed by
Timmy Willison
parent
e84d3bc02e
commit
ecd8ddea33
@@ -1,5 +0,0 @@
|
||||
<?php
|
||||
$type = $_REQUEST['content-type'];
|
||||
header("Content-type: $type");
|
||||
echo $_REQUEST['response']
|
||||
?>
|
||||
@@ -1 +0,0 @@
|
||||
ok( "<?php echo $_SERVER['REQUEST_METHOD'] ?>" === "GET", "request method is <?php echo $_SERVER['REQUEST_METHOD'] ?>" );
|
||||
@@ -1 +0,0 @@
|
||||
<?php echo $_SERVER['REQUEST_METHOD'] ?>
|
||||
@@ -15,7 +15,7 @@ jQuery(function() {
|
||||
}, 200 );
|
||||
var number = 50;
|
||||
while( number-- ) {
|
||||
jQuery.ajax("../name.php?wait=10");
|
||||
jQuery.ajax("../mock.php?action=wait&wait=10");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<?php header("Content-type: atom+xml") ?>
|
||||
<root>
|
||||
<element />
|
||||
</root>
|
||||
@@ -1,3 +0,0 @@
|
||||
<?php
|
||||
sleep(30);
|
||||
?>
|
||||
@@ -7,7 +7,7 @@
|
||||
<script src="../iframeTest.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<iframe id="dont_return" src="dont_return.php"></iframe>
|
||||
<iframe id="dont_return" src="../mock.php?action=wait&wait=30"></iframe>
|
||||
<script>
|
||||
var timeoutId, $,
|
||||
timeoutFired = false;
|
||||
|
||||
14
test/data/csp.include.html
Normal file
14
test/data/csp.include.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>CSP Test Page</title>
|
||||
<script src="../jquery.js"></script>
|
||||
<script src="iframeTest.js"></script>
|
||||
<script src="support/csp.js"></script>
|
||||
<script src="support/getComputedSupport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<p>CSP Test Page</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
<?php echo file_get_contents('php://input'); ?>
|
||||
@@ -1 +0,0 @@
|
||||
<?php echo $_SERVER['QUERY_STRING']; ?>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?php
|
||||
|
||||
header("HTTP/1.0 400 Bad Request");
|
||||
header("Content-Type: application/json");
|
||||
|
||||
echo '{ "code": 40, "message": "Bad Request" }';
|
||||
@@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
header("HTTP/1.0 400 Bad Request");
|
||||
|
||||
echo "plain text message";
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
error_reporting(0);
|
||||
|
||||
$ts = $_REQUEST['ts'];
|
||||
$etag = md5($ts);
|
||||
|
||||
$ifNoneMatch = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : "";
|
||||
preg_match('/"([^"]+)"/', $ifNoneMatch, $matches);
|
||||
$ifNoneMatch = isset($matches[1]) ? $matches[1] : false;
|
||||
|
||||
if ($ifNoneMatch == $etag) {
|
||||
header('HTTP/1.0 304 Not Modified');
|
||||
die; // stop processing
|
||||
}
|
||||
|
||||
header("Etag: W/\"" . $etag . "\"");
|
||||
|
||||
if ( $ifNoneMatch ) {
|
||||
echo "OK: " . $etag;
|
||||
} else {
|
||||
echo "FAIL";
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -18,7 +18,7 @@ jQuery( function () {
|
||||
oldIE into thinking the dom is ready, but it's not...
|
||||
leaving this check here for future trailblazers to attempt
|
||||
fixing this...-->
|
||||
<script type="text/javascript" src="../longLoadScript.php?sleep=1"></script>
|
||||
<script type="text/javascript" src="../mock.php?action=wait&wait=1"></script>
|
||||
<div id="container" style="height: 300px"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -18,7 +18,7 @@ jQuery( document ).ready(function () {
|
||||
oldIE into thinking the dom is ready, but it's not...
|
||||
leaving this check here for future trailblazers to attempt
|
||||
fixing this...-->
|
||||
<script type="text/javascript" src="../longLoadScript.php?sleep=1"></script>
|
||||
<script type="text/javascript" src="../mock.php?action=wait&wait=1"></script>
|
||||
<div id="container" style="height: 300px"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
header( "Sample-Header: Hello World" );
|
||||
header( "Empty-Header: " );
|
||||
header( "Sample-Header2: Hello World 2" );
|
||||
|
||||
$headers = array();
|
||||
|
||||
foreach( $_SERVER as $key => $value ) {
|
||||
|
||||
$key = str_replace( "_" , "-" , substr( $key , 0 , 5 ) == "HTTP_" ? substr( $key , 5 ) : $key );
|
||||
$headers[ $key ] = $value;
|
||||
|
||||
}
|
||||
|
||||
foreach( explode( "_" , $_GET[ "keys" ] ) as $key ) {
|
||||
|
||||
// Only echo if key exists in the header
|
||||
if ( isset( $headers[ strtoupper( $key ) ] ) ) {
|
||||
echo "$key: " . @$headers[ strtoupper( $key ) ] . "\n";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
error_reporting(0);
|
||||
|
||||
$ts = $_REQUEST['ts'];
|
||||
|
||||
$ifModifiedSince = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE']) : false;
|
||||
if ($ifModifiedSince == $ts) {
|
||||
header('HTTP/1.0 304 Not Modified');
|
||||
die; // stop processing
|
||||
}
|
||||
|
||||
header("Last-Modified: " . $ts);
|
||||
|
||||
if ( $ifModifiedSince ) {
|
||||
echo "OK: " . $ts;
|
||||
} else {
|
||||
echo "FAIL";
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
error_reporting(0);
|
||||
if ( $_REQUEST['header'] ) {
|
||||
header("Content-type: application/json");
|
||||
}
|
||||
|
||||
$json = $_REQUEST['json'];
|
||||
if($json) {
|
||||
echo '[ {"name": "John", "age": 21}, {"name": "Peter", "age": 25 } ]';
|
||||
} else {
|
||||
echo '{ "data": {"lang": "en", "length": 25} }';
|
||||
}
|
||||
?>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
error_reporting(0);
|
||||
$callback = $_REQUEST['callback'];
|
||||
if ( ! $callback ) {
|
||||
$callback = explode("?",end(explode("/",$_SERVER['REQUEST_URI'])));
|
||||
$callback = $callback[0];
|
||||
}
|
||||
$json = $_REQUEST['json'];
|
||||
if($json) {
|
||||
echo $callback . '([ {"name": "John", "age": 21}, {"name": "Peter", "age": 25 } ])';
|
||||
} else {
|
||||
echo $callback . '({ "data": {"lang": "en", "length": 25} })';
|
||||
}
|
||||
?>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?php
|
||||
sleep((int)$_GET['sleep']);
|
||||
header('Content-type: text/javascript');
|
||||
?>
|
||||
244
test/data/mock.php
Normal file
244
test/data/mock.php
Normal file
@@ -0,0 +1,244 @@
|
||||
<?php
|
||||
/**
|
||||
* Keep in sync with /test/middleware-mockserver.js
|
||||
*/
|
||||
class MockServer {
|
||||
protected function contentType( $req ) {
|
||||
$type = $req->query['contentType'];
|
||||
header("Content-type: $type");
|
||||
echo $req->query['response'];
|
||||
}
|
||||
|
||||
protected function wait( $req ) {
|
||||
$wait = (int) $req->query['wait'];
|
||||
sleep( $wait );
|
||||
if ( isset( $req->query['script'] ) ) {
|
||||
header( 'Content-type: text/javascript' );
|
||||
} else {
|
||||
header( 'Content-type: text/html' );
|
||||
echo 'ERROR <script>ok( true, "mock executed" );</script>';
|
||||
}
|
||||
}
|
||||
|
||||
protected function name( $req ) {
|
||||
if ( $req->query['name'] === 'foo' ) {
|
||||
echo 'bar';
|
||||
} elseif ( $_POST['name'] === 'peter' ) {
|
||||
echo 'pan';
|
||||
} else {
|
||||
echo 'ERROR';
|
||||
}
|
||||
}
|
||||
|
||||
protected function xml( $req ) {
|
||||
header( 'Content-type: text/xml' );
|
||||
if ( $req->query['cal'] !== '5-2' && $_POST['cal'] !== '5-2' ) {
|
||||
echo '<error>ERROR</error>';
|
||||
return;
|
||||
}
|
||||
echo "<math><calculation>5-2</calculation><result>3</result></math>\n";
|
||||
}
|
||||
|
||||
protected function atom( $req ) {
|
||||
header( 'Content-type: atom+xml' );
|
||||
echo '<root><element /></root>';
|
||||
}
|
||||
|
||||
protected function script( $req ) {
|
||||
if ( isset( $req->query['header'] ) ) {
|
||||
if ( $req->query['header'] === 'ecma' ) {
|
||||
header( 'Content-type: application/ecmascript' );
|
||||
} else {
|
||||
header( 'Content-type: text/javascript' );
|
||||
}
|
||||
} else {
|
||||
header( 'Content-type: text/html' );
|
||||
}
|
||||
echo 'ok( true, "mock executed" );';
|
||||
}
|
||||
|
||||
// Used to be in test.js, but was renamed to testbar.php
|
||||
// https://github.com/jquery/jquery/commit/d89c278a33#commitcomment-23423165
|
||||
protected function testbar( $req ) {
|
||||
echo 'this.testBar = "bar";
|
||||
jQuery("#ap").html("bar");
|
||||
ok( true, "mock executed");';
|
||||
}
|
||||
|
||||
protected function json( $req ) {
|
||||
if ( isset( $req->query['header'] ) ) {
|
||||
header( 'Content-type: application/json' );
|
||||
}
|
||||
|
||||
if ( isset( $req->query['array'] ) ) {
|
||||
echo '[ {"name": "John", "age": 21}, {"name": "Peter", "age": 25 } ]';
|
||||
} else {
|
||||
echo '{ "data": {"lang": "en", "length": 25} }';
|
||||
}
|
||||
}
|
||||
|
||||
protected function jsonp( $req ) {
|
||||
if ( isset( $req->query['callback'] ) ) {
|
||||
$callback = $req->query['callback'];
|
||||
} elseif ( $req->method === 'GET' ) {
|
||||
// Try REST-like path
|
||||
preg_match( '/\/([^\/?]+)\?.+$/', $req->url, $m );
|
||||
$callback = $m[1];
|
||||
} else {
|
||||
$callback = $_POST['callback'];
|
||||
}
|
||||
if ( isset( $req->query['array'] ) ) {
|
||||
echo $callback . '([ {"name": "John", "age": 21}, {"name": "Peter", "age": 25 } ])';
|
||||
} else {
|
||||
echo $callback . '({ "data": {"lang": "en", "length": 25} })';
|
||||
}
|
||||
}
|
||||
|
||||
protected function xmlOverJsonp( $req ) {
|
||||
$callback = $_REQUEST['callback'];
|
||||
$text = json_encode( file_get_contents( __DIR__ . '/with_fries.xml' ) );
|
||||
echo "$callback($text)\n";
|
||||
}
|
||||
|
||||
protected function error( $req ) {
|
||||
header( 'HTTP/1.0 400 Bad Request' );
|
||||
if ( isset( $req->query['json'] ) ) {
|
||||
header( 'Content-Type: application/json' );
|
||||
echo '{ "code": 40, "message": "Bad Request" }';
|
||||
} else {
|
||||
echo 'plain text message';
|
||||
}
|
||||
}
|
||||
|
||||
protected function headers( $req ) {
|
||||
header( 'Sample-Header: Hello World' );
|
||||
header( 'Empty-Header: ' );
|
||||
header( 'Sample-Header2: Hello World 2' );
|
||||
|
||||
foreach ( explode( '|' , $req->query[ 'keys' ] ) as $key ) {
|
||||
// Only echo if key exists in the header
|
||||
if ( isset( $req->headers[ strtoupper( $key ) ] ) ) {
|
||||
echo "$key: " . $req->headers[ strtoupper( $key ) ] . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function echoData( $req ) {
|
||||
echo file_get_contents('php://input');
|
||||
}
|
||||
|
||||
protected function echoQuery( $req ) {
|
||||
echo $_SERVER['QUERY_STRING'];
|
||||
}
|
||||
|
||||
protected function echoMethod( $req ) {
|
||||
echo $req->method;
|
||||
}
|
||||
|
||||
protected function echoHtml( $req ) {
|
||||
header( 'Content-type: text/html' );
|
||||
echo '<div id="method">' . $req->method . '</div>';
|
||||
echo '<div id="query">' . $_SERVER['QUERY_STRING'] . '</div>';
|
||||
echo '<div id="data">' . file_get_contents('php://input') . '</div>';
|
||||
}
|
||||
|
||||
protected function etag( $req ) {
|
||||
$hash = md5( $req->query['ts'] );
|
||||
$etag = 'W/"' . $hash . '"';
|
||||
|
||||
$ifNoneMatch = isset( $req->headers['IF-NONE-MATCH'] ) ? $req->headers['IF-NONE-MATCH'] : '';
|
||||
if ($ifNoneMatch === $etag) {
|
||||
header('HTTP/1.0 304 Not Modified');
|
||||
return;
|
||||
}
|
||||
|
||||
header("Etag: $etag");
|
||||
echo "ETag: $etag\n";
|
||||
if ( $ifNoneMatch ) {
|
||||
echo "If-None-Match: $ifNoneMatch\n";
|
||||
}
|
||||
}
|
||||
|
||||
protected function ims( $req ) {
|
||||
$ts = $req->query['ts'];
|
||||
|
||||
$ims = isset( $req->headers['IF-MODIFIED-SINCE'] ) ? $req->headers['IF-MODIFIED-SINCE'] : '';
|
||||
if ($ims === $ts) {
|
||||
header('HTTP/1.0 304 Not Modified');
|
||||
return;
|
||||
}
|
||||
|
||||
header("Last-Modified: $ts");
|
||||
echo "Last-Modified: $ts\n";
|
||||
if ( $ims ) {
|
||||
echo "If-Modified-Since: $ims\n";
|
||||
}
|
||||
}
|
||||
|
||||
protected function status( $req ) {
|
||||
header( "HTTP/1.0 {$req->query['code']} {$req->query['text']}" );
|
||||
}
|
||||
|
||||
protected function testHTML( $req ) {
|
||||
header( 'Content-type: text/html' );
|
||||
$html = file_get_contents( __DIR__ . '/test.include.html' );
|
||||
$html = str_replace( '{{baseURL}}', $req->query['baseURL'], $html );
|
||||
echo $html;
|
||||
}
|
||||
|
||||
protected function cspFrame( $req ) {
|
||||
// This is CSP only for browsers with "Content-Security-Policy" header support
|
||||
// i.e. no old WebKit or old Firefox
|
||||
header( "Content-Security-Policy: default-src 'self'; report-uri ./mock.php?action=cspLog" );
|
||||
header( 'Content-type: text/html' );
|
||||
echo file_get_contents( __DIR__ . '/csp.include.html' );
|
||||
}
|
||||
|
||||
protected function cspLog( $req ) {
|
||||
file_put_contents( $this->cspFile, 'error' );
|
||||
}
|
||||
|
||||
protected function cspClean( $req ) {
|
||||
file_put_contents( $this->cspFile, '' );
|
||||
unlink( $this->cspFile );
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
$this->cspFile = __DIR__ . '/support/csp.log';
|
||||
}
|
||||
|
||||
public function respond( stdClass $req ) {
|
||||
if ( !isset( $req->query['action'] ) || !method_exists( $this, $req->query['action'] ) ) {
|
||||
header( "HTTP/1.0 400 Bad Request" );
|
||||
echo "Invalid action query.\n";
|
||||
return;
|
||||
}
|
||||
$this->{$req->query['action']}( $req );
|
||||
}
|
||||
}
|
||||
|
||||
// Don't include PHP errors in http response
|
||||
error_reporting( 0 );
|
||||
|
||||
// Collect headers
|
||||
$headers = array();
|
||||
foreach ( $_SERVER as $name => $value ) {
|
||||
if ( substr( $name, 0, 5 ) === 'HTTP_' ) {
|
||||
$name = str_replace( '_', '-', substr( $name, 5 ) );
|
||||
$headers[$name] = $value;
|
||||
} elseif ( $name === 'CONTENT_LENGTH' ) {
|
||||
$headers['CONTENT-LENGTH'] = $value;
|
||||
} elseif ( $name === 'CONTENT_TYPE' ) {
|
||||
$headers['CONTENT-TYPE'] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$mock = new MockServer();
|
||||
$req = (object) array(
|
||||
'query' => $_GET,
|
||||
'headers' => $headers,
|
||||
'method' => $_SERVER['REQUEST_METHOD'],
|
||||
'url' => $_SERVER['REQUEST_URI'],
|
||||
);
|
||||
$mock->respond( $req );
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
error_reporting(0);
|
||||
$wait = $_REQUEST['wait'];
|
||||
if($wait) {
|
||||
sleep($wait);
|
||||
}
|
||||
$xml = $_REQUEST['xml'];
|
||||
if($xml) {
|
||||
header("Content-type: text/xml");
|
||||
$result = ($xml == "5-2") ? "3" : "?";
|
||||
echo "<math><calculation>$xml</calculation><result>$result</result></math>";
|
||||
die();
|
||||
}
|
||||
$name = $_REQUEST['name'];
|
||||
if($name == 'foo') {
|
||||
echo "bar";
|
||||
die();
|
||||
} else if($name == 'peter') {
|
||||
echo "pan";
|
||||
die();
|
||||
}
|
||||
|
||||
echo 'ERROR <script type="text/javascript">ok( true, "name.php executed" );</script>';
|
||||
?>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
header('HTTP/1.0 204 No Content');
|
||||
|
||||
?>
|
||||
@@ -1,12 +0,0 @@
|
||||
<div id="post">
|
||||
<?php
|
||||
foreach( $_POST as $key=>$value )
|
||||
echo "<b id='$key'>$value</b>";
|
||||
?>
|
||||
</div>
|
||||
<div id="get">
|
||||
<?php
|
||||
foreach( $_GET as $key=>$value )
|
||||
echo "<b id='$key'>$value</b>";
|
||||
?>
|
||||
</div>
|
||||
237
test/data/qunit-fixture.html
Normal file
237
test/data/qunit-fixture.html
Normal file
@@ -0,0 +1,237 @@
|
||||
<p id="firstp">See <a id="simon1" href="http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector" rel="bookmark">this blog entry</a> for more information.</p>
|
||||
<p id="ap">
|
||||
Here are some links in a normal paragraph: <a id="google" href="http://www.google.com/" title="Google!">Google</a>,
|
||||
<a id="groups" href="http://groups.google.com/" class="GROUPS">Google Groups (Link)</a>.
|
||||
This link has <code><a href="http://smin" id="anchor1">class="blog"</a></code>:
|
||||
<a href="http://diveintomark.org/" class="blog" hreflang="en" id="mark">diveintomark</a>
|
||||
|
||||
</p>
|
||||
<div id="foo">
|
||||
<p id="sndp">Everything inside the red border is inside a div with <code>id="foo"</code>.</p>
|
||||
<p lang="en" id="en">This is a normal link: <a id="yahoo" href="http://www.yahoo.com/" class="blogTest">Yahoo</a></p>
|
||||
<p id="sap">This link has <code><a href="#2" id="anchor2">class="blog"</a></code>: <a href="http://simon.incutio.com/" class="blog link" id="simon">Simon Willison's Weblog</a></p>
|
||||
|
||||
</div>
|
||||
<div id="nothiddendiv" style="height:1px;background:white;" class="nothiddendiv">
|
||||
<div id="nothiddendivchild"></div>
|
||||
</div>
|
||||
<span id="name+value"></span>
|
||||
<p id="first">Try them out:</p>
|
||||
<ul id="firstUL"></ul>
|
||||
<ol id="empty"></ol>
|
||||
<form id="form" action="formaction">
|
||||
<label for="action" id="label-for">Action:</label>
|
||||
<input type="text" name="action" value="Test" id="text1" maxlength="30"/>
|
||||
<input type="text" name="text2" value="Test" id="text2" disabled="disabled"/>
|
||||
<input type="radio" name="radio1" id="radio1" value="on"/>
|
||||
|
||||
<input type="radio" name="radio2" id="radio2" checked="checked"/>
|
||||
<input type="checkbox" name="check" id="check1" checked="checked"/>
|
||||
<input type="checkbox" id="check2" value="on"/>
|
||||
|
||||
<input type="hidden" name="hidden" id="hidden1"/>
|
||||
<input type="text" style="display:none;" name="foo[bar]" id="hidden2"/>
|
||||
|
||||
<input type="text" id="name" name="name" value="name" />
|
||||
<input type="search" id="search" name="search" value="search" />
|
||||
|
||||
<button id="button" name="button" type="button">Button</button>
|
||||
|
||||
<textarea id="area1" maxlength="30">foobar</textarea>
|
||||
|
||||
<select name="select1" id="select1">
|
||||
<option id="option1a" class="emptyopt" value="">Nothing</option>
|
||||
<option id="option1b" value="1">1</option>
|
||||
<option id="option1c" value="2">2</option>
|
||||
<option id="option1d" value="3">3</option>
|
||||
</select>
|
||||
<select name="select2" id="select2">
|
||||
<option id="option2a" class="emptyopt" value="">Nothing</option>
|
||||
<option id="option2b" value="1">1</option>
|
||||
<option id="option2c" value="2">2</option>
|
||||
<option id="option2d" selected="selected" value="3">3</option>
|
||||
</select>
|
||||
<select name="select3" id="select3" multiple="multiple">
|
||||
<option id="option3a" class="emptyopt" value="">Nothing</option>
|
||||
<option id="option3b" selected="selected" value="1">1</option>
|
||||
<option id="option3c" selected="selected" value="2">2</option>
|
||||
<option id="option3d" value="3">3</option>
|
||||
<option id="option3e">no value</option>
|
||||
</select>
|
||||
<select name="select4" id="select4" multiple="multiple">
|
||||
<optgroup disabled="disabled">
|
||||
<option id="option4a" class="emptyopt" value="">Nothing</option>
|
||||
<option id="option4b" disabled="disabled" selected="selected" value="1">1</option>
|
||||
<option id="option4c" selected="selected" value="2">2</option>
|
||||
</optgroup>
|
||||
<option selected="selected" disabled="disabled" id="option4d" value="3">3</option>
|
||||
<option id="option4e">no value</option>
|
||||
</select>
|
||||
<select name="select5" id="select5">
|
||||
<option id="option5a" value="3">1</option>
|
||||
<option id="option5b" value="2">2</option>
|
||||
<option id="option5c" value="1" data-attr="">3</option>
|
||||
</select>
|
||||
|
||||
<object id="object1" codebase="stupid">
|
||||
<param name="p1" value="x1" />
|
||||
<param name="p2" value="x2" />
|
||||
</object>
|
||||
|
||||
<span id="台北Táiběi"></span>
|
||||
<span id="台北" lang="中文"></span>
|
||||
<span id="utf8class1" class="台北Táiběi 台北"></span>
|
||||
<span id="utf8class2" class="台北"></span>
|
||||
<span id="foo:bar" class="foo:bar"></span>
|
||||
<span id="test.foo[5]bar" class="test.foo[5]bar"></span>
|
||||
|
||||
<foo_bar id="foobar">test element</foo_bar>
|
||||
</form>
|
||||
<b id="floatTest">Float test.</b>
|
||||
<iframe id="iframe" name="iframe"></iframe>
|
||||
<form id="lengthtest">
|
||||
<input type="text" id="length" name="test"/>
|
||||
<input type="text" id="idTest" name="id"/>
|
||||
</form>
|
||||
<table id="table"></table>
|
||||
|
||||
<form id="name-tests">
|
||||
<!-- Inputs with a grouped name attribute. -->
|
||||
<input name="types[]" id="types_all" type="checkbox" value="all" />
|
||||
<input name="types[]" id="types_anime" type="checkbox" value="anime" />
|
||||
<input name="types[]" id="types_movie" type="checkbox" value="movie" />
|
||||
</form>
|
||||
|
||||
<form id="testForm" action="#" method="get">
|
||||
<textarea name="T3" rows="2" cols="15">?
|
||||
Z</textarea>
|
||||
<input type="hidden" name="H1" value="x" />
|
||||
<input type="hidden" name="H2" />
|
||||
<input name="PWD" type="password" value="" />
|
||||
<input name="T1" type="text" />
|
||||
<input name="T2" type="text" value="YES" readonly="readonly" />
|
||||
<input type="checkbox" name="C1" value="1" />
|
||||
<input type="checkbox" name="C2" />
|
||||
<input type="radio" name="R1" value="1" />
|
||||
<input type="radio" name="R1" value="2" />
|
||||
<input type="text" name="My Name" value="me" />
|
||||
<input type="reset" name="reset" value="NO" />
|
||||
<select name="S1">
|
||||
<option value="abc">ABC</option>
|
||||
<option value="abc">ABC</option>
|
||||
<option value="abc">ABC</option>
|
||||
</select>
|
||||
<select name="S2" multiple="multiple" size="3">
|
||||
<option value="abc">ABC</option>
|
||||
<option value="abc">ABC</option>
|
||||
<option value="abc">ABC</option>
|
||||
</select>
|
||||
<select name="S3">
|
||||
<option selected="selected">YES</option>
|
||||
</select>
|
||||
<select name="S4">
|
||||
<option value="" selected="selected">NO</option>
|
||||
</select>
|
||||
<input type="submit" name="sub1" value="NO" />
|
||||
<input type="submit" name="sub2" value="NO" />
|
||||
<input type="image" name="sub3" value="NO" />
|
||||
<button name="sub4" type="submit" value="NO">NO</button>
|
||||
<input name="D1" type="text" value="NO" disabled="disabled" />
|
||||
<input type="checkbox" checked="checked" disabled="disabled" name="D2" value="NO" />
|
||||
<input type="radio" name="D3" value="NO" checked="checked" disabled="disabled" />
|
||||
<select name="D4" disabled="disabled">
|
||||
<option selected="selected" value="NO">NO</option>
|
||||
</select>
|
||||
<input id="list-test" type="text" />
|
||||
<datalist id="datalist">
|
||||
<option value="option"></option>
|
||||
</datalist>
|
||||
</form>
|
||||
<div id="moretests">
|
||||
<form>
|
||||
<div id="checkedtest" style="display:none;">
|
||||
<input type="radio" name="checkedtestradios" checked="checked"/>
|
||||
<input type="radio" name="checkedtestradios" value="on"/>
|
||||
<input type="checkbox" name="checkedtestcheckboxes" checked="checked"/>
|
||||
<input type="checkbox" name="checkedtestcheckboxes" />
|
||||
</div>
|
||||
</form>
|
||||
<div id="nonnodes"><span id="nonnodesElement">hi</span> there <!-- mon ami --></div>
|
||||
<div id="t2037">
|
||||
<div><div class="hidden">hidden</div></div>
|
||||
</div>
|
||||
<div id="t6652">
|
||||
<div></div>
|
||||
</div>
|
||||
<div id="no-clone-exception"><object><embed></embed></object></div>
|
||||
</div>
|
||||
|
||||
<div id="tabindex-tests">
|
||||
<ol id="listWithTabIndex" tabindex="5">
|
||||
<li id="foodWithNegativeTabIndex" tabindex="-1">Rice</li>
|
||||
<li id="foodNoTabIndex">Beans</li>
|
||||
<li>Blinis</li>
|
||||
<li>Tofu</li>
|
||||
</ol>
|
||||
|
||||
<div id="divWithNoTabIndex">I'm hungry. I should...</div>
|
||||
<span>...</span><a href="#" id="linkWithNoTabIndex">Eat lots of food</a><span>...</span> |
|
||||
<span>...</span><a href="#" id="linkWithTabIndex" tabindex="2">Eat a little food</a><span>...</span> |
|
||||
<span>...</span><a href="#" id="linkWithNegativeTabIndex" tabindex="-1">Eat no food</a><span>...</span>
|
||||
<span>...</span><a id="linkWithNoHrefWithNoTabIndex">Eat a burger</a><span>...</span>
|
||||
<span>...</span><a id="linkWithNoHrefWithTabIndex" tabindex="1">Eat some funyuns</a><span>...</span>
|
||||
<span>...</span><a id="linkWithNoHrefWithNegativeTabIndex" tabindex="-1">Eat some funyuns</a><span>...</span>
|
||||
<input id="inputWithoutTabIndex"/>
|
||||
<button id="buttonWithoutTabIndex"></button>
|
||||
<textarea id="textareaWithoutTabIndex"></textarea>
|
||||
<menu type="popup">
|
||||
<menuitem id="menuitemWithoutTabIndex" command="submitbutton" default/>
|
||||
</menu>
|
||||
</div>
|
||||
|
||||
<div id="liveHandlerOrder">
|
||||
<span id="liveSpan1"><a href="#" id="liveLink1"></a></span>
|
||||
<span id="liveSpan2"><a href="#" id="liveLink2"></a></span>
|
||||
</div>
|
||||
|
||||
<div id="siblingTest">
|
||||
<em id="siblingfirst">1</em>
|
||||
<em id="siblingnext">2</em>
|
||||
<em id="siblingthird">
|
||||
<em id="siblingchild">
|
||||
<em id="siblinggrandchild">
|
||||
<em id="siblinggreatgrandchild"></em>
|
||||
</em>
|
||||
</em>
|
||||
</em>
|
||||
<span id="siblingspan"></span>
|
||||
</div>
|
||||
<div id="fx-test-group" style="position: absolute; width: 1px; height: 1px; overflow: hidden;">
|
||||
<div id="fx-queue" name="test">
|
||||
<div id="fadein" class='chain-test' name='div'>fadeIn<div>fadeIn</div></div>
|
||||
<div id="fadeout" class='chain-test chain-test-out'>fadeOut<div>fadeOut</div></div>
|
||||
|
||||
<div id="show" class='chain-test'>show<div>show</div></div>
|
||||
<div id="hide" class='chain-test chain-test-out'>hide<div>hide</div></div>
|
||||
<div id="easehide" class='chain-test chain-test-out'>hide<div>hide</div></div>
|
||||
|
||||
<div id="togglein" class='chain-test'>togglein<div>togglein</div></div>
|
||||
<div id="toggleout" class='chain-test chain-test-out'>toggleout<div>toggleout</div></div>
|
||||
<div id="easetoggleout" class='chain-test chain-test-out'>toggleout<div>toggleout</div></div>
|
||||
|
||||
<div id="slideup" class='chain-test'>slideUp<div>slideUp</div></div>
|
||||
<div id="slidedown" class='chain-test chain-test-out'>slideDown<div>slideDown</div></div>
|
||||
<div id="easeslideup" class='chain-test'>slideUp<div>slideUp</div></div>
|
||||
|
||||
<div id="slidetogglein" class='chain-test'>slideToggleIn<div>slideToggleIn</div></div>
|
||||
<div id="slidetoggleout" class='chain-test chain-test-out'>slideToggleOut<div>slideToggleOut</div></div>
|
||||
|
||||
<div id="fadetogglein" class='chain-test'>fadeToggleIn<div>fadeToggleIn</div></div>
|
||||
<div id="fadetoggleout" class='chain-test chain-test-out'>fadeToggleOut<div>fadeToggleOut</div></div>
|
||||
|
||||
<div id="fadeto" class='chain-test'>fadeTo<div>fadeTo</div></div>
|
||||
</div>
|
||||
|
||||
<div id="fx-tests"></div>
|
||||
<span id="display"></span>
|
||||
</div>
|
||||
4
test/data/qunit-fixture.js
Normal file
4
test/data/qunit-fixture.js
Normal file
File diff suppressed because one or more lines are too long
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
error_reporting(0);
|
||||
if ( $_REQUEST['header'] ) {
|
||||
if ( $_REQUEST['header'] == "ecma" ) {
|
||||
header("Content-type: application/ecmascript");
|
||||
} else {
|
||||
header("Content-type: text/javascript");
|
||||
}
|
||||
}
|
||||
?>
|
||||
ok( true, "Script executed correctly." );
|
||||
@@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
header( "HTTP/1.0 $_GET[status] $_GET[text]" );
|
||||
|
||||
?>
|
||||
@@ -1,3 +0,0 @@
|
||||
<?php
|
||||
file_put_contents("csp.log", "", LOCK_EX);
|
||||
?>
|
||||
@@ -1,3 +0,0 @@
|
||||
<?php
|
||||
file_put_contents("csp.log", "error", LOCK_EX);
|
||||
?>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
# This test page checks CSP only for browsers with "Content-Security-Policy" header support
|
||||
# i.e. no old WebKit or old Firefox
|
||||
header("Content-Security-Policy: default-src 'self'; report-uri csp-log.php");
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>CSP Test Page</title>
|
||||
<script src="../../jquery.js"></script>
|
||||
<script src="../iframeTest.js"></script>
|
||||
<script src="csp.js"></script>
|
||||
<script src="getComputedSupport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<p>CSP Test Page</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,7 +1,7 @@
|
||||
html text<br/>
|
||||
<script type="text/javascript">/* <![CDATA[ */
|
||||
testFoo = "foo"; jQuery('#foo').html('foo');
|
||||
ok( true, "test.html executed" );
|
||||
ok( true, "test.include.html executed" );
|
||||
/* ]]> */</script>
|
||||
<script src="data/testbar.php"></script>
|
||||
<script src="{{baseURL}}mock.php?action=testbar"></script>
|
||||
blabla
|
||||
@@ -1,7 +0,0 @@
|
||||
html text<br/>
|
||||
<script type="text/javascript">/* <![CDATA[ */
|
||||
testFoo = "foo"; jQuery('#foo').html('foo');
|
||||
ok( true, "test.php executed" );
|
||||
/* ]]> */</script>
|
||||
<script src="data/testbar.php?<?php srand(); echo time() . '' . rand(); ?>"></script>
|
||||
blabla
|
||||
@@ -1,3 +0,0 @@
|
||||
this.testBar = "bar";
|
||||
jQuery("#ap").html("bar");
|
||||
ok( true, "testbar.php executed");
|
||||
@@ -1,6 +1,11 @@
|
||||
/* eslint no-multi-str: "off" */
|
||||
|
||||
var baseURL = "",
|
||||
// baseURL is intentionally set to "data/" instead of "".
|
||||
// This is not just for convenience (since most files are in data/)
|
||||
// but also to ensure that urls without prefix fail.
|
||||
// Otherwise it's easy to write tests that pass on test/index.html
|
||||
// but fail in Karma runner (where the baseURL is different).
|
||||
var baseURL = "data/",
|
||||
supportjQuery = this.jQuery,
|
||||
|
||||
// see RFC 2606
|
||||
@@ -148,11 +153,13 @@ window.fireNative = document.createEvent ?
|
||||
/**
|
||||
* Add random number to url to stop caching
|
||||
*
|
||||
* @example url("data/test.html")
|
||||
* @result "data/test.html?10538358428943"
|
||||
* Also prefixes with baseURL automatically.
|
||||
*
|
||||
* @example url("data/test.php?foo=bar")
|
||||
* @result "data/test.php?foo=bar&10538358345554"
|
||||
* @example url("index.html")
|
||||
* @result "data/index.html?10538358428943"
|
||||
*
|
||||
* @example url("mock.php?foo=bar")
|
||||
* @result "data/mock.php?foo=bar&10538358345554"
|
||||
*/
|
||||
function url( value ) {
|
||||
return baseURL + value + ( /\?/.test( value ) ? "&" : "?" ) +
|
||||
@@ -239,7 +246,7 @@ this.testIframe = function( title, fileName, func, wrapper ) {
|
||||
var done = assert.async(),
|
||||
$iframe = supportjQuery( "<iframe/>" )
|
||||
.css( { position: "absolute", top: "0", left: "-600px", width: "500px" } )
|
||||
.attr( { id: "qunit-fixture-iframe", src: url( "./data/" + fileName ) } );
|
||||
.attr( { id: "qunit-fixture-iframe", src: url( fileName ) } );
|
||||
|
||||
// Test iframes are expected to invoke this via startIframeTest (cf. iframeTest.js)
|
||||
window.iframeCallback = function() {
|
||||
@@ -264,14 +271,20 @@ this.testIframe = function( title, fileName, func, wrapper ) {
|
||||
};
|
||||
this.iframeCallback = undefined;
|
||||
|
||||
// Tests are always loaded async
|
||||
QUnit.config.autostart = false;
|
||||
if ( window.__karma__ ) {
|
||||
// In Karma, files are served from /base
|
||||
baseURL = "base/test/data/";
|
||||
} else {
|
||||
// Tests are always loaded async
|
||||
// except when running tests in Karma (See Gruntfile)
|
||||
QUnit.config.autostart = false;
|
||||
}
|
||||
|
||||
// Leverage QUnit URL parsing to detect testSwarm environment and "basic" testing mode
|
||||
QUnit.isSwarm = ( QUnit.urlParams.swarmURL + "" ).indexOf( "http" ) === 0;
|
||||
QUnit.basicTests = ( QUnit.urlParams.module + "" ) === "basic";
|
||||
|
||||
this.loadTests = function() {
|
||||
|
||||
// Leverage QUnit URL parsing to detect testSwarm environment and "basic" testing mode
|
||||
QUnit.isSwarm = ( QUnit.urlParams.swarmURL + "" ).indexOf( "http" ) === 0;
|
||||
QUnit.basicTests = ( QUnit.urlParams.module + "" ) === "basic";
|
||||
|
||||
// Get testSubproject from testrunner first
|
||||
require( [ "data/testrunner.js" ], function() {
|
||||
var i = 0,
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
<?php
|
||||
error_reporting(0);
|
||||
$callback = $_REQUEST['callback'];
|
||||
$json = $_REQUEST['json'];
|
||||
$text = json_encode(file_get_contents(dirname(__FILE__)."/with_fries.xml"));
|
||||
echo "$callback($text)";
|
||||
?>
|
||||
Reference in New Issue
Block a user