Project

General

Profile

Feature #35616 » 0001-Add-back_url-parameter-to-get-requests-in-context-me.patch

Go MAEDA, 2025-08-27 08:21

View differences:

test/functional/context_menus_controller_test.rb
25 25
    get(
26 26
      :issues,
27 27
      :params => {
28
        :ids => [1]
28
        :ids => [1],
29
        :back_url => '/issues'
29 30
      }
30 31
    )
31 32
    assert_response :success
......
33 34
    assert_select 'a.icon-edit[href=?]', '/issues/1/edit', :text => 'Edit'
34 35
    assert_select 'a.icon-copy-link[data-clipboard-text=?]', 'http://test.host/issues/1', :text => 'Copy link'
35 36
    assert_select 'a.icon-copy[href=?]', '/projects/ecookbook/issues/1/copy', :text => 'Copy'
36
    assert_select 'a.icon-del[href=?]', '/issues?ids%5B%5D=1', :text => 'Delete issue'
37
    assert_select 'a.icon-del[href*=?]', 'ids%5B%5D=1', :text => 'Delete issue'
37 38

  
38 39
    # Statuses
39
    assert_select 'a[href=?][data-method="patch"]', '/issues/1?ids%5B%5D=1&issue%5Bstatus_id%5D=5', :text => 'Closed'
40
    assert_select 'a[href=?][data-method="patch"]', '/issues/1?ids%5B%5D=1&issue%5Bpriority_id%5D=8', :text => 'Immediate'
40
    assert_select 'a[href*=?][data-method="patch"]', 'issue%5Bstatus_id%5D=5', :text => 'Closed'
41
    assert_select 'a[href*=?][data-method="patch"]', 'issue%5Bpriority_id%5D=8', :text => 'Immediate'
41 42
    # No inactive priorities
42 43
    assert_select 'a', :text => /Inactive Priority/, :count => 0
43 44
    # Versions
44
    assert_select 'a[href=?][data-method="patch"]', '/issues/1?ids%5B%5D=1&issue%5Bfixed_version_id%5D=3', :text => '2.0'
45
    assert_select 'a[href=?][data-method="patch"]', '/issues/1?ids%5B%5D=1&issue%5Bfixed_version_id%5D=4', :text => 'eCookbook Subproject 1 - 2.0'
45
    assert_select 'a[href*=?][data-method="patch"]', 'issue%5Bfixed_version_id%5D=3', :text => '2.0'
46
    assert_select 'a[href*=?][data-method="patch"]', 'issue%5Bfixed_version_id%5D=4', :text => 'eCookbook Subproject 1 - 2.0'
46 47
    # Assignees
47
    assert_select 'a[href=?][data-method="patch"]', '/issues/1?ids%5B%5D=1&issue%5Bassigned_to_id%5D=3', :text => 'Dave Lopper'
48
    assert_select 'a[href*=?][data-method="patch"]', 'issue%5Bassigned_to_id%5D=3', :text => 'Dave Lopper'
48 49
  end
49 50

  
50 51
  def test_context_menu_multiple_issues_should_link_to_bulk_update_issues_path
51 52
    @request.session[:user_id] = 2
52 53
    get :issues, :params => {
53
      :ids => [1, 2]
54
      :ids => [1, 2],
55
      :back_url => '/projects/ecookbook/issues'
54 56
    }
55 57
    assert_response :success
56 58

  
57 59
    assert_select 'a.icon-edit[href=?]', '/issues/bulk_edit?ids%5B%5D=1&ids%5B%5D=2', :text => 'Bulk edit'
58 60
    assert_select 'a.icon-copy[href=?]', '/issues/bulk_edit?copy=1&ids%5B%5D=1&ids%5B%5D=2', :text => 'Copy'
59
    assert_select 'a.icon-del[href=?]', '/issues?ids%5B%5D=1&ids%5B%5D=2', :text => 'Delete issues'
61
    assert_select 'a.icon-del[href*=?]', 'ids%5B%5D=1&ids%5B%5D=2', :text => 'Delete issues'
60 62

  
61 63
    # Statuses
62
    assert_select 'a[href=?][data-method="patch"]', '/issues/bulk_update?ids%5B%5D=1&ids%5B%5D=2&issue%5Bstatus_id%5D=5', :text => 'Closed'
63
    assert_select 'a[href=?][data-method="patch"]', '/issues/bulk_update?ids%5B%5D=1&ids%5B%5D=2&issue%5Bpriority_id%5D=8', :text => 'Immediate'
64
    assert_select 'a[href*=?][data-method="patch"]', 'issue%5Bstatus_id%5D=5', :text => 'Closed'
65
    assert_select 'a[href*=?][data-method="patch"]', 'issue%5Bpriority_id%5D=8', :text => 'Immediate'
64 66
    # No inactive priorities
