Handle WebSocket events in IE when detecting Errors

- Fixes #1623
This commit is contained in:
Gregg Van Hove
2019-04-01 18:52:27 -07:00
parent 5c7e25e228
commit 618e24b2f8
2 changed files with 39 additions and 3 deletions

30
spec/core/baseSpec.js Normal file
View File

@@ -0,0 +1,30 @@
describe('base helpers', function() {
describe('isError_', function() {
fit("correctly handles WebSocket events", function(done) {
if (typeof jasmine.getGlobal().WebSocket === 'undefined') {
done();
return;
}
var obj = (function() {
var sock = new WebSocket('ws://localhost');
var event;
sock.onerror = function(e) {
event = e
};
return function() { return event };
})();
var left = 20;
var int = setInterval(function() {
if (obj() || left === 0) {
var result = jasmineUnderTest.isError_(obj());
expect(result).toBe(false);
done();
} else {
left--;
}
}, 100);
});
});
});