diff --git a/layouts/index.html b/layouts/index.html index 94b5615..d78c2f9 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -46,7 +46,7 @@

Setup

- {{ .Params.summary | default .Summary | truncate .Site.Params.summary_length_long "..." }} + {{ .Params.summary | default .Summary | truncate .Site.Params.summary_length_long "..." }}

{{ end }} @@ -58,7 +58,7 @@ -
+

Projects

{{ range first .Site.Params.index_items (where .Data.Pages.ByDate "Section" "projects") }} @@ -68,7 +68,7 @@

All Projects

-
+

Recent Posts

{{ range first .Site.Params.index_items (where .Data.Pages.ByDate "Section" "!=" "") }} diff --git a/tests/tests_pages.py b/tests/tests_pages.py new file mode 100644 index 0000000..e40da75 --- /dev/null +++ b/tests/tests_pages.py @@ -0,0 +1,17 @@ +from tests import TestCase + + +class IndexPageTestCase(TestCase): + def test_index_sections(self): + for section in ['projects', 'recent-posts']: + content = self.client.get('index.html') + rows = content.find('div', id=section).find_all('div', class_='row') + self.assertLessEqual(len(rows), self.settings['params']['index_items']) + self.assertGreater(self.settings['params']['index_items'], 0) + for row in rows: + self.assertIsNotNone(row.find('section', class_='box')) + self.assertTrue(self.client.exists(row.find('a').attrs['href'])) + self.assertNotEqual(self.get_children(row.find('p')), '') + self.assertLessEqual(len(self.get_children(row.find('p'))), self.settings['params']['summary_length']) + self.assertNotEqual(self.get_children(row.find('h3')), '') +