You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The "close" event on an IDBDatabase only fires when the database closes for an abnormal reason, as described in the spec. (An abnormal reason would be something like the user clearing their browser data while the IDB connection is open.)
For unit testing, it would be neat if fakeIndexedDB had an API for simulating this abnormal close event. Presumably it would just be a matter of running db.close() plus firing an event. (I would do this in userland, but it seems that fakeIndexedDB throws an error if you try to call db.dispatchEvent(new CustomEvent('close')).
The text was updated successfully, but these errors were encountered:
And yeah @nolanlawson I ran into this when trying to do the perfectly reasonable task of writing tests to handle the DB closing when asking for a new transaction.
The
"close"
event on an IDBDatabase only fires when the database closes for an abnormal reason, as described in the spec. (An abnormal reason would be something like the user clearing their browser data while the IDB connection is open.)For unit testing, it would be neat if fakeIndexedDB had an API for simulating this abnormal close event. Presumably it would just be a matter of running
db.close()
plus firing an event. (I would do this in userland, but it seems that fakeIndexedDB throws an error if you try to calldb.dispatchEvent(new CustomEvent('close'))
.The text was updated successfully, but these errors were encountered: