forked from Krinkle/jquery-json
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
79 lines (71 loc) · 1.75 KB
/
index.html
File metadata and controls
79 lines (71 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>jQuery JSON Test Suite</title>
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
<script>
/*global QUnit */
QUnit.config.autostart = false;
/**
* Implement 'distmin' option.
*
* Also makes sure we force a cache miss to ease develoment.
*/
QUnit.config.urlConfig.push({
id: 'distmin',
label: 'Use build',
tooltip: 'Use the minified build'
});
var srcPath,
nativeJSON;
if (QUnit.urlParams.distmin) {
srcPath = '../dist/jquery.json.min.js';
} else {
srcPath = '../src/jquery.json.js';
}
/**
* Implement 'disableNative' option.
*
* Useful for disabling the browsers native JSON api,
* and thus test the plugin's methods instead.
*/
QUnit.config.urlConfig.push({
id: 'disableNative',
label: 'Disable native support',
tooltip: 'Disable the native window.JSON object (if it exists)'
});
if (QUnit.urlParams.disableNative) {
nativeJSON = JSON;
JSON = undefined;
}
// Load source
jQuery.ajax({
url: srcPath,
dataType: 'script',
cache: false,
// Must use async:false (using XHR) or crossDomain:true (using <script>)
// as otherwise the qunit-phantomjs/bridge.js executes at the wrong time,
// causing a fatal error for JSON undefined (resulting in a timeout).
async: false
}).done(function () {
if (QUnit.urlParams.disableNative) {
JSON = nativeJSON;
}
// Load test suite
jQuery.ajax({
url: 'jquery.json.test.js',
dataType: 'script',
cache: false
}).done(function () {
QUnit.start();
});
});
</script>
</head>
<body>
<div id="qunit"></div>
</body>
</html>