Skip to content

Commit ea8649e

Browse files
Maximilian GrundkeMaximilian Grundke
authored andcommitted
Fix MockWebsocket readyState and flush
1 parent d6b89fb commit ea8649e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

angular-websocket-mock.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
$MockWebSocket.prototype.close = function () {
2424
pendingCloses.push(true);
2525
};
26+
27+
$MockWebSocket.prototype.readyState = 1;
2628

2729
function createWebSocketBackend(url, protocols) {
2830
pendingConnects.push(url);
@@ -57,7 +59,7 @@
5759
while (msg = pendingSends.shift()) {
5860
var j;
5961
sendQueue.forEach(function(pending, i) {
60-
if (pending.message === msg.message) {
62+
if (pending === msg) {
6163
j = i;
6264
}
6365
});

dist/angular-websocket-mock.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
$MockWebSocket.prototype.close = function () {
2424
pendingCloses.push(true);
2525
};
26+
27+
$MockWebSocket.prototype.readyState = 1;
2628

2729
function createWebSocketBackend(url, protocols) {
2830
pendingConnects.push(url);
@@ -57,7 +59,7 @@
5759
while (msg = pendingSends.shift()) {
5860
var j;
5961
sendQueue.forEach(function(pending, i) {
60-
if (pending.message === msg.message) {
62+
if (pending === msg) {
6163
j = i;
6264
}
6365
});

0 commit comments

Comments
 (0)