class TestActNewWithEmbed
Public Instance Methods
test_embeded_new()
click to toggle source
# File vendor/qwik/lib/qwik/act-new.rb, line 178 def test_embeded_new t_add_user page = @site['FrontPage'] page.store("[[FirstPage]]") # See FrontPage res = session('/test/') ok_title('FrontPage') ok_in([:span, {:class=>'new'}, 'FirstPage', [:a, {:href=>".new?t=FirstPage"}, [:img, {:src=>'.theme/i/new.png', :alt=>'create'}]]], "//div[@class='section']/p") # To confirm res = session("/test/.new?t=FirstPage") ok_title('New page') ok_in(['New page'], 'h1') ok_in(['Confirm'], 'h2') assert_attr({:action=>'.new', :method=>'POST'}, 'form') ok_xp([:input, {:value=>'FirstPage', :class=>'focus', :name=>'t'}], '//input') ok_xp([:input, {:value=>'New page', :type=>'submit'}], "//input[2]") # Create a new page. res = session("POST /test/.new?t=FirstPage") ok_in(['Edit new page'], "//div[@class='section']//a") ok_xp([:a, {:href=>'FirstPage.edit'}, 'Edit new page'], "//div[@class='section']//a") # Check the new page ok_eq("* FirstPage\n", @site['FirstPage'].load) # Try to create with the same key. res = session("/test/.new?t=FirstPage") ok_in(['Already exists'], '//h2') ok_xp([:a, {:href=>'FirstPage.html'}, [:strong, 'FirstPage']], "//div[@class='section']/a") # Try to create with the same key. res = session("POST /test/.new?t=FirstPage") ok_in(['Already exists'], '//h2') ok_xp([:a, {:href=>'FirstPage.html'}, [:strong, 'FirstPage']], "//div[@class='section']/a") end
test_embeded_new_with_japanese_name()
click to toggle source
# File vendor/qwik/lib/qwik/act-new.rb, line 329 def test_embeded_new_with_japanese_name t_add_user page = @site['FrontPage'] page.store("[[最初のページ]]") ok_eq('FrontPage', page.get_title) # See a page res = session('/test/') ok_in(["最初のページ", [:a, {:href=>".new?t=%8D%C5%8F%89%82%CC%83y%81%5B%83W"}, [:img, {:src=>'.theme/i/new.png', :alt=>'create'}]]], "//span[@class='new']") # Please input corresponding page key res = session("/test/.new?t=最初のページ") ok_in(['New page'], 'h1') ok_in(['Confirm'], 'h2') assert_attr({:action=>'.new', :method=>'POST'}, 'form') ok_xp([:input, {:value=>"最初のページ", :class=>'focus', :name=>'t'}], '//input') ok_xp([:input, {:value=>'New page', :type=>'submit'}], "//input[2]") # POST res = session("POST /test/.new?t=最初のページ") ok_in(['New page'], 'h1') ok_in(['Edit new page'], "//div[@class='section']//a") ok_xp([:a, {:href=>'1.edit'}, 'Edit new page'], "//div[@class='section']//a") # Check the new page. ok_eq("* 最初のページ\n", @site['1'].load) page = @site.get_by_title("最初のページ") ok_eq('1', page.key) # Check title. page = @site['1'] ok_eq("最初のページ", page.get_title) ok_eq('1', @site.get_by_title("最初のページ").key.to_s) ok_eq(false, @site.exist?("最初のページ")) ok_eq(true, @site.exist?('1')) # Check the source page. res = session('/test/') ok_in(["最初のページ"], "//div[@class='section']//a") ok_xp([:a, {:href=>'1.html'}, "最初のページ"], "//div[@class='section']//a") ok_eq("[[最初のページ]]", @site['FrontPage'].load) # Try to create with the same key. res = session("/test/.new?t=最初のページ") # Try to create with the same key. res = session("POST /test/.new?t=最初のページ") ok_in(['Already exists'], '//h2') # Let's create a page again. At the first, embed the title. page = @site['FrontPage'] page.store("[[二頁]]") # See the page res = session('/test/') ok_in(["二頁", [:a, {:href=>".new?t=%93%F1%95%C5"}, [:img, {:src=>'.theme/i/new.png', :alt=>'create'}]]], "//div[@class='section']//span") # please input a corresponding page key res = session("/test/.new?t=二頁") ok_xp([:input, {:value=>"二頁", :class=>'focus', :name=>'t'}], '//input') # try again res = session("POST /test/.new?t=二頁") ok_in(['Edit new page'], "//div[@class='section']//a") ok_xp([:a, {:href=>'2.edit'}, 'Edit new page'], "//div[@class='section']//a") page = @site['2'] ok_eq("* 二頁\n", page.load) # check the source page again res = session('/test/') ok_in(["二頁"], "//div[@class='section']//a") ok_xp([:a, {:href=>'2.html'}, "二頁"], "//div[@class='section']//a") ok_eq("[[二頁]]", @site['FrontPage'].load) end
test_embeded_new_with_space()
click to toggle source
# File vendor/qwik/lib/qwik/act-new.rb, line 224 def test_embeded_new_with_space t_add_user page = @site['FrontPage'] page.store("[[First Page]]") ok_eq('FrontPage', page.get_title) # see a page res = session('/test/') ok_in(['First Page', [:a, {:href=>".new?t=First+Page"}, [:img, {:src=>'.theme/i/new.png', :alt=>'create'}]]], "//span[@class='new']") # Please input corresponding page key res = session("/test/.new?t=First+Page") ok_in(['New page'], 'h1') ok_in(['Confirm'], 'h2') assert_attr({:action=>'.new', :method=>'POST'}, 'form') ok_xp([:input, {:value=>'First Page', :class=>'focus', :name=>'t'}], '//input') ok_xp([:input, {:value=>'New page', :type=>'submit'}], "//input[2]") # POST res = session("POST /test/.new?t=First Page") ok_in(['New page'], 'h1') ok_in(['Edit new page'], "//div[@class='section']//a") ok_xp([:a, {:href=>'1.edit'}, 'Edit new page'], "//div[@class='section']//a") # check the new page ok_eq("* First Page\n", @site['1'].load) page = @site.get_by_title('First Page') ok_eq('1', page.key) # check title page = @site['1'] ok_eq('First Page', page.get_title) ok_eq('1', @site.get_by_title('First Page').key.to_s) ok_eq(false, @site.exist?('First Page')) ok_eq(true, @site.exist?('1')) # check the source page res = session('/test/') ok_in(['First Page'], "//div[@class='section']//a") ok_xp([:a, {:href=>'1.html'}, 'First Page'], "//div[@class='section']//a") ok_eq("[[First Page]]", @site['FrontPage'].load) # Try to create with the same key. res = session("/test/.new?t=First+Page") ok_in(['Already exists'], '//h2') ok_xp([:a, {:href=>'1.html'}, [:strong, 'First Page']], "//div[@class='section']/a") # Try to create with the same key. res = session("POST /test/.new?t=First+Page") ok_in(['Already exists'], '//h2') ok_xp([:a, {:href=>'1.html'}, [:strong, 'First Page']], "//div[@class='section']/a") # Let's create a page again. At the first, embed the title. page = @site['FrontPage'] page.store("[[2nd Page]]") # See the page res = session('/test/') ok_in(['2nd Page', [:a, {:href=>".new?t=2nd+Page"}, [:img, {:src=>'.theme/i/new.png', :alt=>'create'}]]], "//div[@class='section']//span") # please input a corresponding page key res = session("/test/.new?t=2nd+Page") ok_xp([:input, {:value=>'2nd Page', :class=>'focus', :name=>'t'}], '//input') # try again res = session("POST /test/.new?t=2nd+Page") ok_in(['Edit new page'], "//div[@class='section']//a") ok_xp([:a, {:href=>'2.edit'}, 'Edit new page'], "//div[@class='section']//a") page = @site['2'] ok_eq("* 2nd Page\n", page.load) # check the source page again res = session('/test/') ok_in(['2nd Page'], "//div[@class='section']//a") ok_xp([:a, {:href=>'2.html'}, '2nd Page'], "//div[@class='section']//a") ok_eq("[[2nd Page]]", @site['FrontPage'].load) end
test_new_sjis()
click to toggle source
# File vendor/qwik/lib/qwik/act-new.rb, line 315 def test_new_sjis t_add_user page = @site['FrontPage'] page.store("[[ポス]]") # See FrontPage res = session('/test/') ok_title('FrontPage') ok_in([:span, {:class=>'new'}, "ポス", [:a, {:href=>".new?t=%83%7C%83X"}, [:img, {:src=>'.theme/i/new.png', :alt=>'create'}]]], "//div[@class='section']/p") end