[Pkg-javascript-commits] [sockjs-client] 148/350: All tests working except htmlfile

tonnerre at ancient-solutions.com tonnerre at ancient-solutions.com
Fri Aug 5 01:03:56 UTC 2016


This is an automated email from the git hooks/post-receive script.

tonnerre-guest pushed a commit to branch upstream
in repository sockjs-client.

commit b030cf4c255a07a9d353838f2194e833e35e15d9
Author: Bryce Kahle <bkahle at gmail.com>
Date:   Wed Oct 15 18:44:04 2014 -0400

    All tests working except htmlfile
---
 gulpfile.js                     |   2 +-
 tests/html/example-cursors.html |  21 ++--
 tests/html/index.html           |   2 +-
 tests/html/smoke-latency.html   |  11 +-
 tests/html/smoke-reconnect.html |  13 +--
 tests/html/sockjs-in-head.html  |   2 +-
 tests/html/static/qunit.css     | 225 ----------------------------------------
 tests/html/static/qunit.min.js  |   1 -
 tests/html/tests-qunit.html     |  48 ---------
 tests/html/unittests.html       |  43 --------
 tests/lib/iframe.js             |  17 ++-
 tests/lib/transports.js         |   1 -
 12 files changed, 38 insertions(+), 348 deletions(-)

diff --git a/gulpfile.js b/gulpfile.js
index e5880c7..46d1348 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -16,7 +16,7 @@ var jsRoot = path.join(__dirname, 'lib')
   ;
 
 gulp.task('test', function () {
-  gulp.src('tests/main.js', {read: false})
+  gulp.src('tests/node.js', {read: false})
     .pipe(mocha());
 });
 
diff --git a/tests/html/example-cursors.html b/tests/html/example-cursors.html
index 9df37ef..f1b84c1 100644
--- a/tests/html/example-cursors.html
+++ b/tests/html/example-cursors.html
@@ -57,26 +57,25 @@
       }
 
     var sjs = null;
