ui: Ensure event sources are closed to the correct state when connecting (#6036)
This fails the tests, but wouldn't produce an actual bug as the source is still set to closing, just 1 tick later.
This commit is contained in:
parent
bcc9dbba45
commit
cb51f9674d
|
@ -68,10 +68,12 @@ export default function(
|
|||
close() {
|
||||
// additional readyState 3 = CLOSING
|
||||
switch (this.readyState) {
|
||||
case 0: // CONNECTING
|
||||
case 2: // CLOSED
|
||||
// it's already CLOSED , do nothing
|
||||
this.readyState = 2;
|
||||
break;
|
||||
default:
|
||||
// OPEN
|
||||
this.readyState = 3; // CLOSING
|
||||
}
|
||||
// non-standard
|
||||
|
|
|
@ -82,10 +82,11 @@ module('Integration | Utility | dom/event-source/callable', function(hooks) {
|
|||
});
|
||||
});
|
||||
test("it can be closed before the first tick, and therefore doesn't run", function(assert) {
|
||||
assert.expect(3);
|
||||
assert.expect(4);
|
||||
const EventSource = domEventSourceCallable(EventTarget);
|
||||
const listener = this.stub();
|
||||
const source = new EventSource();
|
||||
assert.equal(source.readyState, 0);
|
||||
source.close();
|
||||
assert.equal(source.readyState, 2);
|
||||
source.addEventListener('open', function(e) {
|
||||
|
|
Loading…
Reference in New Issue