@@ -104,7 +104,7 | |||||
104 | <% end %> |
|
104 | <% end %> | |
105 |
|
105 | |||
106 | <% @options_by_custom_field.each do |field, options| %> |
|
106 | <% @options_by_custom_field.each do |field, options| %> | |
107 | <li class="folder"> |
|
107 | <li class="folder cf_<%= field.id %>"> | |
108 | <a href="#" class="submenu"><%= h(field.name) %></a> |
|
108 | <a href="#" class="submenu"><%= h(field.name) %></a> | |
109 | <ul> |
|
109 | <ul> | |
110 | <% options.each do |text, value| %> |
|
110 | <% options.each do |text, value| %> |
@@ -94,8 +94,8 class AccountControllerTest < ActionController::TestCase | |||||
94 | assert_template 'register' |
|
94 | assert_template 'register' | |
95 | assert_not_nil assigns(:user) |
|
95 | assert_not_nil assigns(:user) | |
96 |
|
96 | |||
97 |
assert_t |
|
97 | assert_select 'input[name=?]', 'user[password]' | |
98 |
assert_t |
|
98 | assert_select 'input[name=?]', 'user[password_confirmation]' | |
99 | end |
|
99 | end | |
100 | end |
|
100 | end | |
101 |
|
101 |
@@ -36,16 +36,8 class ActivitiesControllerTest < ActionController::TestCase | |||||
36 | assert_template 'index' |
|
36 | assert_template 'index' | |
37 | assert_not_nil assigns(:events_by_day) |
|
37 | assert_not_nil assigns(:events_by_day) | |
38 |
|
38 | |||
39 | assert_tag :tag => "h3", |
|
39 | assert_select 'h3', :text => /#{2.days.ago.to_date.day}/ | |
40 | :content => /#{2.days.ago.to_date.day}/, |
|
40 | assert_select 'dl dt.issue-edit a', :text => /(#{IssueStatus.find(2).name})/ | |
41 | :sibling => { :tag => "dl", |
|
|||
42 | :child => { :tag => "dt", |
|
|||
43 | :attributes => { :class => /issue-edit/ }, |
|
|||
44 | :child => { :tag => "a", |
|
|||
45 | :content => /(#{IssueStatus.find(2).name})/, |
|
|||
46 | } |
|
|||
47 | } |
|
|||
48 | } |
|
|||
49 | end |
|
41 | end | |
50 |
|
42 | |||
51 | def test_project_index_with_invalid_project_id_should_respond_404 |
|
43 | def test_project_index_with_invalid_project_id_should_respond_404 | |
@@ -59,16 +51,8 class ActivitiesControllerTest < ActionController::TestCase | |||||
59 | assert_template 'index' |
|
51 | assert_template 'index' | |
60 | assert_not_nil assigns(:events_by_day) |
|
52 | assert_not_nil assigns(:events_by_day) | |
61 |
|
53 | |||
62 | assert_tag :tag => "h3", |
|
54 | assert_select 'h3', :text => /#{3.days.ago.to_date.day}/ | |
63 | :content => /#{3.day.ago.to_date.day}/, |
|
55 | assert_select 'dl dt.issue a', :text => /Can't print recipes/ | |
64 | :sibling => { :tag => "dl", |
|
|||
65 | :child => { :tag => "dt", |
|
|||
66 | :attributes => { :class => /issue/ }, |
|
|||
67 | :child => { :tag => "a", |
|
|||
68 | :content => /Can't print recipes/, |
|
|||
69 | } |
|
|||
70 | } |
|
|||
71 | } |
|
|||
72 | end |
|
56 | end | |
73 |
|
57 | |||
74 | def test_global_index |
|
58 | def test_global_index | |
@@ -80,16 +64,9 class ActivitiesControllerTest < ActionController::TestCase | |||||
80 |
|
64 | |||
81 | i5 = Issue.find(5) |
|
65 | i5 = Issue.find(5) | |
82 | d5 = User.find(1).time_to_date(i5.created_on) |
|
66 | d5 = User.find(1).time_to_date(i5.created_on) | |
83 | assert_tag :tag => "h3", |
|
67 | ||
84 |
|
|
68 | assert_select 'h3', :text => /#{d5.day}/ | |
85 | :sibling => { :tag => "dl", |
|
69 | assert_select 'dl dt.issue a', :text => /Subproject issue/ | |
86 | :child => { :tag => "dt", |
|
|||
87 | :attributes => { :class => /issue/ }, |
|
|||
88 | :child => { :tag => "a", |
|
|||
89 | :content => /Subproject issue/, |
|
|||
90 | } |
|
|||
91 | } |
|
|||
92 | } |
|
|||
93 | end |
|
70 | end | |
94 |
|
71 | |||
95 | def test_user_index |
|
72 | def test_user_index | |
@@ -104,16 +81,8 class ActivitiesControllerTest < ActionController::TestCase | |||||
104 | i1 = Issue.find(1) |
|
81 | i1 = Issue.find(1) | |
105 | d1 = User.find(1).time_to_date(i1.created_on) |
|
82 | d1 = User.find(1).time_to_date(i1.created_on) | |
106 |
|
83 | |||
107 | assert_tag :tag => "h3", |
|
84 | assert_select 'h3', :text => /#{d1.day}/ | |
108 | :content => /#{d1.day}/, |
|
85 | assert_select 'dl dt.issue a', :text => /Can't print recipes/ | |
109 | :sibling => { :tag => "dl", |
|
|||
110 | :child => { :tag => "dt", |
|
|||
111 | :attributes => { :class => /issue/ }, |
|
|||
112 | :child => { :tag => "a", |
|
|||
113 | :content => /Can't print recipes/, |
|
|||
114 | } |
|
|||
115 | } |
|
|||
116 | } |
|
|||
117 | end |
|
86 | end | |
118 |
|
87 | |||
119 | def test_user_index_with_invalid_user_id_should_respond_404 |
|
88 | def test_user_index_with_invalid_user_id_should_respond_404 | |
@@ -126,14 +95,13 class ActivitiesControllerTest < ActionController::TestCase | |||||
126 | assert_response :success |
|
95 | assert_response :success | |
127 | assert_template 'common/feed' |
|
96 | assert_template 'common/feed' | |
128 |
|
97 | |||
129 | assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, |
|
98 | assert_select 'feed' do | |
130 |
|
|
99 | assert_select 'link[rel=self][href=?]', 'http://test.host/activity.atom?with_subprojects=0' | |
131 | assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, |
|
100 | assert_select 'link[rel=alternate][href=?]', 'http://test.host/activity?with_subprojects=0' | |
132 | :attributes => {:rel => 'alternate', :href => 'http://test.host/activity?with_subprojects=0'} |
|
101 | assert_select 'entry' do | |
133 |
|
102 | assert_select 'link[href=?]', 'http://test.host/issues/11' | ||
134 | assert_tag :tag => 'entry', :child => { |
|
103 | end | |
135 | :tag => 'link', |
|
104 | end | |
136 | :attributes => {:href => 'http://test.host/issues/11'}} |
|
|||
137 | end |
|
105 | end | |
138 |
|
106 | |||
139 | def test_index_atom_feed_with_explicit_selection |
|
107 | def test_index_atom_feed_with_explicit_selection | |
@@ -150,21 +118,21 class ActivitiesControllerTest < ActionController::TestCase | |||||
150 | assert_response :success |
|
118 | assert_response :success | |
151 | assert_template 'common/feed' |
|
119 | assert_template 'common/feed' | |
152 |
|
120 | |||
153 | assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, |
|
121 | assert_select 'feed' do | |
154 |
|
|
122 | assert_select 'link[rel=self][href=?]', 'http://test.host/activity.atom?show_changesets=1&show_documents=1&show_files=1&show_issues=1&show_messages=1&show_news=1&show_time_entries=1&show_wiki_edits=1&with_subprojects=0' | |
155 | assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, |
|
123 | assert_select 'link[rel=alternate][href=?]', 'http://test.host/activity?show_changesets=1&show_documents=1&show_files=1&show_issues=1&show_messages=1&show_news=1&show_time_entries=1&show_wiki_edits=1&with_subprojects=0' | |
156 | :attributes => {:rel => 'alternate', :href => 'http://test.host/activity?show_changesets=1&show_documents=1&show_files=1&show_issues=1&show_messages=1&show_news=1&show_time_entries=1&show_wiki_edits=1&with_subprojects=0'} |
|
124 | assert_select 'entry' do | |
157 |
|
125 | assert_select 'link[href=?]', 'http://test.host/issues/11' | ||
158 | assert_tag :tag => 'entry', :child => { |
|
126 | end | |
159 | :tag => 'link', |
|
127 | end | |
160 | :attributes => {:href => 'http://test.host/issues/11'}} |
|
|||
161 | end |
|
128 | end | |
162 |
|
129 | |||
163 | def test_index_atom_feed_with_one_item_type |
|
130 | def test_index_atom_feed_with_one_item_type | |
164 | get :index, :format => 'atom', :show_issues => '1' |
|
131 | get :index, :format => 'atom', :show_issues => '1' | |
165 | assert_response :success |
|
132 | assert_response :success | |
166 | assert_template 'common/feed' |
|
133 | assert_template 'common/feed' | |
167 | assert_tag :tag => 'title', :content => /Issues/ |
|
134 | ||
|
135 | assert_select 'title', :text => /Issues/ | |||
168 | end |
|
136 | end | |
169 |
|
137 | |||
170 | def test_index_should_show_private_notes_with_permission_only |
|
138 | def test_index_should_show_private_notes_with_permission_only |
@@ -75,8 +75,9 class BoardsControllerTest < ActionController::TestCase | |||||
75 | assert_response :success |
|
75 | assert_response :success | |
76 | assert_template 'show' |
|
76 | assert_template 'show' | |
77 |
|
77 | |||
78 |
assert_t |
|
78 | assert_select 'form#message-form' do | |
79 |
assert_t |
|
79 | assert_select 'input[name=?]', 'message[subject]' | |
|
80 | end | |||
80 | end |
|
81 | end | |
81 |
|
82 | |||
82 | def test_show_atom |
|
83 | def test_show_atom |
@@ -56,42 +56,32 class CalendarsControllerTest < ActionController::TestCase | |||||
56 | get :show, :month => '1', :year => '2010' |
|
56 | get :show, :month => '1', :year => '2010' | |
57 | assert_response :success |
|
57 | assert_response :success | |
58 |
|
58 | |||
59 |
assert_t |
|
59 | assert_select 'tr' do | |
60 | :descendant => {:tag => 'td', |
|
60 | assert_select 'td.week-number', :text => '53' | |
61 | :attributes => {:class => 'week-number'}, :content => '53'}, |
|
61 | assert_select 'td.odd', :text => '27' | |
62 | :descendant => {:tag => 'td', |
|
62 | assert_select 'td.even', :text => '2' | |
63 | :attributes => {:class => 'odd'}, :content => '27'}, |
|
63 | end | |
64 | :descendant => {:tag => 'td', |
|
|||
65 | :attributes => {:class => 'even'}, :content => '2'} |
|
|||
66 |
|
||||
67 | assert_tag :tag => 'tr', |
|
|||
68 | :descendant => {:tag => 'td', |
|
|||
69 | :attributes => {:class => 'week-number'}, :content => '1'}, |
|
|||
70 | :descendant => {:tag => 'td', |
|
|||
71 | :attributes => {:class => 'odd'}, :content => '3'}, |
|
|||
72 | :descendant => {:tag => 'td', |
|
|||
73 | :attributes => {:class => 'even'}, :content => '9'} |
|
|||
74 |
|
64 | |||
|
65 | assert_select 'tr' do | |||
|
66 | assert_select 'td.week-number', :text => '1' | |||
|
67 | assert_select 'td.odd', :text => '3' | |||
|
68 | assert_select 'td.even', :text => '9' | |||
|
69 | end | |||
75 |
|
70 | |||
76 | Setting.start_of_week = 1 |
|
71 | Setting.start_of_week = 1 | |
77 | get :show, :month => '1', :year => '2010' |
|
72 | get :show, :month => '1', :year => '2010' | |
78 | assert_response :success |
|
73 | assert_response :success | |
79 |
|
74 | |||
80 |
assert_t |
|
75 | assert_select 'tr' do | |
81 | :descendant => {:tag => 'td', |
|
76 | assert_select 'td.week-number', :text => '53' | |
82 | :attributes => {:class => 'week-number'}, :content => '53'}, |
|
77 | assert_select 'td.even', :text => '28' | |
83 | :descendant => {:tag => 'td', |
|
78 | assert_select 'td.even', :text => '3' | |
84 | :attributes => {:class => 'even'}, :content => '28'}, |
|
79 | end | |
85 | :descendant => {:tag => 'td', |
|
|||
86 | :attributes => {:class => 'even'}, :content => '3'} |
|
|||
87 |
|
||||
88 | assert_tag :tag => 'tr', |
|
|||
89 | :descendant => {:tag => 'td', |
|
|||
90 | :attributes => {:class => 'week-number'}, :content => '1'}, |
|
|||
91 | :descendant => {:tag => 'td', |
|
|||
92 | :attributes => {:class => 'even'}, :content => '4'}, |
|
|||
93 | :descendant => {:tag => 'td', |
|
|||
94 | :attributes => {:class => 'even'}, :content => '10'} |
|
|||
95 |
|
80 | |||
|
81 | assert_select 'tr' do | |||
|
82 | assert_select 'td.week-number', :text => '1' | |||
|
83 | assert_select 'td.even', :text => '4' | |||
|
84 | assert_select 'td.even', :text => '10' | |||
|
85 | end | |||
96 | end |
|
86 | end | |
97 | end |
|
87 | end |
@@ -38,34 +38,21 class ContextMenusControllerTest < ActionController::TestCase | |||||
38 | get :issues, :ids => [1] |
|
38 | get :issues, :ids => [1] | |
39 | assert_response :success |
|
39 | assert_response :success | |
40 | assert_template 'context_menu' |
|
40 | assert_template 'context_menu' | |
41 | assert_tag :tag => 'a', :content => 'Edit', |
|
41 | ||
42 | :attributes => { :href => '/issues/1/edit', |
|
42 | assert_select 'a.icon-edit[href=?]', '/issues/1/edit', :text => 'Edit' | |
43 | :class => 'icon-edit' } |
|
43 | assert_select 'a.icon-copy[href=?]', '/projects/ecookbook/issues/1/copy', :text => 'Copy' | |
44 | assert_tag :tag => 'a', :content => 'Closed', |
|
44 | assert_select 'a.icon-del[href=?]', '/issues?ids%5B%5D=1', :text => 'Delete' | |
45 | :attributes => { :href => '/issues/bulk_update?ids%5B%5D=1&issue%5Bstatus_id%5D=5', |
|
45 | ||
46 | :class => '' } |
|
46 | # Statuses | |
47 | assert_tag :tag => 'a', :content => 'Immediate', |
|
47 | assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bstatus_id%5D=5', :text => 'Closed' | |
48 |
|
|
48 | assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bpriority_id%5D=8', :text => 'Immediate' | |
49 | :class => '' } |
|
49 | # No inactive priorities | |
50 |
assert_ |
|
50 | assert_select 'a', :text => /Inactive Priority/, :count => 0 | |
51 | # Versions |
|
51 | # Versions | |
52 | assert_tag :tag => 'a', :content => '2.0', |
|
52 | assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bfixed_version_id%5D=3', :text => '2.0' | |
53 |
|
|
53 | assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bfixed_version_id%5D=4', :text => 'eCookbook Subproject 1 - 2.0' | |
54 | :class => '' } |
|
54 | # Assignees | |
55 | assert_tag :tag => 'a', :content => 'eCookbook Subproject 1 - 2.0', |
|
55 | assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bassigned_to_id%5D=3', :text => 'Dave Lopper' | |
56 | :attributes => { :href => '/issues/bulk_update?ids%5B%5D=1&issue%5Bfixed_version_id%5D=4', |
|
|||
57 | :class => '' } |
|
|||
58 |
|
||||
59 | assert_tag :tag => 'a', :content => 'Dave Lopper', |
|
|||
60 | :attributes => { :href => '/issues/bulk_update?ids%5B%5D=1&issue%5Bassigned_to_id%5D=3', |
|
|||
61 | :class => '' } |
|
|||
62 | assert_tag :tag => 'a', :content => 'Copy', |
|
|||
63 | :attributes => { :href => '/projects/ecookbook/issues/1/copy', |
|
|||
64 | :class => 'icon-copy' } |
|
|||
65 | assert_no_tag :tag => 'a', :content => 'Move' |
|
|||
66 | assert_tag :tag => 'a', :content => 'Delete', |
|
|||
67 | :attributes => { :href => '/issues?ids%5B%5D=1', |
|
|||
68 | :class => 'icon-del' } |
|
|||
69 | end |
|
56 | end | |
70 |
|
57 | |||
71 | def test_context_menu_one_issue_by_anonymous |
|
58 | def test_context_menu_one_issue_by_anonymous | |
@@ -86,25 +73,14 class ContextMenusControllerTest < ActionController::TestCase | |||||
86 | assert_equal [1, 2], assigns(:issues).map(&:id).sort |
|
73 | assert_equal [1, 2], assigns(:issues).map(&:id).sort | |
87 |
|
74 | |||
88 | ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('&') |
|
75 | ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('&') | |
89 | assert_tag :tag => 'a', :content => 'Edit', |
|
76 | ||
90 | :attributes => { :href => "/issues/bulk_edit?#{ids}", |
|
77 | assert_select 'a.icon-edit[href=?]', "/issues/bulk_edit?#{ids}", :text => 'Edit' | |
91 | :class => 'icon-edit' } |
|
78 | assert_select 'a.icon-copy[href=?]', "/issues/bulk_edit?copy=1&#{ids}", :text => 'Copy' | |
92 | assert_tag :tag => 'a', :content => 'Closed', |
|
79 | assert_select 'a.icon-del[href=?]', "/issues?#{ids}", :text => 'Delete' | |
93 | :attributes => { :href => "/issues/bulk_update?#{ids}&issue%5Bstatus_id%5D=5", |
|
80 | ||
94 | :class => '' } |
|
81 | assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bstatus_id%5D=5", :text => 'Closed' | |
95 | assert_tag :tag => 'a', :content => 'Immediate', |
|
82 | assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bpriority_id%5D=8", :text => 'Immediate' | |
96 | :attributes => { :href => "/issues/bulk_update?#{ids}&issue%5Bpriority_id%5D=8", |
|
83 | assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bassigned_to_id%5D=3", :text => 'Dave Lopper' | |
97 | :class => '' } |
|
|||
98 | assert_tag :tag => 'a', :content => 'Dave Lopper', |
|
|||
99 | :attributes => { :href => "/issues/bulk_update?#{ids}&issue%5Bassigned_to_id%5D=3", |
|
|||
100 | :class => '' } |
|
|||
101 | assert_tag :tag => 'a', :content => 'Copy', |
|
|||
102 | :attributes => { :href => "/issues/bulk_edit?copy=1&#{ids}", |
|
|||
103 | :class => 'icon-copy' } |
|
|||
104 | assert_no_tag :tag => 'a', :content => 'Move' |
|
|||
105 | assert_tag :tag => 'a', :content => 'Delete', |
|
|||
106 | :attributes => { :href => "/issues?#{ids}", |
|
|||
107 | :class => 'icon-del' } |
|
|||
108 | end |
|
84 | end | |
109 |
|
85 | |||
110 | def test_context_menu_multiple_issues_of_different_projects |
|
86 | def test_context_menu_multiple_issues_of_different_projects | |
@@ -116,21 +92,13 class ContextMenusControllerTest < ActionController::TestCase | |||||
116 | assert_equal [1, 2, 6], assigns(:issues).map(&:id).sort |
|
92 | assert_equal [1, 2, 6], assigns(:issues).map(&:id).sort | |
117 |
|
93 | |||
118 | ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('&') |
|
94 | ids = assigns(:issues).map(&:id).sort.map {|i| "ids%5B%5D=#{i}"}.join('&') | |
119 | assert_tag :tag => 'a', :content => 'Edit', |
|
95 | ||
120 | :attributes => { :href => "/issues/bulk_edit?#{ids}", |
|
96 | assert_select 'a.icon-edit[href=?]', "/issues/bulk_edit?#{ids}", :text => 'Edit' | |
121 | :class => 'icon-edit' } |
|
97 | assert_select 'a.icon-del[href=?]', "/issues?#{ids}", :text => 'Delete' | |
122 | assert_tag :tag => 'a', :content => 'Closed', |
|
98 | ||
123 |
|
|
99 | assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bstatus_id%5D=5", :text => 'Closed' | |
124 | :class => '' } |
|
100 | assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bpriority_id%5D=8", :text => 'Immediate' | |
125 | assert_tag :tag => 'a', :content => 'Immediate', |
|
101 | assert_select 'a[href=?]', "/issues/bulk_update?#{ids}&issue%5Bassigned_to_id%5D=2", :text => 'John Smith' | |
126 | :attributes => { :href => "/issues/bulk_update?#{ids}&issue%5Bpriority_id%5D=8", |
|
|||
127 | :class => '' } |
|
|||
128 | assert_tag :tag => 'a', :content => 'John Smith', |
|
|||
129 | :attributes => { :href => "/issues/bulk_update?#{ids}&issue%5Bassigned_to_id%5D=2", |
|
|||
130 | :class => '' } |
|
|||
131 | assert_tag :tag => 'a', :content => 'Delete', |
|
|||
132 | :attributes => { :href => "/issues?#{ids}", |
|
|||
133 | :class => 'icon-del' } |
|
|||
134 | end |
|
102 | end | |
135 |
|
103 | |||
136 | def test_context_menu_should_include_list_custom_fields |
|
104 | def test_context_menu_should_include_list_custom_fields | |
@@ -139,17 +107,14 class ContextMenusControllerTest < ActionController::TestCase | |||||
139 | @request.session[:user_id] = 2 |
|
107 | @request.session[:user_id] = 2 | |
140 | get :issues, :ids => [1] |
|
108 | get :issues, :ids => [1] | |
141 |
|
109 | |||
142 | assert_tag 'a', |
|
110 | assert_select "li.cf_#{field.id}" do | |
143 | :content => 'List', |
|
111 | assert_select 'a[href=#]', :text => 'List' | |
144 | :attributes => {:href => '#'}, |
|
112 | assert_select 'ul' do | |
145 | :sibling => {:tag => 'ul', :children => {:count => 3}} |
|
113 | assert_select 'a', 3 | |
146 |
|
114 | assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=Foo", :text => 'Foo' | ||
147 | assert_tag 'a', |
|
115 | assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=", :text => 'none' | |
148 | :content => 'Foo', |
|
116 | end | |
149 | :attributes => {:href => "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=Foo"} |
|
117 | end | |
150 | assert_tag 'a', |
|
|||
151 | :content => 'none', |
|
|||
152 | :attributes => {:href => "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D="} |
|
|||
153 | end |
|
118 | end | |
154 |
|
119 | |||
155 | def test_context_menu_should_not_include_null_value_for_required_custom_fields |
|
120 | def test_context_menu_should_not_include_null_value_for_required_custom_fields | |
@@ -158,10 +123,13 class ContextMenusControllerTest < ActionController::TestCase | |||||
158 | @request.session[:user_id] = 2 |
|
123 | @request.session[:user_id] = 2 | |
159 | get :issues, :ids => [1, 2] |
|
124 | get :issues, :ids => [1, 2] | |
160 |
|
125 | |||
161 | assert_tag 'a', |
|
126 | assert_select "li.cf_#{field.id}" do | |
162 | :content => 'List', |
|
127 | assert_select 'a[href=#]', :text => 'List' | |
163 | :attributes => {:href => '#'}, |
|
128 | assert_select 'ul' do | |
164 | :sibling => {:tag => 'ul', :children => {:count => 2}} |
|
129 | assert_select 'a', 2 | |
|
130 | assert_select 'a', :text => 'none', :count => 0 | |||
|
131 | end | |||
|
132 | end | |||
165 | end |
|
133 | end | |
166 |
|
134 | |||
167 | def test_context_menu_on_single_issue_should_select_current_custom_field_value |
|
135 | def test_context_menu_on_single_issue_should_select_current_custom_field_value | |
@@ -173,13 +141,13 class ContextMenusControllerTest < ActionController::TestCase | |||||
173 | @request.session[:user_id] = 2 |
|
141 | @request.session[:user_id] = 2 | |
174 | get :issues, :ids => [1] |
|
142 | get :issues, :ids => [1] | |
175 |
|
143 | |||
176 | assert_tag 'a', |
|
144 | assert_select "li.cf_#{field.id}" do | |
177 | :content => 'List', |
|
145 | assert_select 'a[href=#]', :text => 'List' | |
178 | :attributes => {:href => '#'}, |
|
146 | assert_select 'ul' do | |
179 | :sibling => {:tag => 'ul', :children => {:count => 3}} |
|
147 | assert_select 'a', 3 | |
180 | assert_tag 'a', |
|
148 | assert_select 'a.icon-checked', :text => 'Bar' | |
181 | :content => 'Bar', |
|
149 | end | |
182 | :attributes => {:class => /icon-checked/} |
|
150 | end | |
183 | end |
|
151 | end | |
184 |
|
152 | |||
185 | def test_context_menu_should_include_bool_custom_fields |
|
153 | def test_context_menu_should_include_bool_custom_fields | |
@@ -188,14 +156,15 class ContextMenusControllerTest < ActionController::TestCase | |||||
188 | @request.session[:user_id] = 2 |
|
156 | @request.session[:user_id] = 2 | |
189 | get :issues, :ids => [1] |
|
157 | get :issues, :ids => [1] | |
190 |
|
158 | |||
191 | assert_tag 'a', |
|
159 | assert_select "li.cf_#{field.id}" do | |
192 | :content => 'Bool', |
|
160 | assert_select 'a[href=#]', :text => 'Bool' | |
193 | :attributes => {:href => '#'}, |
|
161 | assert_select 'ul' do | |
194 | :sibling => {:tag => 'ul', :children => {:count => 3}} |
|
162 | assert_select 'a', 3 | |
195 |
|
163 | assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=0", :text => 'No' | ||
196 | assert_tag 'a', |
|
164 | assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=1", :text => 'Yes' | |
197 | :content => 'Yes', |
|
165 | assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=", :text => 'none' | |
198 | :attributes => {:href => "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=1"} |
|
166 | end | |
|
167 | end | |||
199 | end |
|
168 | end | |
200 |
|
169 | |||
201 | def test_context_menu_should_include_user_custom_fields |
|
170 | def test_context_menu_should_include_user_custom_fields | |
@@ -204,14 +173,14 class ContextMenusControllerTest < ActionController::TestCase | |||||
204 | @request.session[:user_id] = 2 |
|
173 | @request.session[:user_id] = 2 | |
205 | get :issues, :ids => [1] |
|
174 | get :issues, :ids => [1] | |
206 |
|
175 | |||
207 | assert_tag 'a', |
|
176 | assert_select "li.cf_#{field.id}" do | |
208 | :content => 'User', |
|
177 | assert_select 'a[href=#]', :text => 'User' | |
209 | :attributes => {:href => '#'}, |
|
178 | assert_select 'ul' do | |
210 |
|
|
179 | assert_select 'a', Project.find(1).members.count + 1 | |
211 |
|
180 | assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=2", :text => 'John Smith' | ||
212 | assert_tag 'a', |
|
181 | assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=", :text => 'none' | |
213 | :content => 'John Smith', |
|
182 | end | |
214 | :attributes => {:href => "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=2"} |
|
183 | end | |
215 | end |
|
184 | end | |
216 |
|
185 | |||
217 | def test_context_menu_should_include_version_custom_fields |
|
186 | def test_context_menu_should_include_version_custom_fields | |
@@ -219,14 +188,14 class ContextMenusControllerTest < ActionController::TestCase | |||||
219 | @request.session[:user_id] = 2 |
|
188 | @request.session[:user_id] = 2 | |
220 | get :issues, :ids => [1] |
|
189 | get :issues, :ids => [1] | |
221 |
|
190 | |||
222 | assert_tag 'a', |
|
191 | assert_select "li.cf_#{field.id}" do | |
223 | :content => 'Version', |
|
192 | assert_select 'a[href=#]', :text => 'Version' | |
224 | :attributes => {:href => '#'}, |
|
193 | assert_select 'ul' do | |
225 |
|
|
194 | assert_select 'a', Project.find(1).shared_versions.count + 1 | |
226 |
|
195 | assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=3", :text => '2.0' | ||
227 | assert_tag 'a', |
|
196 | assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=", :text => 'none' | |
228 | :content => '2.0', |
|
197 | end | |
229 | :attributes => {:href => "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=3"} |
|
198 | end | |
230 | end |
|
199 | end | |
231 |
|
200 | |||
232 | def test_context_menu_by_assignable_user_should_include_assigned_to_me_link |
|
201 | def test_context_menu_by_assignable_user_should_include_assigned_to_me_link | |
@@ -235,9 +204,7 class ContextMenusControllerTest < ActionController::TestCase | |||||
235 | assert_response :success |
|
204 | assert_response :success | |
236 | assert_template 'context_menu' |
|
205 | assert_template 'context_menu' | |
237 |
|
206 | |||
238 | assert_tag :tag => 'a', :content => / me /, |
|
207 | assert_select 'a[href=?]', '/issues/bulk_update?ids%5B%5D=1&issue%5Bassigned_to_id%5D=2', :text => / me / | |
239 | :attributes => { :href => '/issues/bulk_update?ids%5B%5D=1&issue%5Bassigned_to_id%5D=2', |
|
|||
240 | :class => '' } |
|
|||
241 | end |
|
208 | end | |
242 |
|
209 | |||
243 | def test_context_menu_should_propose_shared_versions_for_issues_from_different_projects |
|
210 | def test_context_menu_should_propose_shared_versions_for_issues_from_different_projects | |
@@ -249,7 +216,7 class ContextMenusControllerTest < ActionController::TestCase | |||||
249 | assert_template 'context_menu' |
|
216 | assert_template 'context_menu' | |
250 |
|
217 | |||
251 | assert_include version, assigns(:versions) |
|
218 | assert_include version, assigns(:versions) | |
252 |
assert_t |
|
219 | assert_select 'a', :text => 'eCookbook - Shared' | |
253 | end |
|
220 | end | |
254 |
|
221 | |||
255 | def test_context_menu_issue_visibility |
|
222 | def test_context_menu_issue_visibility | |
@@ -258,16 +225,16 class ContextMenusControllerTest < ActionController::TestCase | |||||
258 | assert_template 'context_menu' |
|
225 | assert_template 'context_menu' | |
259 | assert_equal [1], assigns(:issues).collect(&:id) |
|
226 | assert_equal [1], assigns(:issues).collect(&:id) | |
260 | end |
|
227 | end | |
261 |
|
228 | |||
262 | def test_time_entries_context_menu |
|
229 | def test_time_entries_context_menu | |
263 | @request.session[:user_id] = 2 |
|
230 | @request.session[:user_id] = 2 | |
264 | get :time_entries, :ids => [1, 2] |
|
231 | get :time_entries, :ids => [1, 2] | |
265 | assert_response :success |
|
232 | assert_response :success | |
266 | assert_template 'time_entries' |
|
233 | assert_template 'time_entries' | |
267 | assert_tag 'a', :content => 'Edit' |
|
234 | ||
268 | assert_no_tag 'a', :content => 'Edit', :attributes => {:class => /disabled/} |
|
235 | assert_select 'a:not(.disabled)', :text => 'Edit' | |
269 | end |
|
236 | end | |
270 |
|
237 | |||
271 | def test_time_entries_context_menu_without_edit_permission |
|
238 | def test_time_entries_context_menu_without_edit_permission | |
272 | @request.session[:user_id] = 2 |
|
239 | @request.session[:user_id] = 2 | |
273 | Role.find_by_name('Manager').remove_permission! :edit_time_entries |
|
240 | Role.find_by_name('Manager').remove_permission! :edit_time_entries | |
@@ -275,6 +242,6 class ContextMenusControllerTest < ActionController::TestCase | |||||
275 | get :time_entries, :ids => [1, 2] |
|
242 | get :time_entries, :ids => [1, 2] | |
276 | assert_response :success |
|
243 | assert_response :success | |
277 | assert_template 'time_entries' |
|
244 | assert_template 'time_entries' | |
278 | assert_tag 'a', :content => 'Edit', :attributes => {:class => /disabled/} |
|
245 | assert_select 'a.disabled', :text => 'Edit' | |
279 | end |
|
246 | end | |
280 | end |
|
247 | end |
General Comments 0
You need to be logged in to leave comments.
Login now