[#263] Update tests for views in the new layout

This commit is contained in:
Eric Davis 2011-11-06 17:46:31 -08:00
parent a911d83889
commit f10412ef71
6 changed files with 19 additions and 43 deletions

View File

@ -120,9 +120,9 @@
:class => 'icon-duplicate', :disabled => !@can[:copy] %></li>
<% end %>
<li class="move"><%= context_menu_link l(:button_move), {:controller => 'issues', :action => 'move', :ids => @issues.collect(&:id)},
<li class="move"><%= context_menu_link l(:button_move), new_issue_move_path(:ids => @issues.collect(&:id)),
:class => 'context_item', :disabled => !@can[:move] %></li>
<li class="copy"><%= context_menu_link l(:button_copy), {:controller => 'issues', :action => 'bulk_copy', :project_id => @project, :ids => @issues.collect(&:id)},
<li class="copy"><%= context_menu_link l(:button_copy), new_issue_move_path(:ids => @issues.collect(&:id), :copy_options => {:copy => 't'}),
:class => 'context_item' %></li>
<li class="delete"><%= context_menu_link l(:button_delete), {:controller => 'issues', :action => 'destroy', :ids => @issues.collect(&:id)},
:method => :post, :confirm => l(:text_issues_destroy_confirmation), :class => 'context_item', :disabled => !@can[:delete] %></li>

View File

@ -53,6 +53,7 @@
end
%>
<% if User.current.logged? || !Setting.login_required? %>
<ul id="account-nav">
<% items_for_main_level.each do |item| %>
<%= render_menu_node(item) %>
@ -94,6 +95,7 @@
<% end %>
</li>
</ul>
<% end %>
</div>
</div>

View File

@ -45,23 +45,18 @@ class ContextMenusControllerTest < ActionController::TestCase
:attributes => { :href => '/projects/ecookbook/issues/1/copy',
:class => 'icon-duplicate' }
assert_tag :tag => 'a', :content => 'Copy',
:attributes => { :href => '/issues/move/new?copy_options%5Bcopy%5D=t&amp;ids%5B%5D=1',
:class => 'icon-copy' }
:attributes => { :href => '/issues/move/new?copy_options%5Bcopy%5D=t&amp;ids%5B%5D=1' }
assert_tag :tag => 'a', :content => 'Move',
:attributes => { :href => '/issues/move/new?ids%5B%5D=1',
:class => 'icon-move' }
:attributes => { :href => '/issues/move/new?ids%5B%5D=1'}
assert_tag :tag => 'a', :content => 'Delete',
:attributes => { :href => '/issues/destroy?ids%5B%5D=1',
:class => 'icon-del' }
:attributes => { :href => '/issues/destroy?ids%5B%5D=1' }
end
def test_context_menu_one_issue_by_anonymous
get :issues, :ids => [1]
assert_response :success
assert_template 'context_menu'
assert_tag :tag => 'a', :content => 'Delete',
:attributes => { :href => '#',
:class => 'icon-del disabled' }
assert_select "a.disabled", :text => /Delete/
end
def test_context_menu_multiple_issues_of_same_project
@ -86,14 +81,11 @@ class ContextMenusControllerTest < ActionController::TestCase
:attributes => { :href => "/issues/bulk_edit?#{ids}&amp;issue%5Bassigned_to_id%5D=3",
:class => '' }
assert_tag :tag => 'a', :content => 'Copy',
:attributes => { :href => "/issues/move/new?copy_options%5Bcopy%5D=t&amp;#{ids}",
:class => 'icon-copy' }
:attributes => { :href => "/issues/move/new?copy_options%5Bcopy%5D=t&amp;#{ids}"}
assert_tag :tag => 'a', :content => 'Move',
:attributes => { :href => "/issues/move/new?#{ids}",
:class => 'icon-move' }
:attributes => { :href => "/issues/move/new?#{ids}"}
assert_tag :tag => 'a', :content => 'Delete',
:attributes => { :href => "/issues/destroy?#{ids}",
:class => 'icon-del' }
:attributes => { :href => "/issues/destroy?#{ids}"}
end
def test_context_menu_multiple_issues_of_different_projects
@ -118,8 +110,7 @@ class ContextMenusControllerTest < ActionController::TestCase
:attributes => { :href => "/issues/bulk_edit?#{ids}&amp;issue%5Bassigned_to_id%5D=2",
:class => '' }
assert_tag :tag => 'a', :content => 'Delete',
:attributes => { :href => "/issues/destroy?#{ids}",
:class => 'icon-del' }
:attributes => { :href => "/issues/destroy?#{ids}"}
end
def test_context_menu_issue_visibility

View File

@ -1373,9 +1373,9 @@ class IssuesControllerTest < ActionController::TestCase
def test_default_search_scope
get :index
assert_tag :div, :attributes => {:id => 'quick-search'},
:child => {:tag => 'form',
:child => {:tag => 'input', :attributes => {:name => 'issues', :type => 'hidden', :value => '1'}}}
assert_select "form#nav-search" do
assert_select "input[type=hidden][name=issues][value=1]"
end
end
def test_reply_to_note

View File

@ -428,21 +428,6 @@ class ProjectsControllerTest < ActionController::TestCase
assert Project.find(1).active?
end
def test_project_breadcrumbs_should_be_limited_to_3_ancestors
CustomField.delete_all
parent = nil
6.times do |i|
p = Project.create!(:name => "Breadcrumbs #{i}", :identifier => "breadcrumbs-#{i}")
p.set_parent!(parent)
get :show, :id => p
assert_tag :h1, :parent => { :attributes => {:id => 'header'}},
:children => { :count => [i, 3].min,
:only => { :tag => 'a' } }
parent = p
end
end
def test_copy_with_project
@request.session[:user_id] = 1 # admin
get :copy, :id => 1

View File

@ -35,19 +35,17 @@ class LayoutTest < ActionController::IntegrationTest
assert_select "#admin-menu", :count => 0
end
def test_top_menu_and_search_not_visible_when_login_required
def test_top_menu_navigation_not_visible_when_login_required
with_settings :login_required => '1' do
get '/'
assert_select "#top-menu > ul", 0
assert_select "#quick-search", 0
assert_select "#account-nav", 0
end
end
def test_top_menu_and_search_visible_when_login_not_required
def test_top_menu_navigation_visible_when_login_not_required
with_settings :login_required => '0' do
get '/'
assert_select "#top-menu > ul"
assert_select "#quick-search"
assert_select "#account-nav"
end
end