-    var protocol;
+    var transport;
     $('#connect').click(function() {
         $('#connect').attr('disabled', true);
         $('#disconnect').each(function(_,e){e.disabled='';});
-        var protocol = $('#transport').val() || undefined;
-        if (protocol === 'not-websocket') {
-            protocol = ['xdr-streaming',
+        var transport = $('#transport').val() || undefined;
+        if (transport === 'not-websocket') {
+            transport = ['xdr-streaming',
                       'xhr-streaming',
+                      'eventsource',
                       'iframe-eventsource',
+                      'htmlfile',
                       'iframe-htmlfile',
                       'xdr-polling',
                       'xhr-polling',
                       'iframe-xhr-polling',
                       'jsonp-polling'];
         }
-        log('[connecting] ' + protocol);
-        options = jQuery.extend({}, client_opts.sockjs_opts)
-        options.protocols_whitelist = typeof protocol === 'string' ?
-                                                        [protocol] : protocol;
-        sjs = new SockJS(client_opts.url + '/broadcast', null, options);
+        log('[connecting] ' + transport);
+        sjs = new SockJS(clientOptions.url + '/broadcast', null, transport);
         sjs.onopen = onopen
         sjs.onclose = onclose;
         sjs.onmessage = xonmessage;
@@ -88,10 +87,10 @@
     });
 
     var onopen = function() {
-        log('connected ' + sjs.protocol);
+        log('connected ' + sjs.transport);
     };
     var onclose = function(e) {
-        log('disconnected ' + e);
+        log('disconnected ' + e.code + ', ' + e.reason);
         $('#connect').each(function(_,e){e.disabled='';});
         $('#disconnect').attr('disabled', true);
     };
diff --git a/tests/html/index.html b/tests/html/index.html
index d6b5cf8..addfbd8 100644
--- a/tests/html/index.html
+++ b/tests/html/index.html
@@ -10,7 +10,7 @@
 <body>
   <h1>SockJS</h1>
   <ul>
-    <li><a href="tests-qunit.html">QUnit tests</a></li>
+    <li><a href="/__zuul">Zuul tests</a></li>
     <li><a href="example-cursors.html">Cursors example</a></li>
     <li><a href="smoke-latency.html">Smoketest: latency</a></li>
     <li><a href="smoke-reconnect.html">Smoketest: reconnect</a></li>
diff --git a/tests/html/smoke-latency.html b/tests/html/smoke-latency.html
index 7733ccd..1f84f62 100644
--- a/tests/html/smoke-latency.html
+++ b/tests/html/smoke-latency.html
@@ -47,7 +47,7 @@
 
     var sjs;
     function onopen() {
-            log('connected ' + sjs.protocol);
+            log('connected ' + sjs.transport);
             send();
     };
     function onclose(e) {
@@ -70,12 +70,9 @@
     $('#connect').click(function() {
         $('#connect').attr('disabled', true);
         $('#disconnect').each(function(_,e){e.disabled='';});
-        var protocol = $('#transport').val() || undefined;
-        log('[connecting] ' + protocol);
-        options = jQuery.extend({}, client_opts.sockjs_opts)
-        options.protocols_whitelist = typeof protocol === 'string' ?
-                                                        [protocol] : protocol;
-        sjs = new SockJS(client_opts.url + '/echo', null, protocol);
+        var transport = $('#transport').val() || undefined;
+        log('[connecting] ' + transport);
+        sjs = new SockJS(clientOptions.url + '/echo', null, transport);
         sjs.onopen = onopen
         sjs.onclose = onclose;
         sjs.onmessage = xonmessage;
diff --git a/tests/html/smoke-reconnect.html b/tests/html/smoke-reconnect.html
index ae07cbf..bbe967b 100644
--- a/tests/html/smoke-reconnect.html
+++ b/tests/html/smoke-reconnect.html
@@ -46,7 +46,7 @@
     var started = false;
     var sjs;
     var i = 0;
-    var protocol;
+    var transport;
     var t0;
     function onopen() {
        var td = (new Date()).getTime() - t0;
@@ -57,14 +57,11 @@
     function onclose(e) {
         if (started && e.code === 1000) {
             t0 = (new Date()).getTime();
-            options = jQuery.extend({}, client_opts.sockjs_opts)
-            options.protocols_whitelist = typeof protocol === 'string' ?
-                                                            [protocol] : protocol;
-            sjs = new SockJS(client_opts.url + '/echo', null, options);
+            sjs = new SockJS(clientOptions.url + '/echo', null, transport);
             sjs.onopen = onopen
             sjs.onclose = onclose;
         } else {
-            log('[stopped] ' + e);
+            log('[stopped] ' + e.code + ', ' + e.reason);
             $('#connect').each(function(_,e){e.disabled='';});
             $('#disconnect').attr('disabled', true);
         }
@@ -72,8 +69,8 @@
 
     $('#connect').click(function() {
         started = true;
-        protocol = $('#transport').val() || undefined;
-        log('[starting] ' + protocol);
+        transport = $('#transport').val() || undefined;
+        log('[starting] ' + transport);
         onclose({code:1000});
         $('#connect').attr('disabled', true);
         $('#disconnect').each(function(_,e){e.disabled='';});
diff --git a/tests/html/sockjs-in-head.html b/tests/html/sockjs-in-head.html
index c8c851a..52f35a6 100644
--- a/tests/html/sockjs-in-head.html
+++ b/tests/html/sockjs-in-head.html
@@ -6,7 +6,7 @@
   <script>
     document.domain = document.domain;
   </script>
-  <script src="/lib/sockjs.js?no=cache"></script>
+  <script src="/__zuul/test-bundle.js?no=cache"></script>
   <script>
     c = parent._sockjs_global;
     window_id = document.location.hash.slice(1);
diff --git a/tests/html/static/qunit.css b/tests/html/static/qunit.css
deleted file mode 100644
index b3c6db5..0000000
--- a/tests/html/static/qunit.css
+++ /dev/null
@@ -1,225 +0,0 @@
-/**
- * QUnit - A JavaScript Unit Testing Framework
- *
- * http://docs.jquery.com/QUnit
- *
- * Copyright (c) 2011 John Resig, Jörn Zaefferer
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * or GPL (GPL-LICENSE.txt) licenses.
- */
-
-/** Font Family and Sizes */
-
-#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
-	font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
-}
-
-#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
-#qunit-tests { font-size: smaller; }
-
-
-/** Resets */
-
-#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult {
-	margin: 0;
-	padding: 0;
-}
-
-
-/** Header */
-
-#qunit-header {
-	padding: 0.5em 0 0.5em 1em;
-
-	color: #8699a4;
-	background-color: #0d3349;
-
-	font-size: 1.5em;
-	line-height: 1em;
-	font-weight: normal;
-
-	border-radius: 15px 15px 0 0;
-	-moz-border-radius: 15px 15px 0 0;
-	-webkit-border-top-right-radius: 15px;
-	-webkit-border-top-left-radius: 15px;
-}
-
-#qunit-header a {
-	text-decoration: none;
-	color: #c2ccd1;
-}
-
-#qunit-header a:hover,
-#qunit-header a:focus {
-	color: #fff;
-}
-
-#qunit-banner {
-	height: 5px;
-}
-
-#qunit-testrunner-toolbar {
-	padding: 0.5em 0 0.5em 2em;
-	color: #5E740B;
-	background-color: #eee;
-}
-
-#qunit-userAgent {
-	padding: 0.5em 0 0.5em 2.5em;
-	background-color: #2b81af;
-	color: #fff;
-	text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
-}
-
-
-/** Tests: Pass/Fail */
-
-#qunit-tests {
-	list-style-position: inside;
-}
-
-#qunit-tests li {
-	padding: 0.4em 0.5em 0.4em 2.5em;
-	border-bottom: 1px solid #fff;
-	list-style-position: inside;
-}
-
-#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running  {
-	display: none;
-}
-
-#qunit-tests li strong {
-	cursor: pointer;
-}
-
-#qunit-tests li a {
-	padding: 0.5em;
-	color: #c2ccd1;
-	text-decoration: none;
-}
-#qunit-tests li a:hover,
-#qunit-tests li a:focus {
-	color: #000;
-}
-
-#qunit-tests ol {
-	margin-top: 0.5em;
-	padding: 0.5em;
-
-	background-color: #fff;
-
-	border-radius: 15px;
-	-moz-border-radius: 15px;
-	-webkit-border-radius: 15px;
-
-	box-shadow: inset 0px 2px 13px #999;
-	-moz-box-shadow: inset 0px 2px 13px #999;
-	-webkit-box-shadow: inset 0px 2px 13px #999;
-}
-
-#qunit-tests table {
-	border-collapse: collapse;
-	margin-top: .2em;
-}
-
-#qunit-tests th {
-	text-align: right;
-	vertical-align: top;
-	padding: 0 .5em 0 0;
-}
-
-#qunit-tests td {
-	vertical-align: top;
-}
-
-#qunit-tests pre {
-	margin: 0;
-	white-space: pre-wrap;
-	word-wrap: break-word;
-}
-
-#qunit-tests del {
-	background-color: #e0f2be;
-	color: #374e0c;
-	text-decoration: none;
-}
-
-#qunit-tests ins {
-	background-color: #ffcaca;
-	color: #500;
-	text-decoration: none;
-}
-
-/*** Test Counts */
-
-#qunit-tests b.counts                       { color: black; }
-#qunit-tests b.passed                       { color: #5E740B; }
-#qunit-tests b.failed                       { color: #710909; }
-
-#qunit-tests li li {
-	margin: 0.5em;
-	padding: 0.4em 0.5em 0.4em 0.5em;
-	background-color: #fff;
-	border-bottom: none;
-	list-style-position: inside;
-}
-
-/*** Passing Styles */
-
-#qunit-tests li li.pass {
-	color: #5E740B;
-	background-color: #fff;
-	border-left: 26px solid #C6E746;
-}
-
-#qunit-tests .pass                          { color: #528CE0; background-color: #D2E0E6; }
-#qunit-tests .pass .test-name               { color: #366097; }
-
-#qunit-tests .pass .test-actual,
-#qunit-tests .pass .test-expected           { color: #999999; }
-
-#qunit-banner.qunit-pass                    { background-color: #C6E746; }
-
-/*** Failing Styles */
-
-#qunit-tests li li.fail {
-	color: #710909;
-	background-color: #fff;
-	border-left: 26px solid #EE5757;
-}
-
-#qunit-tests > li:last-child {
-	border-radius: 0 0 15px 15px;
-	-moz-border-radius: 0 0 15px 15px;
-	-webkit-border-bottom-right-radius: 15px;
-	-webkit-border-bottom-left-radius: 15px;
-}
-
-#qunit-tests .fail                          { color: #000000; background-color: #EE5757; }
-#qunit-tests .fail .test-name,
-#qunit-tests .fail .module-name             { color: #000000; }
-
-#qunit-tests .fail .test-actual             { color: #EE5757; }
-#qunit-tests .fail .test-expected           { color: green;   }
-
-#qunit-banner.qunit-fail                    { background-color: #EE5757; }
-
-
-/** Result */
-
-#qunit-testresult {
-	padding: 0.5em 0.5em 0.5em 2.5em;
-
-	color: #2b81af;
-	background-color: #D2E0E6;
-
-	border-bottom: 1px solid white;
-}
-
-/** Fixture */
-
-#qunit-fixture {
-	position: absolute;
-	top: -10000px;
-	left: -10000px;
-}
diff --git a/tests/html/static/qunit.min.js b/tests/html/static/qunit.min.js
deleted file mode 100644
index 9cf944a..0000000
--- a/tests/html/static/qunit.min.js
+++ /dev/null
@@ -1 +0,0 @@
-(function(a){function t(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=t(c.childNodes));return b}function s(a){return typeof document!="undefined"&&!!document&&!!document.getElementById&&document.getElementById(a)}function r(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):c()}function q(a,b){for(var c in b)b[c]===undefined?delete a[c]:a[c]=b[c];return a}function p(b,c,d){typeof console [...]
\ No newline at end of file
diff --git a/tests/html/tests-qunit.html b/tests/html/tests-qunit.html
deleted file mode 100644
index 870ae13..0000000
--- a/tests/html/tests-qunit.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
-  <meta charset="UTF-8" />
-  <script>
-    document.domain = document.domain;
-  </script>
-
-  <link href="data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAF0lEQVRIx2NgGAWjYBSMglEwCkbBSAcACBAAAeaR9cIAAAAASUVORK5CYII=" rel="icon" type="image/x-icon" />
-
-  <script type="text/javascript" src="lib/sockjs.js"></script>
-
-  <script type="text/javascript" src="static/jquery.min.js"></script>
-
-  <link rel="stylesheet" href="static/qunit.css" type="text/css" media="screen">
-  <script type="text/javascript" src="static/qunit.min.js"></script>
-
-  <script type="text/javascript" src="config.js"></script>
-  <script type="text/javascript" src="lib/alltestsbundle.js"></script>
-</head>
-<body>
-  <p>
-    <h1 id="qunit-header">SockJS Test Suite</h1>
-    <h2 id="qunit-banner"></h2>
-    <div id="qunit-testrunner-toolbar"></div>
-    <h2 id="qunit-userAgent"></h2>
-    <ol id="qunit-tests"></ol>
-    <div id="qunit-fixture">test markup</div>
-    </p>
-  <br>
-  <code id="logs" style="height:200px; overflow:auto; display: block; border: 1px gray solid;">
-  </code>
-
-<script>
-    function log(a, e) {
-            if ('console' in window && 'log' in window.console) {
-                console.log(a, e);
-            }
-            $('#logs').append($("<code>").text(a));
-            $('#logs').append($("<pre>").text(JSON.stringify(e, null, 4)));
-            $('#logs').append($("<br>"));
-            $('#logs').scrollTop($('#logs').scrollTop()+10000);
-      }
-      log('Running against:' + client_opts.url);
-</script>
-</body>
-</html>
diff --git a/tests/html/unittests.html b/tests/html/unittests.html
deleted file mode 100644
index 2448118..0000000
--- a/tests/html/unittests.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
-  <meta charset="UTF-8" />
-
-  <script type="text/javascript" src="lib/sockjs.js"></script>
-
-  <script type="text/javascript" src="static/jquery.min.js"></script>
-
-  <link rel="stylesheet" href="static/qunit.css" type="text/css" media="screen">
-  <script type="text/javascript" src="static/qunit.min.js"></script>
-
-  <script type="text/javascript" src="config.js"></script>
-  <script type="text/javascript" src="lib/unittests.js"></script>
-  <script type="text/javascript" src="lib/domtests.js"></script>
-</head>
-<body>
-  <p>
-    <h1 id="qunit-header">SockJS Unit Tests</h1>
-    <h2 id="qunit-banner"></h2>
-    <div id="qunit-testrunner-toolbar"></div>
-    <h2 id="qunit-userAgent"></h2>
-    <ol id="qunit-tests"></ol>
-    <div id="qunit-fixture">test markup</div>
-    </p>
-  <br>
-  <code id="logs" style="height:200px; overflow:auto; display: block; border: 1px gray solid;">
-  </code>
-
-<script>
-    function log(a, e) {
-            if ('console' in window && 'log' in window.console) {
-                console.log(a, e);
-            }
-            $('#logs').append($("<code>").text(a));
-            $('#logs').append($("<pre>").text(JSON.stringify(e, null, 4)));
-            $('#logs').append($("<br>"));
-            $('#logs').scrollTop($('#logs').scrollTop()+10000);
-      }
-</script>
-</body>
-</html>
diff --git a/tests/lib/iframe.js b/tests/lib/iframe.js
index d5aafca..4149887 100644
--- a/tests/lib/iframe.js
+++ b/tests/lib/iframe.js
@@ -1,9 +1,11 @@
-/* eslint quotes: 0 */
+/* eslint quotes: 0, camelcase: 0 */
 'use strict';
 
 var expect = require('expect.js')
   , eventUtils = require('../../lib/utils/event')
+  , transportList = require('../../lib/transport-list')
   , testUtils = require('./test-utils')
+  , echoTests = require('./echo-tests')
   , IframeTransport = require('../../lib/transport/iframe')
   ;
 
@@ -98,3 +100,16 @@ describe('iframe', function () {
     });
   });
 });
+
+describe('Transports', function () {
+  transportList.forEach(function (Trans) {
+    describe(Trans.transportName, function () {
+      if (!Trans.enabled(testUtils.getUrl('/echo'), { cookie_needed: false, nullOrigin: false })) {
+        return;
+      }
+
+      var transport = Trans.transportName;
+      echoTests.echoFromChild(transport);
+    });
+  });
+});
diff --git a/tests/lib/transports.js b/tests/lib/transports.js
index 2887b95..cd716c4 100644
--- a/tests/lib/transports.js
+++ b/tests/lib/transports.js
@@ -46,7 +46,6 @@ describe('Transports', function () {
       echoTests.echoLargeMessage(transport);
       echoTests.echoUtfEncodingSimple(transport);
       echoTests.echoUtfEncoding(transport);
-      echoTests.echoFromChild(transport);
 
       batchTests.largeMessage(transport);
       batchTests.largeDownload(transport);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git



More information about the Pkg-javascript-commits mailing list