Skip to content

Commit 11ae4e0

Browse files
author
Eric Adams
committed
Tests for bad parameters
1 parent f2ec5ca commit 11ae4e0

File tree

9 files changed

+63
-47
lines changed

9 files changed

+63
-47
lines changed

docs/api.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
YUI.add("yuidoc-meta", function(Y) {
22
Y.YUIDoc = { meta: {
33
"classes": [
4-
"JSONPSec"
4+
"JSONPsec"
55
],
66
"modules": [
7-
"JSONPSec"
7+
"JSONPsec"
88
],
99
"allModules": [
1010
{
11-
"displayName": "JSONPSec",
12-
"name": "JSONPSec",
11+
"displayName": "JSONPsec",
12+
"name": "JSONPsec",
1313
"description": "JSONP-sec uses spawned web workers to\ninsulate the current UI thread and DOM\nfrom potential attacks from JSONP requests.\nThis is not meant to be a replacement for\na reasonable CORS setup, only when you do\nnot have access to the server returning data."
1414
}
1515
]

docs/classes/JSONPSec.html renamed to docs/classes/JSONPsec.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
5-
<title>JSONPSec - jsonp-sec</title>
5+
<title>JSONPsec - jsonp-sec</title>
66
<link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
77
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
88
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
@@ -41,13 +41,13 @@ <h2 class="off-left">APIs</h2>
4141
<div id="api-tabview-panel">
4242
<ul id="api-classes" class="apis classes">
4343

44-
<li><a href="../classes/JSONPSec.html">JSONPSec</a></li>
44+
<li><a href="../classes/JSONPsec.html">JSONPsec</a></li>
4545

4646
</ul>
4747

4848
<ul id="api-modules" class="apis modules">
4949

50-
<li><a href="../modules/JSONPSec.html">JSONPSec</a></li>
50+
<li><a href="../modules/JSONPsec.html">JSONPsec</a></li>
5151

5252
</ul>
5353
</div>
@@ -84,7 +84,7 @@ <h2 class="off-left">APIs</h2>
8484
<div class="apidocs">
8585
<div id="docs-main">
8686
<div class="content">
87-
<h1>JSONPSec Class</h1>
87+
<h1>JSONPsec Class</h1>
8888
<div class="box meta">
8989

9090

@@ -98,7 +98,7 @@ <h1>JSONPSec Class</h1>
9898

9999

100100

101-
Module: <a href="../modules/JSONPSec.html">JSONPSec</a>
101+
Module: <a href="../modules/JSONPsec.html">JSONPsec</a>
102102

103103

104104

@@ -142,7 +142,7 @@ <h3>Methods</h3>
142142
<ul class="index-list methods">
143143

144144
<li class="index-item method">
145-
<a href="#method_JSONPSec">JSONPSec</a>
145+
<a href="#method_JSONPsec">JSONPsec</a>
146146

147147

148148
<span class="flag static">static</span>
@@ -166,8 +166,8 @@ <h3>Methods</h3>
166166
<h2 class="off-left">Methods</h2>
167167

168168

169-
<div id="method_JSONPSec" class="method item">
170-
<h3 class="name"><code>JSONPSec</code></h3>
169+
<div id="method_JSONPsec" class="method item">
170+
<h3 class="name"><code>JSONPsec</code></h3>
171171

172172

173173
<div class="args">

docs/data.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
"jsonp-sec.js": {
1010
"name": "jsonp-sec.js",
1111
"modules": {
12-
"JSONPSec": 1
12+
"JSONPsec": 1
1313
},
1414
"classes": {
15-
"JSONPSec": 1
15+
"JSONPsec": 1
1616
},
1717
"fors": {},
1818
"namespaces": {}
@@ -26,11 +26,11 @@
2626
}
2727
},
2828
"modules": {
29-
"JSONPSec": {
30-
"name": "JSONPSec",
29+
"JSONPsec": {
30+
"name": "JSONPsec",
3131
"submodules": {},
3232
"classes": {
33-
"JSONPSec": 1
33+
"JSONPsec": 1
3434
},
3535
"fors": {},
3636
"namespaces": {},
@@ -41,15 +41,15 @@
4141
}
4242
},
4343
"classes": {
44-
"JSONPSec": {
45-
"name": "JSONPSec",
46-
"shortname": "JSONPSec",
44+
"JSONPsec": {
45+
"name": "JSONPsec",
46+
"shortname": "JSONPsec",
4747
"classitems": [],
4848
"plugins": [],
4949
"extensions": [],
5050
"plugin_for": [],
5151
"extension_for": [],
52-
"module": "JSONPSec",
52+
"module": "JSONPsec",
5353
"namespace": "",
5454
"file": "jsonp-sec.js",
5555
"line": 1,
@@ -61,14 +61,14 @@
6161
"file": "jsonp-sec.js",
6262
"line": 13,
6363
"description": "Make a secure JSONP request, within the context of the web worker thread.\nThis will use importScripts, so you must have a solution defined in the\ndegraded iframe state that works with traditional JSONP <script> tags.",
64-
"class": "JSONPSec",
65-
"module": "JSONPSec"
64+
"class": "JSONPsec",
65+
"module": "JSONPsec"
6666
},
6767
{
6868
"file": "jsonp-sec.js",
6969
"line": 20,
7070
"itemtype": "method",
71-
"name": "JSONPSec",
71+
"name": "JSONPsec",
7272
"params": [
7373
{
7474
"name": "options",
@@ -100,15 +100,15 @@
100100
"type": "Null"
101101
},
102102
"static": 1,
103-
"class": "JSONPSec",
104-
"module": "JSONPSec"
103+
"class": "JSONPsec",
104+
"module": "JSONPsec"
105105
},
106106
{
107107
"file": "unsec.js",
108108
"line": 1,
109109
"description": "Note: Try this test file in IE8 & IE9.\nScript access should be blocked.",
110110
"class": "",
111-
"module": "JSONPSec"
111+
"module": "JSONPsec"
112112
}
113113
],
114114
"warnings": [

docs/files/jsonp-sec.js.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ <h2 class="off-left">APIs</h2>
4141
<div id="api-tabview-panel">
4242
<ul id="api-classes" class="apis classes">
4343

44-
<li><a href="../classes/JSONPSec.html">JSONPSec</a></li>
44+
<li><a href="../classes/JSONPsec.html">JSONPsec</a></li>
4545

4646
</ul>
4747

4848
<ul id="api-modules" class="apis modules">
4949

50-
<li><a href="../modules/JSONPSec.html">JSONPSec</a></li>
50+
<li><a href="../modules/JSONPsec.html">JSONPsec</a></li>
5151

5252
</ul>
5353
</div>
@@ -95,8 +95,8 @@ <h1 class="file-heading">File: jsonp-sec.js</h1>
9595
* This is not meant to be a replacement for
9696
* a reasonable CORS setup, only when you do
9797
* not have access to the server returning data.
98-
* @module JSONPSec
99-
* @class JSONPSec
98+
* @module JSONPsec
99+
* @class JSONPsec
100100
*/
101101
(function(global) {
102102

@@ -108,7 +108,7 @@ <h1 class="file-heading">File: jsonp-sec.js</h1>
108108
var JSONPsec = operative(
109109

110110
/**
111-
* @method JSONPSec
111+
* @method JSONPsec
112112
* @param {Object} options The options to use
113113
* @param {String} options.url The url for the request
114114
* @param {String} [options.callbackParam=callback] The name of the callback function (will be executed in the global scope)

docs/files/unsec.js.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ <h2 class="off-left">APIs</h2>
4141
<div id="api-tabview-panel">
4242
<ul id="api-classes" class="apis classes">
4343

44-
<li><a href="../classes/JSONPSec.html">JSONPSec</a></li>
44+
<li><a href="../classes/JSONPsec.html">JSONPsec</a></li>
4545

4646
</ul>
4747

4848
<ul id="api-modules" class="apis modules">
4949

50-
<li><a href="../modules/JSONPSec.html">JSONPSec</a></li>
50+
<li><a href="../modules/JSONPsec.html">JSONPsec</a></li>
5151

5252
</ul>
5353
</div>

docs/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ <h2 class="off-left">APIs</h2>
4141
<div id="api-tabview-panel">
4242
<ul id="api-classes" class="apis classes">
4343

44-
<li><a href="./classes/JSONPSec.html">JSONPSec</a></li>
44+
<li><a href="./classes/JSONPsec.html">JSONPsec</a></li>
4545

4646
</ul>
4747

4848
<ul id="api-modules" class="apis modules">
4949

50-
<li><a href="./modules/JSONPSec.html">JSONPSec</a></li>
50+
<li><a href="./modules/JSONPsec.html">JSONPsec</a></li>
5151

5252
</ul>
5353
</div>

docs/modules/JSONPSec.html renamed to docs/modules/JSONPsec.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
5-
<title>JSONPSec - jsonp-sec</title>
5+
<title>JSONPsec - jsonp-sec</title>
66
<link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
77
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
88
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
@@ -41,13 +41,13 @@ <h2 class="off-left">APIs</h2>
4141
<div id="api-tabview-panel">
4242
<ul id="api-classes" class="apis classes">
4343

44-
<li><a href="../classes/JSONPSec.html">JSONPSec</a></li>
44+
<li><a href="../classes/JSONPsec.html">JSONPsec</a></li>
4545

4646
</ul>
4747

4848
<ul id="api-modules" class="apis modules">
4949

50-
<li><a href="../modules/JSONPSec.html">JSONPSec</a></li>
50+
<li><a href="../modules/JSONPsec.html">JSONPsec</a></li>
5151

5252
</ul>
5353
</div>
@@ -84,7 +84,7 @@ <h2 class="off-left">APIs</h2>
8484
<div class="apidocs">
8585
<div id="docs-main">
8686
<div class="content">
87-
<h1>JSONPSec Module</h1>
87+
<h1>JSONPsec Module</h1>
8888
<div class="box clearfix meta">
8989

9090

@@ -121,8 +121,8 @@ <h1>JSONPSec Module</h1>
121121
<ul class="module-classes">
122122

123123
<li class="module-class">
124-
<a href="../classes/JSONPSec.html">
125-
JSONPSec
124+
<a href="../classes/JSONPsec.html">
125+
JSONPsec
126126
</a>
127127
</li>
128128

jsonp-sec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* This is not meant to be a replacement for
66
* a reasonable CORS setup, only when you do
77
* not have access to the server returning data.
8-
* @module JSONPSec
9-
* @class JSONPSec
8+
* @module JSONPsec
9+
* @class JSONPsec
1010
*/
1111
(function(global) {
1212

@@ -18,7 +18,7 @@
1818
var JSONPsec = operative(
1919

2020
/**
21-
* @method JSONPSec
21+
* @method JSONPsec
2222
* @param {Object} options The options to use
2323
* @param {String} options.url The url for the request
2424
* @param {String} [options.callbackParam=callback] The name of the callback function (will be executed in the global scope)

test/qunit/tests/jsonp-sec.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,24 @@
22

33
module("Tests for jsonp-sec");
44

5-
test("Test events", function() {
6-
ok(true);
5+
/**
6+
* Test JSONPsec no callback for operative
7+
*/
8+
test("Test JSONPsec no callback for operative", 1, function() {
9+
try {
10+
JSONPsec();
11+
}
12+
catch(err) {
13+
ok(/operative/i.test(err));
14+
}
15+
});
16+
17+
/**
18+
* Test JSONPsec without sufficient options
19+
*/
20+
test("Test JSONPsec no options", function() {
21+
throws(JSONPsec(null, function(){}), 'Need options and options.url defined', 'No options throws an error');
22+
throws(JSONPsec({}, function(){}), 'Need options and options.url defined', 'No options throws an error');
723
});
824

925
}());

0 commit comments

Comments
 (0)