You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2014/10/30 12:20:53 UTC
[03/11] git commit: [#4771] ticket:635 Add test for TOC for included
pages
[#4771] ticket:635 Add test for TOC for included pages
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/26b7fd60
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/26b7fd60
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/26b7fd60
Branch: refs/heads/ib/4771
Commit: 26b7fd606753bdfdfcea6216ab6e262c1331272d
Parents: 625e2b6
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed Aug 20 13:00:12 2014 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Thu Oct 30 09:44:22 2014 +0000
----------------------------------------------------------------------
Allura/allura/tests/test_globals.py | 44 ++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/26b7fd60/Allura/allura/tests/test_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index 5dc0e43..d6ccfe1 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -488,6 +488,50 @@ def test_macro_include():
assert 'href="..' not in g.markdown.convert('[My foo](./foo)')
+@td.with_wiki
+def test_toc_generation_for_included_page():
+ parent_text = u'''
+[TOC]
+
+#heading in original page
+
+Sample text
+
+#another in original page
+
+More sample text
+
+[[include ref=included]]
+'''
+ included_text = u'''
+#heading for included page
+
+Sample
+
+#another heading for included page
+
+More text
+'''
+ p_nbhd = M.Neighborhood.query.get(name='Projects')
+ p_test = M.Project.query.get(shortname='test', neighborhood_id=p_nbhd._id)
+ wiki = p_test.app_instance('wiki')
+ with h.push_context(p_test._id, app_config_id=wiki.config._id):
+ p = WM.Page.upsert(title='included')
+ p.text = included_text
+ p.commit()
+ ThreadLocalORMSession.flush_all()
+
+ result = g.markdown.convert(parent_text)
+ assert_in(u'<li><a href="#heading-in-original-page">'
+ u'heading in original page</a></li>', result)
+ assert_in(u'<li><a href="#another-in-original-page">'
+ u'another in original page</a></li>', result)
+ assert_in(u'<li><a href="#heading-for-included-page">'
+ u'heading for included page</a></li>', result)
+ assert_in(u'<li><a href="#another-heading-for-included-page">'
+ u'another heading for included page</a></li>', result)
+
+
def test_macro_nbhd_feeds():
with h.push_context('--init--', 'wiki', neighborhood='Projects'):
r = g.markdown_wiki.convert('[[neighborhood_feeds tool_name=wiki]]')