Project

General

Profile

Patch #25066 » Null_placement_tests.patch

Andrey Lobanov (RedSoft), 2017-02-21 13:34

View differences:

test/integration/issues_test.rb (revision 64e2b9e851736cf26a6118b3c41d056b17bdc3da)
193 193
  def test_sort_links_on_index
194 194
    get '/projects/ecookbook/issues'
195 195

  
196
    assert_select 'a[href=?]', '/projects/ecookbook/issues?sort=subject%2Cid%3Adesc', :text => 'Subject'
196
    assert_select 'a[href=?]', '/projects/ecookbook/issues?sort=subject%3Aasc%2Cid%3Adesc', :text => 'Subject'
197 197
  end
198 198

  
199 199
  def test_sort_links_should_preserve_query_parameters
200 200
    get '/projects/ecookbook/issues?foo=bar'
201 201

  
202
    assert_select 'a[href=?]', '/projects/ecookbook/issues?foo=bar&sort=subject%2Cid%3Adesc', :text => 'Subject'
202
    assert_select 'a[href=?]', '/projects/ecookbook/issues?foo=bar&sort=subject%3Aasc%2Cid%3Adesc', :text => 'Subject'
203 203
  end
204 204

  
205 205
  def test_sort_links_should_not_use_params_as_url_options
206 206
    get '/projects/ecookbook/issues?host=foo'
207 207

  
208
    assert_select 'a[href=?]', '/projects/ecookbook/issues?host=foo&sort=subject%2Cid%3Adesc', :text => 'Subject'
208
    assert_select 'a[href=?]', '/projects/ecookbook/issues?host=foo&sort=subject%3Aasc%2Cid%3Adesc', :text => 'Subject'
209 209
  end
210 210

  
211 211
  def test_issue_with_user_custom_field
test/unit/helpers/sort_helper_test.rb (revision 64e2b9e851736cf26a6118b3c41d056b17bdc3da)
55 55
    sort_update({'attr1' => 'table1.attr1', 'attr2' => 'table2.attr2'})
56 56

  
57 57
    assert_equal ['table1.attr1 ASC', 'table2.attr2 DESC'], sort_clause
58
    assert_equal 'attr1,attr2:desc', @session['foo_bar_sort']
58
    assert_equal 'attr1:asc,attr2:desc', @session['foo_bar_sort']
59 59
  end
60 60

  
61 61
  def test_invalid_params_sort
......
75 75
    sort_update({'attr1' => 'table1.attr1', 'attr2' => 'table2.attr2'})
76 76

  
77 77
    assert_equal ['table1.attr1 ASC', 'table2.attr2 ASC'], sort_clause
78
    assert_equal 'attr1,attr2', @session['foo_bar_sort']
78
    assert_equal 'attr1:asc,attr2:asc', @session['foo_bar_sort']
79 79
  end
80 80

  
81 81
  def test_sort_css_without_params_should_use_default_sort
test/functional/issues_controller_test.rb (revision 64e2b9e851736cf26a6118b3c41d056b17bdc3da)
443 443
      assert_select 'input[name=?][value=?]', 'c[]', 'status'
444 444
      assert_select 'input[name=?][value=?]', 'c[]', 'priority'
445 445

  
446
      assert_select 'input[name=?][value=?]', 'sort', 'status'
446
      assert_select 'input[name=?][value=?]', 'sort', 'status:asc'
447 447
    end
448 448

  
449 449
    get :index, :project_id => 1, :set_filter => "1", :f => []
......
684 684

  
685 685
    sort_params = @request.session['issues_index_sort']
686 686
    assert sort_params.is_a?(String)
687
    assert_equal 'tracker,id:desc', sort_params
687
    assert_equal 'tracker:asc,id:desc', sort_params
688 688

  
689 689
    assert_equal issues_in_list.sort_by {|issue| [issue.tracker.position, -issue.id]}, issues_in_list
690 690
    assert_select 'table.issues.sort-by-tracker.sort-asc'
......
4659 4659
    assert_response :success
4660 4660
  end
4661 4661

  
4662
  def test_issues_sort_by_asc_nulls_last_not_nulls_should_be_at_top
4663
    get :index, :project_id => 1, :c => ['subject', 'due_date'], :set_filter => 1, :sort => "due_date:asc nulls last"
4664
    assert_response :success
4665
    assert_equal 3, issues_in_list.first.id
4666
  end
4667

  
4668
  def test_issues_sort_by_desc_nulls_first_not_nulls_should_be_at_bottom
4669
    get :index, :project_id => 1, :c => ['subject', 'due_date'], :set_filter => 1, :sort => "due_date:desc nulls first"
4670
    assert_response :success
4671
    assert_equal 3, issues_in_list.last.id
4672
  end
4673

  
4662 4674
  def test_destroy_issue_with_no_time_entries_should_delete_the_issues
4663 4675
    assert_nil TimeEntry.find_by_issue_id(2)
4664 4676
    @request.session[:user_id] = 2
(3-3/3)