pwa: ship manifest.json template (#29465)
This commit is contained in:
parent
d105651452
commit
257d596042
|
@ -0,0 +1,23 @@
|
|||
{% load static %}{
|
||||
"name": "{% firstof global_title "Compte Citoyen" %}",
|
||||
"short_name": "{% firstof global_title "Compte Citoyen" %}",
|
||||
"start_url": "{% firstof pwa_start_url "/" %}",
|
||||
{% if theme_color %}
|
||||
"background_color": "{{ theme_color }}",
|
||||
"theme_color": "{{ theme_color }}",
|
||||
{% endif %}
|
||||
{% block icons %}
|
||||
"icons": [
|
||||
{% for icon_size in icon_sizes %}
|
||||
{
|
||||
"sizes": "{{ icon_size }}x{{ icon_size }}",
|
||||
"src": "{{ site_base }}{% static "" %}{{ css_variant }}/{{ icon_prefix }}{{ icon_size }}px.png",
|
||||
"type": "image/png"
|
||||
}{% if not forloop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
],
|
||||
{% endblock %}
|
||||
{% block extra %}
|
||||
{% endblock %}
|
||||
"display": "{% firstof pwa_display "browser" %}"
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"name": "test"
|
||||
}
|
|
@ -26,12 +26,9 @@ pytestmark = pytest.mark.django_db
|
|||
|
||||
|
||||
def test_manifest_json(app):
|
||||
app.get('/manifest.json', status=404)
|
||||
|
||||
templates_settings = [settings.TEMPLATES[0].copy()]
|
||||
templates_settings[0]['DIRS'] = ['%s/templates-1' % os.path.abspath(os.path.dirname(__file__))]
|
||||
with override_settings(TEMPLATES=templates_settings):
|
||||
assert app.get('/manifest.json', status=200).json['name'] == 'test'
|
||||
assert app.get('/manifest.json', status=200).json['name'] == 'Compte Citoyen'
|
||||
with override_settings(TEMPLATE_VARS={'global_title': 'FooBar'}):
|
||||
assert app.get('/manifest.json', status=200).json['name'] == 'FooBar'
|
||||
|
||||
def test_service_worker(app):
|
||||
app.get('/service-worker.js', status=200)
|
||||
|
|
Loading…
Reference in New Issue