require 'test_helper' class ListViewHelperTest < ActiveSupport::TestCase include JqmobileHelpers::ListViewsHelper test "basic list helper" do jq_basic_list = basic_list(["apple", "orange"]) assert_equal "", jq_basic_list end test "basic linked list helper with options" do collection = [{:name => "Cs8", :link => "http://google.com/serach?q=Cs8"}] basic_list = basic_list(collection.map{|x| link_to(x[:name], x[:link])}, {'data-theme' => 'b'}) assert_equal "", basic_list end test "basic numbered list helper" do jq_basic_list = numbered_list(["apple", "orange"]) assert_equal "
  1. apple
  2. orange
", jq_basic_list end test "nested list helper" do collection = [{:title => "Bird", :link => "/birds/1"}] nested_list = nested_list(collection.map{|x| link_to(x[:title], x[:link])}) assert_equal "", nested_list end test "split-button list helper" do name = "Split Button List" link = "/posts/1" default_options = {'data-role' => "listview", 'data-split-icon' => "gear", 'data-split-theme' => "d"} split_options = {'data-rel' => "dialog", 'data-transition' => "slideup"} split_button_list = content_tag("li", content_tag(:a, name, {:href => link}.merge(split_options))) assert_equal "
  • Split Button List
  • ", split_button_list end test "thumbnail list helper" do collection = [{:name => "Cs8", :link => "http://google.com/serach?q=Cs8"}] actual = thumbnail_list(collection.collect do |x| ['Album-bb'.html_safe, link_to(x[:name], x[:link]), x[:name]] end) expected = "" assert_equal expected, actual end test "will contruct basic list if thumbnail list collection items is not an array" do collection = [{:name => "Cs8", :link => "http://google.com/search?q=Cs8"}] basic_list = thumbnail_list(collection.map{|x| link_to(x[:name], x[:link])}) assert_equal "", basic_list end test "inset list helper" do jq_inset_list = inset_list(["car","van","truck"]) assert_equal "", jq_inset_list end test "ol inset list helper" do jq_ol_inset_list = ol_inset_list(["car","van","truck"]) assert_equal "
    1. car
    2. van
    3. truck
    ", jq_ol_inset_list end #test "list divider helper" do # collection = [{:title => ["A", "B", "C"], :controller => 'posts'}] # jq_list_divider = list_divider(collection.group_by{|x| x[:title]}.sort, [:title]) # assert_equal "", jq_list_divider #end end