Browse Source

Add test for extending theme template

index-subcmd
Vincent Prouillet 7 years ago
parent
commit
e1ee6b9dc4
3 changed files with 17 additions and 7 deletions
  1. +4
    -7
      components/site/test_site/templates/category.html
  2. +11
    -0
      components/site/test_site/themes/sample/templates/category.html
  3. +2
    -0
      components/site/tests/site.rs

+ 4
- 7
components/site/test_site/templates/category.html View File

@@ -1,8 +1,5 @@
Category: {{ category.name }}
{% extends "sample/templates/category.html" %}


{% for page in category.pages %}
<article>
<h3 class="post__title"><a href="{{ page.permalink }}">{{ page.title }}</a></h3>
</article>
{% endfor %}
{% block extra_category %}
EXTENDED
{% endblock extra_category %}

+ 11
- 0
components/site/test_site/themes/sample/templates/category.html View File

@@ -0,0 +1,11 @@
Category: {{ category.name }}


{% for page in category.pages %}
<article>
<h3 class="post__title"><a href="{{ page.permalink }}">{{ page.title }}</a></h3>
</article>
{% endfor %}

{% block extra_category %}
{% endblock extra_category %}

+ 2
- 0
components/site/tests/site.rs View File

@@ -223,6 +223,8 @@ fn can_build_site_with_categories() {
assert!(file_exists!(public, "categories/index.html"));
assert!(file_exists!(public, "categories/a/index.html"));
assert!(file_exists!(public, "categories/b/index.html"));
// Extending from a theme works
assert!(file_contains!(public, "categories/a/index.html", "EXTENDED"));
// Tags aren't
assert_eq!(file_exists!(public, "tags/index.html"), false);



Loading…
Cancel
Save