Skip to content

Commit

Permalink
Merge pull request #7 from Yaffle/master
Browse files Browse the repository at this point in the history
new test for "Once the end of the file is reached, any pending data must be discarded. (If the file ends in the middle of an event, before the final empty line, the incomplete event is not dispatched.)"
  • Loading branch information
odinho committed Mar 20, 2013
2 parents c77e9d2 + a34a236 commit 623e18d
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions format-data-before-final-empty-line.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!doctype html>
<html>
<head>
<title>EventSource: a data before final empty line</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
<script>
var test = async_test()
test.step(function() {
var source = new EventSource("resources/message.php?newline=none&message=" + encodeURIComponent("retry:1000\ndata:test1\n\nid:test\ndata:test2"))
var count = 0;
source.onmessage = function(e) {
if (++count === 2) {
test.step(function() {
assert_equals(e.lastEventId, "", "lastEventId")
assert_equals(e.data, "test1", "data")
source.close()
})
test.done()
}
}
})
</script>
</body>
</html>

0 comments on commit 623e18d

Please # to comment.