Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix all quotes, single to double

  • Loading branch information...
commit 934252d0b748cd9f249d87175777ae35086ef2cd 1 parent e6dda72
@rwaldron authored
Showing with 79 additions and 89 deletions.
  1. +17 −17 test/jquery.eventsource.specit.js
  2. +62 −72 test/jquery.eventsource.unit.js
View
34 test/jquery.eventsource.specit.js
@@ -12,11 +12,11 @@ describe("jQuery.EventSource", function() {
var streams = {}, labelfor, stypeOf;
before(function() {
- labelfor = 'text-event-source';
+ labelfor = "text-event-source";
stypeOf = window.EventSource ? EventSource : XMLHttpRequest;
streams = $.eventsource({
label: labelfor,
- url: '../test-event-sources/event-source-1.php'
+ url: "../test-event-sources/event-source-1.php"
});
});
@@ -24,17 +24,17 @@ describe("jQuery.EventSource", function() {
it("$.eventsource streams cache", function() {
- assert($.eventsource('streams')).should(beAn, Object);
- assert(sizeOf($.eventsource('streams'))).should(beLessThanOrEqualTo, 1);
+ assert($.eventsource("streams")).should(beAn, Object);
+ assert(sizeOf($.eventsource("streams"))).should(beLessThanOrEqualTo, 1);
});
it("$.eventsource stream object", function() {
- assert(streams[labelfor]).should(include, 'history');
- assert(streams[labelfor]).should(include, 'isHostApi');
- assert(streams[labelfor]).should(include, 'lastEventId');
- assert(streams[labelfor]).should(include, 'options');
- assert(streams[labelfor]).should(include, 'stream');
+ assert(streams[labelfor]).should(include, "history");
+ assert(streams[labelfor]).should(include, "isHostApi");
+ assert(streams[labelfor]).should(include, "lastEventId");
+ assert(streams[labelfor]).should(include, "options");
+ assert(streams[labelfor]).should(include, "stream");
});
it("$.eventsource stream object should be", function() {
@@ -49,10 +49,10 @@ describe("jQuery.EventSource", function() {
it("$.eventsource stream options object", function() {
- assert(streams[labelfor].options).should(include, 'url');
- assert(streams[labelfor].options).should(include, 'label');
- assert(streams[labelfor].options).should(include, 'message');
- assert(streams[labelfor].options).should(include, 'open');
+ assert(streams[labelfor].options).should(include, "url");
+ assert(streams[labelfor].options).should(include, "label");
+ assert(streams[labelfor].options).should(include, "message");
+ assert(streams[labelfor].options).should(include, "open");
});
it("$.eventsource stream options object should be", function() {
@@ -66,10 +66,10 @@ describe("jQuery.EventSource", function() {
it("$.eventsource stream closing", function() {
- $.eventsource('close', labelfor);
+ $.eventsource("close", labelfor);
- assert($.eventsource('streams')).should(beAn, Object);
- assert(sizeOf($.eventsource('streams'))).should(beLessThanOrEqualTo, 0);
+ assert($.eventsource("streams")).should(beAn, Object);
+ assert(sizeOf($.eventsource("streams"))).should(beLessThanOrEqualTo, 0);
});
@@ -78,4 +78,4 @@ describe("jQuery.EventSource", function() {
streams = {};
});
-});
+});
View
134 test/jquery.eventsource.unit.js
@@ -11,7 +11,7 @@ function sizeOf(obj) {
test("$.eventsource is a function", function() {
ok( $.isFunction($.eventsource), "$.eventsource is a function" );
- equals(sizeOf($.eventsource('streams')), 0, 'There are no streams');
+ equals(sizeOf($.eventsource("streams")), 0, "There are no streams");
});
test("$.eventsource callbacks", function() {
@@ -19,8 +19,8 @@ test("$.eventsource is a function", function() {
stop();
// PLAIN TEXT EXAMPLE - NO CONTENT TYPE GIVEN
$.eventsource({
- label: 'text-event-source',
- url: '../test-event-sources/event-source-1.php',
+ label: "text-event-source",
+ url: "../test-event-sources/event-source-1.php",
open: function () {
ok( true, "#1 $.eventsource fires onopen callback" );
},
@@ -29,15 +29,15 @@ test("$.eventsource is a function", function() {
ok( data, "#1 $.eventsource returns data");
- ok( typeof $.eventsource('close', 'text-event-source') === 'object', '$.eventsource("close", "text-event-source") must return an object' );
+ ok( typeof $.eventsource("close", "text-event-source") === "object", '$.eventsource("close", "text-event-source") must return an object' );
}
});
// PLAIN TEXT EXAMPLE - HAS CONTENT TYPE
$.eventsource({
- label: 'text-event-source-ct',
- url: '../test-event-sources/event-source-1.php',
- dataType: 'text',
+ label: "text-event-source-ct",
+ url: "../test-event-sources/event-source-1.php",
+ dataType: "text",
open: function () {
ok( true, "#2 $.eventsource fires onopen callback" );
},
@@ -46,16 +46,16 @@ test("$.eventsource is a function", function() {
ok( data, "#2 $.eventsource returns data");
- ok( typeof $.eventsource('close', 'text-event-source-ct') === 'object', '$.eventsource("close", "text-event-source-ct") must return an object' );
+ ok( typeof $.eventsource("close", "text-event-source-ct") === "object", '$.eventsource("close", "text-event-source-ct") must return an object' );
}
});
// PLAIN TEXT EXAMPLE - HAS CONTENT TYPE
$.eventsource({
- label: 'json-event-source',
- url: '../test-event-sources/event-source-2.php',
- dataType: 'json',
+ label: "json-event-source",
+ url: "../test-event-sources/event-source-2.php",
+ dataType: "json",
open: function () {
ok( true, "#3 $.eventsource fires onopen callback" );
},
@@ -65,7 +65,7 @@ test("$.eventsource is a function", function() {
ok( data, "#3 $.eventsource returns data");
- ok( typeof $.eventsource('close', 'json-event-source') === 'object', '$.eventsource("close", "json-event-source") must return an object' );
+ ok( typeof $.eventsource("close", "json-event-source") === "object", '$.eventsource("close", "json-event-source") must return an object' );
}
});
@@ -82,9 +82,9 @@ test("$.eventsource is a function", function() {
stop();
$.eventsource({
- label: 'json-event-source-stream',
- url: '../test-event-sources/event-source-2.php',
- dataType: 'json',
+ label: "json-event-source-stream",
+ url: "../test-event-sources/event-source-2.php",
+ dataType: "json",
open: function () {
ok( true, "#4 $.eventsource fires onopen callback" );
},
@@ -94,11 +94,11 @@ test("$.eventsource is a function", function() {
ok( data, "#4 $.eventsource returns data");
- equals(sizeOf($.eventsource('streams')), 1, 'there is only 1 active stream');
+ equals(sizeOf($.eventsource("streams")), 1, "there is only 1 active stream");
- ok( typeof $.eventsource('close', 'json-event-source-stream') === 'object', '$.eventsource("close", "json-event-source-stream") must return an object' );
+ ok( typeof $.eventsource("close", "json-event-source-stream") === "object", '$.eventsource("close", "json-event-source-stream") must return an object' );
- equals(sizeOf($.eventsource('streams')), 0, 'there are 0 active streams');
+ equals(sizeOf($.eventsource("streams")), 0, "there are 0 active streams");
}
});
@@ -115,46 +115,46 @@ test("$.eventsource is a function", function() {
stop();
$.eventsource({
- label: 'event-source-1',
- url: '../test-event-sources/event-source-2.php',
- dataType: 'json',
+ label: "event-source-1",
+ url: "../test-event-sources/event-source-2.php",
+ dataType: "json",
open: function () {
ok( true, "event-source-1 fires onopen callback" );
},
message: function (data) {
- equals(this.label, 'event-source-1', 'Correct EventSource returned, looking for `event-source-1`');
+ equals(this.label, "event-source-1", "Correct EventSource returned, looking for `event-source-1`");
ok( true, "event-source-1 fires onmessage callback" );
}
});
$.eventsource({
- label: 'event-source-2',
- url: '../test-event-sources/event-source-2.php',
- dataType: 'json',
+ label: "event-source-2",
+ url: "../test-event-sources/event-source-2.php",
+ dataType: "json",
open: function () {
ok( true, "event-source-2 fires onopen callback" );
},
message: function (data) {
- equals(this.label, 'event-source-2', 'Correct EventSource returned, looking for `event-source-2`');
+ equals(this.label, "event-source-2", "Correct EventSource returned, looking for `event-source-2`");
ok( true, "event-source-2 fires onmessage callback" );
}
});
$.eventsource({
- label: 'event-source-3',
- url: '../test-event-sources/event-source-2.php',
- dataType: 'json',
+ label: "event-source-3",
+ url: "../test-event-sources/event-source-2.php",
+ dataType: "json",
open: function () {
ok( true, "event-source-3 fires onopen callback" );
},
message: function (data) {
- equals(this.label, 'event-source-3', 'Correct EventSource returned, looking for `event-source-3`');
+ equals(this.label, "event-source-3", "Correct EventSource returned, looking for `event-source-3`");
ok( true, "event-source-3 fires onmessage callback" );
}
});
@@ -171,9 +171,9 @@ test("$.eventsource is a function", function() {
setTimeout(function() {
- equals(2, sizeOf($.eventsource('close', 'event-source-1')), 'Closing `event-source-1`, 2 event sources remaining');
- equals(1, sizeOf($.eventsource('close', 'event-source-2')), 'Closing `event-source-2`, 1 event sources remaining');
- equals(0, sizeOf($.eventsource('close', 'event-source-3')), 'Closing `event-source-3`, 0 event sources remaining');
+ equals(2, sizeOf($.eventsource("close", "event-source-1")), "Closing `event-source-1`, 2 event sources remaining");
+ equals(1, sizeOf($.eventsource("close", "event-source-2")), "Closing `event-source-2`, 1 event sources remaining");
+ equals(0, sizeOf($.eventsource("close", "event-source-3")), "Closing `event-source-3`, 0 event sources remaining");
start();
}, 500);
});
@@ -187,7 +187,7 @@ test("$.eventsource is a function", function() {
$.eventsource({});
} catch(err) {
- ok(true, 'Caught the error thrown by the instance not having any options set');
+ ok(true, "Caught the error thrown by the instance not having any options set");
}
try {
@@ -196,7 +196,7 @@ test("$.eventsource is a function", function() {
message: function (data) {}
});
} catch(err) {
- ok(true, 'Caught the error thrown by the instance not being provided a url');
+ ok(true, "Caught the error thrown by the instance not being provided a url");
}
try {
@@ -206,7 +206,7 @@ test("$.eventsource is a function", function() {
message: function (data) {}
});
} catch(err) {
- ok(true, 'Caught the error thrown by the instance options.url being `null`');
+ ok(true, "Caught the error thrown by the instance options.url being `null`");
}
@@ -217,18 +217,18 @@ test("$.eventsource is a function", function() {
message: function (data) {}
});
} catch(err) {
- ok(true, 'Caught the error thrown by the instance options.url being `undefined`');
+ ok(true, "Caught the error thrown by the instance options.url being `undefined`");
}
try {
$.eventsource({
- url: '',
+ url: "",
open: function () {},
message: function (data) {}
});
} catch(err) {
- ok(true, 'Caught the error thrown by the instance options.url being an empty string');
+ ok(true, "Caught the error thrown by the instance options.url being an empty string");
}
@@ -239,7 +239,7 @@ test("$.eventsource is a function", function() {
message: function (data) {}
});
} catch(err) {
- ok(true, 'Caught the error thrown by the instance options.url being `false`');
+ ok(true, "Caught the error thrown by the instance options.url being `false`");
}
@@ -250,25 +250,15 @@ test("$.eventsource is a function", function() {
message: function (data) {}
});
} catch(err) {
- ok(true, 'Caught the error thrown by the instance options.url being `true`');
+ ok(true, "Caught the error thrown by the instance options.url being `true`");
}
setTimeout(function(){
start();
- }, 3000);
- /*
- // this will error, but not testing?
- $.eventsource({
- label: 'event-source-3',
- url: '../test-event-sources/event-source-10.php',
- dataType: 'json',
- open: function () {},
- message: function (data) {}
- });
- */
-
+ }, 3000);
- });
+
+ });
@@ -284,8 +274,8 @@ test("$.eventsource is a function", function() {
setTimeout(function(){
// labeled stream
$.eventsource({
- label: 'labeled-stream',
- url: '../test-event-sources/event-source-1.php',
+ label: "labeled-stream",
+ url: "../test-event-sources/event-source-1.php",
open: function () {
},
message: function (data) {
@@ -294,7 +284,7 @@ test("$.eventsource is a function", function() {
// unlabeled stream
$.eventsource({
- url: '../test-event-sources/event-source-2.php',
+ url: "../test-event-sources/event-source-2.php",
open: function () {
},
message: function (data) {
@@ -304,47 +294,47 @@ test("$.eventsource is a function", function() {
// no callbacks
$.eventsource({
- url: '../test-event-sources/event-source-2.php'
+ url: "../test-event-sources/event-source-2.php"
});
- var streamsObj = $.eventsource('streams');
+ var streamsObj = $.eventsource("streams");
- ok( typeof streamsObj === 'object', '$.eventsource("streams") must return an object' );
+ ok( typeof streamsObj === "object", "$.eventsource("streams") must return an object" );
$.each(streamsObj, function (i, obj) {
- equals( typeof obj.isHostApi, 'boolean', 'Stream.isHostApi exists and is a boolean value' );
+ equals( typeof obj.isHostApi, "boolean", "Stream.isHostApi exists and is a boolean value" );
- equals( typeof obj.lastEventId, 'number', 'Stream.lastEventId exists and is a boolean value' );
+ equals( typeof obj.lastEventId, "number", "Stream.lastEventId exists and is a boolean value" );
- equals( obj.options.label && obj.options.label !== '', true, 'Stream.options.label exists and not an empty string' );
+ equals( obj.options.label && obj.options.label !== "", true, "Stream.options.label exists and not an empty string" );
- equals( obj.options.message && $.isFunction(obj.options.message), true, 'Stream.options.message exists and is a function' );
+ equals( obj.options.message && $.isFunction(obj.options.message), true, "Stream.options.message exists and is a function" );
- equals( obj.options.open && $.isFunction(obj.options.open), true, 'Stream.options.message exists and is a function' );
+ equals( obj.options.open && $.isFunction(obj.options.open), true, "Stream.options.message exists and is a function" );
if ( obj.isHostApi ) {
- equals( obj.stream.toString(), '[object EventSource]', 'Native Streams are [object EventSource]' );
+ equals( obj.stream.toString(), "[object EventSource]", "Native Streams are [object EventSource]" );
}
if ( !obj.isHostApi ) {
if ( window.XMLHttpRequest ) {
- equals( obj.stream.toString(), '[object XMLHttpRequest]', 'Non-Native Streams are [object XMLHttpRequest]' );
+ equals( obj.stream.toString(), "[object XMLHttpRequest]", "Non-Native Streams are [object XMLHttpRequest]" );
}
else {
- ok( true, 'Missing IE Stream type test!!' );
+ ok( true, "Missing IE Stream type test!!" );
}
}
});
- equals( typeof $.eventsource('close'), 'object', '$.eventsource("close") must return an object' );
+ equals( typeof $.eventsource("close"), "object", "$.eventsource("close") must return an object" );
- equals( typeof $.eventsource('streams'), 'object', '$.eventsource("streams") must return an object' );
+ equals( typeof $.eventsource("streams"), "object", "$.eventsource("streams") must return an object" );
start();
@@ -365,9 +355,9 @@ test("$.eventsource is a function", function() {
stop();
- equals(sizeOf($.eventsource('streams')), 0, 'there are 0 active streams');
+ equals(sizeOf($.eventsource("streams")), 0, "there are 0 active streams");
- ok( typeof $.eventsource('streams') === 'object', '$.eventsource("streams") must return an object' );
+ ok( typeof $.eventsource("streams") === "object", '$.eventsource("streams") must return an object' );
setTimeout(function(){
Please sign in to comment.
Something went wrong with that request. Please try again.