From 8078e69430f922f8a53b96e9442c5599b8eb3684 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sat, 11 Feb 2017 16:16:11 +0000 Subject: [PATCH] Add tests for about page --- tests/tests_pages.py | 26 ++++++++++++++------------ theme/static/src/js/app.js | 14 +++----------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/tests/tests_pages.py b/tests/tests_pages.py index 2afd2ae..0838656 100644 --- a/tests/tests_pages.py +++ b/tests/tests_pages.py @@ -1,5 +1,6 @@ from tests import TestCase from config import social as social_settings +import pelicanconf as settings import os.path @@ -47,18 +48,6 @@ class AboutPageTestCase(TestCase): self.assertHeaderTitle(content, 'About') self.assertTitle(content, 'About') - def test_website_section(self): - content = self.client.get('about/index.html') - section = content.find('section', id='website') - subtitle = section.find('h2') - self.assertEqual('Website', self.get_children(subtitle)) - - def test_server_section(self): - content = self.client.get('about/index.html') - section = content.find('section', id='server') - subtitle = section.find('h2') - self.assertEqual('Server', self.get_children(subtitle)) - def test_github_card(self): content = self.client.get('about/index.html') tags = content.find_all('div', class_='github-card') @@ -67,6 +56,19 @@ class AboutPageTestCase(TestCase): self.assertEqual('medium', tag.attrs['data-theme']) self.assertEqual(social_settings['accounts']['github'][1], tag.attrs['data-github']) + def test_accounts(self): + content = self.client.get('about/index.html') + accounts = content.find_all('div', class_='account') + defined_accounts = [s for k, s in settings.ACCOUNTS.items()] + self.assertEqual(len(accounts), len(defined_accounts)) + site_names = [s['site'] for s in defined_accounts] + urls = [s['url'] for s in defined_accounts] + icons = [s['icon'] for s in defined_accounts] + for account in accounts: + self.assertIn(account.find('a').attrs['href'], urls) + self.assertIn(account.find('i').attrs['class'][-1], icons) + self.assertIn(self.get_children(account.find('h3')), site_names) + class Page404TestCase(TestCase): def test_title(self): diff --git a/theme/static/src/js/app.js b/theme/static/src/js/app.js index 9fb7c30..3b86b80 100644 --- a/theme/static/src/js/app.js +++ b/theme/static/src/js/app.js @@ -31,21 +31,13 @@ $('.navbar-brand').bind('click', function (event) { event.preventDefault(); }); -$('.panel-heading').bind('click', function () { - var ele = $(this); - if (ele.find('.panel-body').hasClass('ascii-hidden')) { - ele = ele.find('.panel-body'); - var raw_code = ele.text().split(' '); - - } -}); $('.protected-mailto').bind('click', function (evt) { evt.preventDefault(); var char_codes = $(this).data('value').split(' '); - var plain_text = [] - for(var i=0; i