Tests for online / offline events shall be written. The Browser state shall be utilized for this:
http://www.w3.org/TR/html5/offline.html#browser-state
To be kept in mind: Offline is not shutting down an internet connection on the device, but loosing the network connection due to coverage.