class TestSiteResolve

Public Instance Methods

ok(e, w) click to toggle source
# File vendor/qwik/lib/qwik/site-resolve.rb, line 90
def ok(e, w)
  ok_eq(e, @site.resolve_ref(w))
end
test_all() click to toggle source
# File vendor/qwik/lib/qwik/site-resolve.rb, line 94
def test_all
  res = session

  ok([:a], [:a])
  ok([:a, {:href=>''}, 't'], [:a, {:href=>''}, 't'])

  # test_external
  ok([:a, {:href=>'http://e/', :class=>'external'}, 't'],
     [:a, {:href=>'http://e/'}, 't'])

  # test_redirect
  page = @site['_SiteConfig']
  page.store(':redirect:true')
  ok([:a, {:href=>'.redirect?url=http://e/', :class=>'external'}, 't'],
     [:a, {:href=>'http://e/'}, 't'])
  page.store('')

  ok([:a, {:href=>'a?b'}, 't'],
     [:a, {:href=>'a?b'}, 't'])
  ok([:a, {:href=>'/t'}, 't'],
     [:a, {:href=>'/t'}, 't'])
  ok([:a, {:href=>'t'}, 't'],
     [:a, {:href=>'t'}, 't'])

  # test_new
  ok([:span, {:class=>'new'}, 't',
       [:a, {:href=>'.new?t=t'},
         [:img, {:alt=>'create', :src=>'.theme/i/new.png'}]]],
     [:a, {:href=>'t.html'}, 't'])

  page = @site.create('t')
  ok([:a, {:href=>'t.html'}, 't'], [:a, {:href=>'t.html'}, 't'])
  page = @site.create_new
  page.store('t')
  ok([:a, {:href=>'1.html'}, '1'], [:a, {:href=>'1.html'}, '1'])
  ok([:a, {:href=>'1.html'}, 't'], [:a, {:href=>'1.html'}, 't'])
  page.store('*t')
  ok([:a, {:href=>'1.html'}, 't'], [:a, {:href=>'1.html'}, '1'])
  ok([:a, {:href=>'1.html'}, 't'], [:a, {:href=>'1.html'}, 't'])
  ok([:a, {:href=>'1.html'}, 's'], [:a, {:href=>'1.html'}, 's'])

  # test_error
  ok([:a, {:href=>"\"D_R\", \"/v/w\""}, 't'],
     [:a, {:href=>"\"D_R\", \"/v/w\""}, 't'])

  # test_act
  ok([:a, {:href=>'.attach'}, '.attach'],
     [:a, {:href=>'.attach'}, '.attach'])

  # test_plusplus
  ok([:a, {:href=>'t.html'}, 't'],
     [:a, {:href=>'t.html'}, 't'])
  ok([:span, {:class=>'new'}, 'C++',
       [:a, {:href=>'.new?t=C%2B%2B'},
         [:img, {:alt=>'create', :src=>'.theme/i/new.png'}]]],
     [:a, {:href=>'C++.html'}, 'C++'])
  page.store('* C++')
  ok([:a, {:href=>'1.html'}, 'C++'],
     [:a, {:href=>'C++.html'}, 'C++'])
end
test_japanese() click to toggle source
# File vendor/qwik/lib/qwik/site-resolve.rb, line 155
def test_japanese
  res = session
  page = @site.create_new
  page.store('*あ')

  ok([:a, {:href=>'1.html'}, 'あ'],
     [:a, {:href=>'あ.html'}, 'あ'])
  
  ok([:span, {:class=>'new'}, 'い',
       [:a, {:href=>'.new?t=%82%A2'},
         [:img, {:alt=>'create', :src=>'.theme/i/new.png'}]]],
     [:a, {:href=>'い.html'}, 'い'])
end