history.t 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 => 37;
  18. # Make sure we can "Mark this page for deletion".
  19. AppendStringToFile($ConfigFile, "\$KeepDays = 14;\n");
  20. $page = get_page('action=history id=hist');
  21. test_page($page,
  22. 'No other revisions available',
  23. 'View current revision',
  24. 'View all changes');
  25. test_page_negative($page,
  26. 'View other revisions',
  27. 'Mark this page for deletion');
  28. test_page(update_page('hist', 'testing', 'test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary'),
  29. 'testing',
  30. 'action=history',
  31. 'View other revisions');
  32. test_page_negative(get_page('action=history id=hist'),
  33. 'Mark this page for deletion');
  34. $page = get_page('action=history id=hist username=me');
  35. test_page($page,
  36. 'test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary',
  37. 'View current revision',
  38. 'View all changes',
  39. 'current',
  40. 'Mark this page for deletion');
  41. test_page_negative($page,
  42. 'No other revisions available',
  43. 'View other revisions',
  44. 'value\="rollback"');
  45. test_page(update_page('hist', 'Tesla', 'Power'),
  46. 'Tesla',
  47. 'action=history',
  48. 'View other revisions');
  49. $page = get_page('action=history id=hist username=me');
  50. test_page($page,
  51. 'test summary',
  52. 'Power',
  53. 'View current revision',
  54. 'View all changes',
  55. 'current',
  56. 'value\="rollback"',
  57. 'name="rollback-\d+"',
  58. 'Mark this page for deletion');
  59. test_page_negative($page,
  60. 'Tesla',
  61. 'No other revisions available',
  62. 'View other revisions');
  63. xpath_test($page,
  64. '//table[@class="history"]/tr[position()=2]/td[position()=1]/input[@name="diffrevision"][@value="2"]',
  65. '//table[@class="history"]/tr[position()=2]/td[position()=2]/input[@name="revision"][@value=""][@checked="checked"]',
  66. '//table[@class="history"]/tr[position()=2]/td[position()=3]/a[text()="Revision 2"]',
  67. '//table[@class="history"]/tr[position()=3]/td[position()=1]/input[@name="diffrevision"][@value="1"][@checked="checked"]',
  68. '//table[@class="history"]/tr[position()=3]/td[position()=2]/input[@name="revision"][@value="1"]',
  69. '//table[@class="history"]/tr[position()=3]/td[position()=3]/a[text()="Revision 1"]');