class TestActList
Public Instance Methods
ok_time(e, n)
click to toggle source
# File vendor/qwik/lib/qwik/act-pagelist.rb, line 233 def ok_time(e, n) eq e, @action.int_to_time(n) end
test_all()
click to toggle source
# File vendor/qwik/lib/qwik/act-list.rb, line 231 def test_all c = Qwik::Action eq([[:ul, 1, "a"]], Qwik::TextTokenizer.tokenize("-a")) eq([[:ul, 2, "a"]], Qwik::TextTokenizer.tokenize("--a")) eq([[:ul, 1, "a"], [:ul, 1, "b"]], Qwik::TextTokenizer.tokenize("-a\n-b")) # test_tokens_to_s eq("- a\n", c.tokens_to_s([[:ul, 1, "a"]])) eq("-- a\n", c.tokens_to_s([[:ul, 2, "a"]])) eq("- a\n- b\n", c.tokens_to_s([[:ul, 1, "a"], [:ul, 1, "b"]])) # test_list_edit eq("- b\n", c.list_edit('-a', 1, 'b')) eq("- c\n- b\n", c.list_edit("-a\n-b", 1, 'c')) eq("- a\n- c\n", c.list_edit("-a\n-b", 2, 'c')) # test_parse_list eq([1, 3, 2], c.parse_list(["1_1", "1_3", "1_2"])) # test_list_arrange eq("- a\n- b\n", c.list_arrange("-a\n-b", [1, 2])) eq("- b\n- a\n", c.list_arrange("-a\n-b", [2, 1])) end
test_all2()
click to toggle source
# File vendor/qwik/lib/qwik/act-list.rb, line 257 def test_all2 t_add_user =begin # test_plg_list ok_wi([:div, {:class=>"list"}, [:form, {:method=>"POST", :action=>""}, [[:ul, [:li, "a"]]], [:div, {:class=>"submit"}, [:input, {:value=>"Update", :type=>"submit"}]]]], "{{list - A - B - C }}") =end page = @site.create_new page.store("{{list - a - b }} ") res = session("POST /test/1.1.1.list_edit?value=c") eq("{{list\n- c\n- b\n}}\n", page.load) res = session("POST /test/1.1.2.list_edit?value=d") eq("{{list\n- c\n- d\n}}\n", page.load) end
test_recent_list()
click to toggle source
# File vendor/qwik/lib/qwik/act-pagelist.rb, line 189 def test_recent_list t_add_user res = session('/test/.recent') ok_title('Recent Changes') ok_wi(/<h3>/, "{{recent_list}}") ok_wi(%r|<li><a href=\"1.html\">1</a></li>|, "{{recent}}") ok_wi(/<h3>/, "{{recent_list(1)}}") end
test_srecent()
click to toggle source
# File vendor/qwik/lib/qwik/act-pagelist.rb, line 198 def test_srecent t_add_user # test with no pages. ok_wi [:div, {:class=>"recent"}, [:ul, []]], "{{srecent}}" # test with a page. page = @site["1"] page.put_with_time("* t1", 1) @action.pagelist_update ok_wi [:div, {:class=>"recent"}, [:ul, [[:li, [:a, {:href=>"1.html", :title=>"1970-01-01 09:00:01"}, "t1"], " ", [:span, {:class=>"ago"}, "-1sec. ago"]]]]], "{{srecent}}" # test with two pages. page = @site.create("2") page.put_with_time("* t2", 2) @action.pagelist_update =begin ok_wi [:div, {:class=>"recent"}, [:ul, [[:li, [:a, {:href=>"1.html", :title=>"2009-09-04 10:16:25"}, "1"], " ", [:span, {:class=>"ago"}, "-1252026985sec. ago"]], [:li, [:a, {:href=>"2.html", :title=>"1970-01-01 09:00:02"}, "t2"], " ", [:span, {:class=>"ago"}, "-2sec. ago"]]]]], "{{srecent}}" =end end
test_time()
click to toggle source
# File vendor/qwik/lib/qwik/act-pagelist.rb, line 237 def test_time res = session ok_time '1sec.', 1 ok_time '1min.', 60 ok_time '1hour', 60*60 ok_time '1day', 60*60*24 ok_time '1month', 60*60*24*30 ok_time '1year', 60*60*24*365 ok_time '1century', 60*60*24*365*100 end
test_title_list()
click to toggle source
# File vendor/qwik/lib/qwik/act-pagelist.rb, line 181 def test_title_list t_add_user res = session('/test/.list') ok_title('Page List') ok_wi(/<ul><li>/, "{{title_list}}") ok_wi(%r| : <a href="1.html">1</a></li>|, "{{title_list}}") end