class TestActTable

Public Instance Methods

nutest_ext_table() click to toggle source
# File vendor/qwik/lib/qwik/act-table.rb, line 228
    def nutest_ext_table
      t_add_user
      page = @site.create_new
      page.store("{{table
|a
}}")

      res = session('/test/1.html')
      expected = [:form, {:action=>'1.1.table', :method=>'POST'},
        [:table,
          [:tr,
            [:th, [:input, {:size=>'1', :value=>'a', :name=>'t_0_0'}]],
            [:th, {:class=>'new_col'},
              [:input, {:size=>'1', :value=>'', :name=>'t_1_0'}]],
            [:td, {:class=>'new_col_button'},
              [:a, {:href=>"javascript:show_new_col();"}, ">>"]]],
          [:tr, {:class=>'new_row'},
            [:th, [:input, {:size=>'1', :value=>'', :name=>'t_0_1'}]],
            [:td, {:class=>'new_col'},
              [:input, {:size=>'1', :value=>'', :name=>'t_1_1'}]]],
          [:tr, {:class=>'new_row_button_row'},
            [:td, {:class=>'new_row_button'},
              [:a, {:href=>"javascript:show_new_row();"}, 'v']]]],
        [:div, {:class=>'submit'},
          [:input, {:value=>'Update', :type=>'submit'}]]]
      ok_in(expected, "//div[@class='table']")

      res = session("/test/1.1.table?t_0_0=bb")
      ok_in(['Edit done.'], '//h2')

      res = session('/test/1.html')
      ok_xp([:input, {:size=>'2', :value=>'bb', :name=>'t_0_0'}],
            "//div[@class='table']/form/input")
    end
test_plg_table() click to toggle source
# File vendor/qwik/lib/qwik/act-table.rb, line 162
    def test_plg_table
      t_add_user
      ok_wi([:div, {:class=>'error'},
              [:strong, 'Error', ':'], ' ', 'You can only use a table.'],
            "{{table
a
}}")
      ok_wi([:div, {:class=>'error'},
              [:strong, 'Error', ':'], ' ', 'You can only use a table.'],
            "{{table
|a

|b
}}")
      ok_wi([:div, {:class=>'table'},
              [:form, {:action=>'1.1.table', :method=>'POST'},
                [:table,
                  [:tr,
                    [:th, [:input, {:size=>'1', :value=>'a', :name=>'t_0_0'}]],
                    [:th, {:class=>'new_col'},
                      [:input, {:size=>'1', :value=>'', :name=>'t_1_0'}]],
                    [:td, {:class=>'new_col_button'},
                      [:a, {:href=>"javascript:show_new_col();"}, ">>"]]],
                  [:tr, {:class=>'new_row'},
                    [:th, [:input, {:size=>'1', :value=>'', :name=>'t_0_1'}]],
                    [:td, {:class=>'new_col'},
                      [:input, {:size=>'1', :value=>'', :name=>'t_1_1'}]]],
                  [:tr, {:class=>'new_row_button_row'},
                    [:td, {:class=>'new_row_button'},
                      [:a, {:href=>"javascript:show_new_row();"}, 'v']]]],
                [:div, {:class=>'submit'},
                  [:input, {:value=>'Update', :type=>'submit'}]]]],
            "{{table
|a
}}")
      ok_wi([:div, {:class=>'table'},
              [:form, {:action=>'1.1.table', :method=>'POST'},
                [:table,
                  [:tr,
                    [:th, [:input, {:size=>'1', :value=>'a', :name=>'t_0_0'}]],
                    [:th, [:input, {:size=>'1', :value=>'b', :name=>'t_1_0'}]],
                    [:th, {:class=>'new_col'},
                      [:input, {:size=>'1', :value=>'', :name=>'t_2_0'}]],
                    [:td, {:class=>'new_col_button'},
                      [:a, {:href=>"javascript:show_new_col();"}, ">>"]]],
                  [:tr,
                    [:th, [:input, {:size=>'1', :value=>'c', :name=>'t_0_1'}]],
                    [:td, [:input, {:size=>'1', :value=>'d', :name=>'t_1_1'}]],
                    [:td, {:class=>'new_col'},
                      [:input, {:size=>'1', :value=>'', :name=>'t_2_1'}]]],
                  [:tr, {:class=>'new_row'},
                    [:th, [:input, {:size=>'1', :value=>'', :name=>'t_0_2'}]],
                    [:td, [:input, {:size=>'1', :value=>'', :name=>'t_1_2'}]],
                    [:td, {:class=>'new_col'},
                      [:input, {:size=>'1', :value=>'', :name=>'t_2_2'}]]],
                  [:tr, {:class=>'new_row_button_row'},
                    [:td, {:class=>'new_row_button'},
                      [:a, {:href=>"javascript:show_new_row();"}, 'v']]]],
                [:div, {:class=>'submit'},
                  [:input, {:value=>'Update', :type=>'submit'}]]]],
            "{{table
|a|b
|c|d
}}")
    end