allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jetm...@apache.org
Subject [1/7] allura git commit: [#4771] ticket:635 Add test for TOC for included pages
Date Thu, 20 Nov 2014 14:17:26 GMT
Repository: allura
Updated Branches:
  refs/heads/ib/4771a [created] 6161408b8


[#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/9fdeff0f
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/9fdeff0f
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/9fdeff0f

Branch: refs/heads/ib/4771a
Commit: 9fdeff0fac24cce9e54f4085732661c422cd998b
Parents: f66f754
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Wed Aug 20 13:00:12 2014 +0300
Committer: Igor Bondarenko <jetmind2@gmail.com>
Committed: Thu Nov 20 10:48:36 2014 +0000

----------------------------------------------------------------------
 Allura/allura/tests/test_globals.py | 44 ++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/9fdeff0f/Allura/allura/tests/test_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index dd4e7e6..e5f877c 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]]')


Mime
View raw message