65 67
    assert_select 'a', :text => /Inactive Priority/, :count => 0
66 68
    # Versions
67
    assert_select 'a[href=?][data-method="patch"]', '/issues/bulk_update?ids%5B%5D=1&ids%5B%5D=2&issue%5Bfixed_version_id%5D=3', :text => '2.0'
68
    assert_select 'a[href=?][data-method="patch"]', '/issues/bulk_update?ids%5B%5D=1&ids%5B%5D=2&issue%5Bfixed_version_id%5D=4', :text => 'eCookbook Subproject 1 - 2.0'
69
    assert_select 'a[href*=?][data-method="patch"]', 'issue%5Bfixed_version_id%5D=3', :text => '2.0'
70
    assert_select 'a[href*=?][data-method="patch"]', 'issue%5Bfixed_version_id%5D=4', :text => 'eCookbook Subproject 1 - 2.0'
69 71
    # Assignees
70
    assert_select 'a[href=?][data-method="patch"]', '/issues/bulk_update?ids%5B%5D=1&ids%5B%5D=2&issue%5Bassigned_to_id%5D=3', :text => 'Dave Lopper'
72
    assert_select 'a[href*=?][data-method="patch"]', 'issue%5Bassigned_to_id%5D=3', :text => 'Dave Lopper'
71 73
  end
72 74

  
73 75
  def test_context_menu_one_issue_by_anonymous
......
75 77
      get(
76 78
        :issues,
77 79
        :params => {
78
          :ids => [1]
80
          :ids => [1],
81
          :back_url => '/issues'
79 82
        }
80 83
      )
81 84
      assert_response :success
......
89 92
    get(
90 93
      :issues,
91 94
      :params => {
92
        :ids => [1, 2]
95
        :ids => [1, 2],
96
        :back_url => '/issues'
93 97
      }
94 98
    )
95 99
    assert_response :success
......
100 104
    # issue_id: '1,2', set_filter: 1, status_id: '*'
101 105
    assert_select 'a.icon-copy-link[data-clipboard-text=?]', "http://test.host/projects/ecookbook/issues?issue_id=1%2C2&set_filter=1&status_id=%2A", :text => 'Copy link'
102 106
    assert_select 'a.icon-copy[href=?]', "/issues/bulk_edit?copy=1&#{ids}", :text => 'Copy'
103
    assert_select 'a.icon-del[href=?]', "/issues?#{ids}", :text => 'Delete issues'
107
    assert_select 'a.icon-del[href*=?]', ids, :text => 'Delete issues'
104 108

  
105
    assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bstatus_id%5D=5", :text => 'Closed'
106
    assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bpriority_id%5D=8", :text => 'Immediate'
107
    assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bassigned_to_id%5D=3", :text => 'Dave Lopper'
109
    assert_select 'a[href*=?]', 'issue%5Bstatus_id%5D=5', :text => 'Closed'
110
    assert_select 'a[href*=?]', 'issue%5Bpriority_id%5D=8', :text => 'Immediate'
111
    assert_select 'a[href*=?]', 'issue%5Bassigned_to_id%5D=3', :text => 'Dave Lopper'
108 112
  end
109 113

  
110 114
  def test_context_menu_multiple_issues_of_different_projects
......
112 116
    get(
113 117
      :issues,
114 118
      :params => {
115
        :ids => [1, 2, 6]
119
        :ids => [1, 2, 6],
120
        :back_url => '/issues'
116 121
      }
117 122
    )
118 123
    assert_response :success
......
122 127
    assert_select 'a.icon-edit[href=?]', "/issues/bulk_edit?#{ids}", :text => 'Bulk edit'
123 128
    # issue_id: '1,2,6', set_filter: 1, status_id: '*'
124 129
    assert_select 'a.icon-copy-link[data-clipboard-text=?]', "http://test.host/issues?issue_id=1%2C2%2C6&set_filter=1&status_id=%2A", :text => 'Copy link'
125
    assert_select 'a.icon-del[href=?]', "/issues?#{ids}", :text => 'Delete issues'
130
    assert_select 'a.icon-del[href*=?]', ids, :text => 'Delete issues'
126 131

  
127
    assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bstatus_id%5D=5", :text => 'Closed'
128
    assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bpriority_id%5D=8", :text => 'Immediate'
129
    assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bassigned_to_id%5D=2", :text => 'John Smith'
132
    assert_select 'a[href*=?]', 'issue%5Bstatus_id%5D=5', :text => 'Closed'
133
    assert_select 'a[href*=?]', 'issue%5Bpriority_id%5D=8', :text => 'Immediate'
134
    assert_select 'a[href*=?]', 'issue%5Bassigned_to_id%5D=2', :text => 'John Smith'
130 135
  end
131 136

  
132 137
  def test_context_menu_should_include_list_custom_fields
(3-3/5)