tables-long.t 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Copyright (C) 2006, 2007, 2008 Alex Schroeder <alex@gnu.org>
  2. #
  3. # This program is free software; you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation; either version 3 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. require './t/test.pl';
  16. package OddMuse;
  17. use Test::More tests => 23;
  18. add_module('tables-long.pl');
  19. test_page(update_page('2008-10-26', "<table a,b>\na=alex\nb=berta\na=one\nb=two"),
  20. '<th>alex</th>', '<th>berta</th>', '<td>one</td>', '<td>two</td>');
  21. test_page(update_page('Diary', "This is the land of the crab-men.\n\n<journal>"),
  22. 'This is the land of the crab-men.',
  23. '<th>alex</th>', '<th>berta</th>', '<td>one</td>', '<td>two</td>');
  24. run_tests(split('\n',<<'EOT'));
  25. <table a,b>\na=a\nb=b\na=one\nb=two
  26. <table class="user long"><tr class="first odd"><th>a</th><th>b</th></tr><tr class="even"><td>one</td><td>two</td></tr></table>
  27. <table a,b>\na=a\nb=b\na=one\nb=two\n----
  28. <table class="user long"><tr class="first odd"><th>a</th><th>b</th></tr><tr class="even"><td>one</td><td>two</td></tr></table>
  29. <table a,b>\na=a\nb=b\na=one\nb=two\n----\n\nDone.
  30. <table class="user long"><tr class="first odd"><th>a</th><th>b</th></tr><tr class="even"><td>one</td><td>two</td></tr></table><p>Done.</p>
  31. Here is a table:\n<table a,b>\na=a\nb=b\na=one\ntwo\nand a half\nb=three\na=foo\nb=bar\n----\n\nDone.\n<table foo,bar>\nfoo=test\nbar=test as well\nfoo=what we test\n----\nthe end.
  32. Here is a table: <table class="user long"><tr class="first odd"><th>a</th><th>b</th></tr><tr class="even"><td>one two and a half</td><td>three</td></tr><tr class="odd"><td>foo</td><td>bar</td></tr></table><p>Done. </p><table class="user long"><tr class="first odd"><th>test</th><th>test as well</th></tr><tr class="even"><td colspan="2">what we test</td></tr></table><p>the end.</p>
  33. <table a,b>\na=a\nb=b\na=one\nb/2=odd\na=three
  34. <table class="user long"><tr class="first odd"><th>a</th><th>b</th></tr><tr class="even"><td>one</td><td rowspan="2">odd</td></tr><tr class="odd"><td>three</td></tr></table>
  35. <table a,b,c>\na=a\nb=b\nc=c\na=one\nb/2=odd\nc=two\na=three\nc=four
  36. <table class="user long"><tr class="first odd"><th>a</th><th>b</th><th>c</th></tr><tr class="even"><td>one</td><td rowspan="2">odd</td><td>two</td></tr><tr class="odd"><td>three</td><td>four</td></tr></table>
  37. <table a,b,c>\na=a\nb=b\nc=c\na=one\nb=two\nc/2=numbers\na=three\n
  38. <table class="user long"><tr class="first odd"><th>a</th><th>b</th><th>c</th></tr><tr class="even"><td>one</td><td>two</td><td rowspan="2">numbers</td></tr><tr class="odd"><td colspan="2">three</td></tr></table>
  39. <table a, b, c>\na:0\nb:1\nc:00\n----\n
  40. <table class="user long"><tr class="first odd"><th>0</th><th>1</th><th>00</th></tr></table>
  41. EOT
  42. add_module('portrait-support.pl');
  43. xpath_test(update_page('portrait', "[new]\nparagraph\n<table a, b>\n"
  44. . "a: first heading\n" . "b: second heading\n"
  45. . "a: first cell\n" . "b: second cell\n"
  46. . "----\n"
  47. . "new paragraph"),
  48. '//p[text()=" paragraph "]',
  49. '//table/tr/th[text()="first heading"]',
  50. '//table/tr/th[text()="second heading"]',
  51. '//table/tr/td[text()="first cell"]',
  52. '//table/tr/td[text()="second cell"]',
  53. '//p[text()="new paragraph"]', );