From 0e80a90bebc12fe381892386f9ffd751edb38d7c Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 19 Dec 2019 09:23:21 +0000 Subject: Initial service worker. This basic service worker behaves identically to the existing appcache - some static scripts and CSS are cached, any HTML offline instead returns a static HTML page that knows how to show data on stored problems out of localStorage (stored there when /my/planned was visited online). Inspect form submissions will be captured and can be synced back when online. Once feature parity is established, we will then remove appcache, switch from using localStorage to the cache API, and hopefully move all offline support into the service worker. --- t/app/controller/offline.t | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 't/app/controller') diff --git a/t/app/controller/offline.t b/t/app/controller/offline.t index 505e605a0..d2a5009ec 100644 --- a/t/app/controller/offline.t +++ b/t/app/controller/offline.t @@ -33,4 +33,16 @@ FixMyStreet::override_config { }; }; +subtest 'service worker' => sub { + $mech->get_ok('/service-worker.js'); + $mech->content_contains('translation_strings'); + $mech->content_contains('offline/fallback'); +}; + +subtest 'offline fallback page' => sub { + $mech->get_ok('/offline/fallback'); + $mech->content_contains('Offline'); + $mech->content_contains('offline_list'); +}; + done_testing(); \ No newline at end of file -- cgit v1.2.3