From e1ee6b9dc40c13fd751201a323ecca35244cc021 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Wed, 30 Aug 2017 22:11:17 +0900 Subject: [PATCH] Add test for extending theme template --- components/site/test_site/templates/category.html | 11 ++++------- .../test_site/themes/sample/templates/category.html | 11 +++++++++++ components/site/tests/site.rs | 2 ++ 3 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 components/site/test_site/themes/sample/templates/category.html diff --git a/components/site/test_site/templates/category.html b/components/site/test_site/templates/category.html index 842f6e2..f790431 100644 --- a/components/site/test_site/templates/category.html +++ b/components/site/test_site/templates/category.html @@ -1,8 +1,5 @@ -Category: {{ category.name }} +{% extends "sample/templates/category.html" %} - -{% for page in category.pages %} -
-

{{ page.title }}

-
-{% endfor %} +{% block extra_category %} +EXTENDED +{% endblock extra_category %} diff --git a/components/site/test_site/themes/sample/templates/category.html b/components/site/test_site/themes/sample/templates/category.html new file mode 100644 index 0000000..7a016ae --- /dev/null +++ b/components/site/test_site/themes/sample/templates/category.html @@ -0,0 +1,11 @@ +Category: {{ category.name }} + + +{% for page in category.pages %} +
+

{{ page.title }}

+
+{% endfor %} + +{% block extra_category %} +{% endblock extra_category %} diff --git a/components/site/tests/site.rs b/components/site/tests/site.rs index bf1d4e2..659304b 100644 --- a/components/site/tests/site.rs +++ b/components/site/tests/site.rs @@ -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);