Add test for extending theme template

This commit is contained in:
Vincent Prouillet 2017-08-30 22:11:17 +09:00
parent edc3fd2295
commit e1ee6b9dc4
3 changed files with 17 additions and 7 deletions

View file

@ -1,8 +1,5 @@
Category: {{ category.name }} {% extends "sample/templates/category.html" %}
{% block extra_category %}
{% for page in category.pages %} EXTENDED
<article> {% endblock extra_category %}
<h3 class="post__title"><a href="{{ page.permalink }}">{{ page.title }}</a></h3>
</article>
{% endfor %}

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 %}

View file

@ -223,6 +223,8 @@ fn can_build_site_with_categories() {
assert!(file_exists!(public, "categories/index.html")); assert!(file_exists!(public, "categories/index.html"));
assert!(file_exists!(public, "categories/a/index.html")); assert!(file_exists!(public, "categories/a/index.html"));
assert!(file_exists!(public, "categories/b/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 // Tags aren't
assert_eq!(file_exists!(public, "tags/index.html"), false); assert_eq!(file_exists!(public, "tags/index.html"), false);