1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
1 # copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
3 # |
3 # |
4 # This file is part of CubicWeb. |
4 # This file is part of CubicWeb. |
5 # |
5 # |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
27 f2 = req.create_entity('Folder', name=u'chi&ld') |
27 f2 = req.create_entity('Folder', name=u'chi&ld') |
28 req.cnx.execute('SET F2 filed_under F1 WHERE F1 eid %(f1)s, F2 eid %(f2)s', |
28 req.cnx.execute('SET F2 filed_under F1 WHERE F1 eid %(f1)s, F2 eid %(f2)s', |
29 {'f1' : f1.eid, 'f2' : f2.eid}) |
29 {'f1' : f1.eid, 'f2' : f2.eid}) |
30 req.cnx.commit() |
30 req.cnx.commit() |
31 self.assertEqual(f2.view('breadcrumbs'), |
31 self.assertEqual(f2.view('breadcrumbs'), |
32 '<a href="http://testing.fr/cubicweb/folder/%s" title="">chi&ld</a>' % f2.eid) |
32 '<a href="http://testing.fr/cubicweb/folder/%s" title="">' |
|
33 'chi&ld</a>' % f2.eid) |
33 childrset = f2.as_rset() |
34 childrset = f2.as_rset() |
34 ibc = self.vreg['ctxcomponents'].select('breadcrumbs', req, rset=childrset) |
35 ibc = self.vreg['ctxcomponents'].select('breadcrumbs', req, rset=childrset) |
35 l = [] |
36 l = [] |
36 ibc.render(l.append) |
37 ibc.render(l.append) |
37 self.assertEqual(''.join(l), |
38 self.assertMultiLineEqual('<span id="breadcrumbs" class="pathbar"> > ' |
38 """<span id="breadcrumbs" class="pathbar"> > <a href="http://testing.fr/cubicweb/Folder">Folder_plural</a> > <a href="http://testing.fr/cubicweb/folder/%s" title="">par&ent</a> >  |
39 '<a href="http://testing.fr/cubicweb/Folder">Folder_plural</a>' |
39 <a href="http://testing.fr/cubicweb/folder/%s" title="">chi&ld</a></span>""" % (f1.eid, f2.eid)) |
40 ' > <a href="http://testing.fr/cubicweb/folder/%s" ' |
|
41 'title="">par&ent</a> > \n' |
|
42 '<a href="http://testing.fr/cubicweb/folder/%s" title="">' |
|
43 'chi&ld</a></span>' % (f1.eid, f2.eid), |
|
44 ''.join(l)) |
40 |
45 |
41 if __name__ == '__main__': |
46 if __name__ == '__main__': |
42 from logilab.common.testlib import unittest_main |
47 from logilab.common.testlib import unittest_main |
43 unittest_main() |
48 unittest_main() |