aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/offline.t
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-12-17 17:16:42 +0000
committerMatthew Somerville <matthew@mysociety.org>2020-02-14 10:38:26 +0000
commit43290e5f733b4e88c6b4e5467b7e446a416a4682 (patch)
tree7755afdfee2df3a16e2482ccead7e2af3629c062 /t/app/controller/offline.t
parent7a40c15ea58b9475b40171f50a896fb79b470a94 (diff)
A basic web manifest starter.
Reads information from a theme object if present, and icons from a theme directory, with fallbacks.
Diffstat (limited to 't/app/controller/offline.t')
-rw-r--r--t/app/controller/offline.t36
1 files changed, 36 insertions, 0 deletions
diff --git a/t/app/controller/offline.t b/t/app/controller/offline.t
new file mode 100644
index 000000000..505e605a0
--- /dev/null
+++ b/t/app/controller/offline.t
@@ -0,0 +1,36 @@
+use FixMyStreet::TestMech;
+use Path::Tiny;
+
+my $mech = FixMyStreet::TestMech->new;
+
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => 'test'
+}, sub {
+ my $theme_dir = path(FixMyStreet->path_to('web/theme/test'));
+ $theme_dir->mkpath;
+ my $image_path = path('t/app/controller/sample.jpg');
+ $image_path->copy($theme_dir->child('sample.jpg'));
+ subtest 'manifest' => sub {
+ my $j = $mech->get_ok_json('/.well-known/manifest.webmanifest');
+ is $j->{name}, 'FixMyStreet', 'correct name';
+ is $j->{theme_color}, '#ffd000', 'correct theme colour';
+ is_deeply $j->{icons}[0], {
+ type => 'image/jpeg',
+ src => '/theme/test/sample.jpg',
+ sizes => '133x100'
+ }, 'correct icon';
+ };
+ $theme_dir->remove_tree;
+};
+
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => 'fixmystreet'
+}, sub {
+ subtest '.com manifest' => sub {
+ my $j = $mech->get_ok_json('/.well-known/manifest.webmanifest');
+ is $j->{related_applications}[0]{platform}, 'play', 'correct app';
+ is $j->{icons}[0]{sizes}, '192x192', 'correct fallback size';
+ };
+};
+
+done_testing(); \ No newline at end of file