Permalink
Browse files

Unit test for closing SSE sources

  • Loading branch information...
1 parent c11f001 commit f0b741357c080cc2879ecc3d12e1e46acb91cceb @carsongross carsongross committed Nov 22, 2016
Showing with 45 additions and 3 deletions.
  1. +22 −1 test/unit_tests.html
  2. +1 −1 www/release/intercooler-1.0.3.min.js
  3. +22 −1 www/release/unit-tests-1.0.3.html
View
@@ -139,6 +139,9 @@
var handlers = eventHandlers[event] || [];
handlers.push(func);
eventHandlers[event] = handlers;
+ },
+ close : function () {
+ that.closed = true;
}
};
return that;
@@ -1986,7 +1989,6 @@
<div id='sse-4' ic-sse-src="/foo">
<span id='sse-4-inner' ic-get-from="/sse_triggered_req" ic-trigger-on="sse:foo"></span>
</div>
-
<script>
intercoolerTest("Server Sent Event Source Works As A Trigger", function(assert) {
$.mockjax({
@@ -2002,6 +2004,25 @@
});
</script>
+ <div id='sse-5' ic-get-from="/sse5" >
+ <span ic-sse-src="/foo" id='sse-5-inner'></span>
+ </div>
+ <script>
+ var closedMockSource = null;
+ intercoolerTest("Server Sent Events Sources are closed when element is swapped out", function(assert) {
+ $.mockjax({
+ url: "/sse5",
+ responseText: "foo"
+ });
+ closedMockSource = $("#sse-5-inner").data("ic-event-sse-source");
+ $("#sse-5").click();
+ assert.ok(closedMockSource.closed != true);
+ },
+ function(assert) {
+ assert.ok(closedMockSource.closed);
+ });
+ </script>
+
</div>
</body>
</html>
Oops, something went wrong.

0 comments on commit f0b7413

Please sign in to comment.