Project

General

Profile

Patch #21805 » 0001-Improve-accessibility-for-icon-only-links.patch

Daniel Ritz, 2016-01-23 18:54

View differences:

app/helpers/application_helper.rb
37 37
    User.current.allowed_to?({:controller => controller, :action => action}, @project)
38 38
  end
39 39

  
40
  # Creates a link with only an icon, without visible text. A hidden <span> is added
41
  # using the :title attribute for accessibility
42
  #
43
  # @param [String or Hash] url
44
  # @param [Hash] html_options Options passed to link_to
45
  def icon_link(url, options = {})
46
    link_to(icon_link_content(options), url, options)
47
  end
48

  
49
  # Like link_to_function for icon only links, similar to icon_link
50
  #
51
  # @param [String] funct The function
52
  # @param [Hash] html_options Options passed to link_to
53
  def icon_link_to_function(funct, options)
54
    link_to_function(icon_link_content(options), options)
55
  end
56

  
57
  # Display an icon-only link if user is authorized
58
  #
59
  # @param [Hash] options Hash params. This will checked by authorize_for to see if the user is authorized
60
  # @param [optional, Hash] html_options Options passed to link_to
61
  # @param [optional, Hash] parameters_for_method_reference Extra parameters for link_to
62
  def icon_link_if_authorized(options = {}, html_options = nil, *parameters_for_method_reference)
63
    if authorize_for(options[:controller] || params[:controller], options[:action])
64
      link_to(icon_link_content(html_options), options, html_options, *parameters_for_method_reference)
65
    end
66
  end
67

  
40 68
  # Display a link if user is authorized
41 69
  #
42 70
  # @param [String] name Anchor text (passed to link_to)
......
454 482
  end
455 483

  
456 484
  def reorder_links(name, url, method = :post)
457
    link_to('',
458
            url.merge({"#{name}[move_to]" => 'highest'}), :method => method,
459
            :title => l(:label_sort_highest), :class => 'icon-only icon-move-top') +
460
    link_to('',
461
            url.merge({"#{name}[move_to]" => 'higher'}), :method => method,
462
            :title => l(:label_sort_higher), :class => 'icon-only icon-move-up') +
463
    link_to('',
464
            url.merge({"#{name}[move_to]" => 'lower'}), :method => method,
465
            :title => l(:label_sort_lower), :class => 'icon-only icon-move-down') +
466
    link_to('',
467
            url.merge({"#{name}[move_to]" => 'lowest'}), :method => method,
468
            :title => l(:label_sort_lowest), :class => 'icon-only icon-move-bottom')
485
    icon_link(url.merge({"#{name}[move_to]" => 'highest'}), :method => method,
486
              :title => l(:label_sort_highest), :class => 'icon-only icon-move-top') +
487
    icon_link(url.merge({"#{name}[move_to]" => 'higher'}), :method => method,
488
              :title => l(:label_sort_higher), :class => 'icon-only icon-move-up') +
489
    icon_link(url.merge({"#{name}[move_to]" => 'lower'}), :method => method,
490
              :title => l(:label_sort_lower), :class => 'icon-only icon-move-down') +
491
    icon_link(url.merge({"#{name}[move_to]" => 'lowest'}), :method => method,
492
              :title => l(:label_sort_lowest), :class => 'icon-only icon-move-bottom')
469 493
  end
470 494

  
471 495
  def breadcrumb(*args)
......
887 911
      @current_section += 1
888 912
      if @current_section > 1
889 913
        content_tag('div',
890
          link_to('', options[:edit_section_links].merge(:section => @current_section),
891
                  :class => 'icon-only icon-edit'),
914
          icon_link(options[:edit_section_links].merge(:section => @current_section),
915
                    :class => 'icon-only icon-edit',
916
                    :title => l(:button_edit_section)),
892 917
          :class => 'contextual',
893
          :title => l(:button_edit_section),
894 918
          :id => "section-#{@current_section}") + heading.html_safe
895 919
      else
896 920
        heading
......
1335 1359
    return self
1336 1360
  end
1337 1361

  
1362
  def icon_link_content(options = {})
1363
    title = options[:title]
1364
    title.nil? ? '' : content_tag(:span, title, :class => 'hidden-for-sighted')
1365
  end
1366

  
1338 1367
  def link_to_content_update(text, url_params = {}, html_options = {})
1339 1368
    link_to(text, url_params, html_options)
1340 1369
  end
app/helpers/email_addresses_helper.rb
22 22
  # Returns a link to enable or disable notifications for the address
23 23
  def toggle_email_address_notify_link(address)
24 24
    if address.notify?
25
      link_to '',
25
      icon_link(
26 26
        user_email_address_path(address.user, address, :notify => '0'),
27 27
        :method => :put, :remote => true,
28 28
        :title => l(:label_disable_notifications),
29
        :class => 'icon icon-email'
29
        :class => 'icon icon-email')
30 30
    else
31
      link_to '',
31
      icon_link(
32 32
        user_email_address_path(address.user, address, :notify => '1'),
33 33
        :method => :put, :remote => true,
34 34
        :title => l(:label_enable_notifications),
35
        :class => 'icon icon-email-disabled'
35
        :class => 'icon icon-email-disabled')
36 36
    end
37 37
  end
38 38
end
app/helpers/issues_helper.rb
442 442
        # Link to the attachment if it has not been removed
443 443
        value = link_to_attachment(atta, :download => true, :only_path => options[:only_path])
444 444
        if options[:only_path] != false && atta.is_text?
445
          value += link_to('',
446
                           { :controller => 'attachments', :action => 'show',
447
                             :id => atta, :filename => atta.filename },
448
                           :class => 'icon icon-magnifier')
445
          value += icon_link({ :controller => 'attachments', :action => 'show',
446
                               :id => atta, :filename => atta.filename },
447
                             :class => 'icon icon-magnifier',
448
                             :title => l(:button_view))
449 449
        end
450 450
      else
451 451
        value = content_tag("i", h(value)) if value
app/helpers/journals_helper.rb
30 30
    editable = User.current.logged? && (User.current.allowed_to?(:edit_issue_notes, issue.project) || (journal.user == User.current && User.current.allowed_to?(:edit_own_issue_notes, issue.project)))
31 31
    links = []
32 32
    if !journal.notes.blank?
33
      links << link_to('',
34
                       quoted_issue_path(issue, :journal_id => journal),
35
                       :remote => true,
36
                       :method => 'post',
37
                       :title => l(:button_quote),
38
                       :class => 'icon-only icon-comment'
39
                      ) if options[:reply_links]
40
      links << link_to('',
41
                       edit_journal_path(journal),
42
                       :remote => true,
43
                       :method => 'get',
44
                       :title => l(:button_edit),
45
                       :class => 'icon-only icon-edit'
46
                      ) if editable
47
      links << link_to('',
48
                       journal_path(journal, :notes => ""),
49
                       :remote => true,
50
                       :method => 'put', :data => {:confirm => l(:text_are_you_sure)}, 
51
                       :title => l(:button_delete),
52
                       :class => 'icon-only icon-del'
53
                      ) if editable
33
      links << icon_link(quoted_issue_path(issue, :journal_id => journal),
34
                         :remote => true,
35
                         :method => 'post',
36
                         :title => l(:button_quote),
37
                         :class => 'icon-only icon-comment'
38
                        ) if options[:reply_links]
39
      links << icon_link(edit_journal_path(journal),
40
                         :remote => true,
41
                         :method => 'get',
42
                         :title => l(:button_edit),
43
                         :class => 'icon-only icon-edit'
44
                        ) if editable
45
      links << icon_link(journal_path(journal, :notes => ""),
46
                         :remote => true,
47
                         :method => 'put', :data => {:confirm => l(:text_are_you_sure)},
48
                         :title => l(:button_delete),
49
                         :class => 'icon-only icon-del'
50
                        ) if editable
54 51
    end
55 52
    content << content_tag('div', links.join(' ').html_safe, :class => 'contextual') unless links.empty?
56 53
    content << textilizable(journal, :notes)
app/helpers/watchers_helper.rb
58 58
               :object_id => object.id,
59 59
               :user_id => user}
60 60
        s << ' '
61
        s << link_to('', url,
62
                     :remote => true, :method => 'delete',
63
                     :class => "delete icon-only icon-del",
64
                     :title => l(:button_delete))
61
        s << icon_link(url, :remote => true, :method => 'delete',
62
                       :class => "delete icon-only icon-del",
63
                       :title => l(:button_delete))
65 64
      end
66 65
      content << content_tag('li', s, :class => "user-#{user.id}")
67 66
    end
app/views/attachments/_links.html.erb
1 1
<div class="attachments">
2 2
<div class="contextual">
3
  <%= link_to('',
4
              container_attachments_edit_path(container),
5
              :title => l(:label_edit_attachments),
6
              :class => 'icon-only icon-edit'
7
             ) if options[:editable] %>
3
  <%= icon_link(container_attachments_edit_path(container),
4
                :title => l(:label_edit_attachments),
5
                :class => 'icon-only icon-edit'
6
               ) if options[:editable] %>
8 7
</div>
9 8
<% for attachment in attachments %>
10 9
<p><%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
11 10
  <% if attachment.is_text? %>
12
    <%= link_to '',
13
                { :controller => 'attachments', :action => 'show',
14
                  :id => attachment, :filename => attachment.filename },
15
                :class => 'icon icon-magnifier',
16
                :title => l(:button_view) %>
11
    <%= icon_link({ :controller => 'attachments', :action => 'show',
12
                    :id => attachment, :filename => attachment.filename },
13
                  :class => 'icon icon-magnifier',
14
                  :title => l(:button_view)) %>
17 15
  <% end %>
18 16
  <%= " - #{attachment.description}" unless attachment.description.blank? %>
19 17
  <span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
20 18
  <% if options[:deletable] %>
21
    <%= link_to '', attachment_path(attachment),
22
                :data => {:confirm => l(:text_are_you_sure)},
23
                :method => :delete,
24
                :class => 'delete icon-only icon-del',
25
                :title => l(:button_delete) %>
19
    <%= icon_link(attachment_path(attachment),
20
                  :data => {:confirm => l(:text_are_you_sure)},
21
                  :method => :delete,
22
                  :class => 'delete icon-only icon-del',
23
                  :title => l(:button_delete)) %>
26 24
  <% end %>
27 25
  <% if options[:author] %>
28 26
    <span class="author"><%= attachment.author %>, <%= format_time(attachment.created_on) %></span>
app/views/issues/_attributes.html.erb
20 20

  
21 21
<% if @issue.safe_attribute?('category_id') && @issue.project.issue_categories.any? %>
22 22
<p><%= f.select :category_id, (@issue.project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true, :required => @issue.required_attribute?('category_id') %>
23
<%= link_to('',
24
            new_project_issue_category_path(@issue.project),
25
            :remote => true,
26
            :method => 'get',
27
            :title => l(:label_issue_category_new),
28
            :tabindex => 200,
29
            :class => 'icon-only icon-add'
30
           ) if User.current.allowed_to?(:manage_categories, @issue.project) %></p>
23
<%= icon_link(new_project_issue_category_path(@issue.project),
24
              :remote => true,
25
              :method => 'get',
26
              :title => l(:label_issue_category_new),
27
              :tabindex => 200,
28
              :class => 'icon-only icon-add'
29
             ) if User.current.allowed_to?(:manage_categories, @issue.project) %></p>
31 30
<% end %>
32 31

  
33 32
<% if @issue.safe_attribute?('fixed_version_id') && @issue.assignable_versions.any? %>
34 33
<p><%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), :include_blank => true, :required => @issue.required_attribute?('fixed_version_id') %>
35
<%= link_to('',
36
            new_project_version_path(@issue.project),
37
            :remote => true,
38
            :method => 'get',
39
            :title => l(:label_version_new),
40
            :tabindex => 200,
41
            :class => 'icon-only icon-add'
42
           ) if User.current.allowed_to?(:manage_versions, @issue.project) %>
34
<%= icon_link(new_project_version_path(@issue.project),
35
              :remote => true,
36
              :method => 'get',
37
              :title => l(:label_version_new),
38
              :tabindex => 200,
39
              :class => 'icon-only icon-add'
40
             ) if User.current.allowed_to?(:manage_versions, @issue.project) %>
43 41
</p>
44 42
<% end %>
45 43
</div>
app/views/issues/_relations.html.erb
19 19
  <td class="status"><%= other_issue.status.name %></td>
20 20
  <td class="start_date"><%= format_date(other_issue.start_date) %></td>
21 21
  <td class="due_date"><%= format_date(other_issue.due_date) %></td>
22
  <td class="buttons"><%= link_to('',
23
                                  relation_path(relation),
24
                                  :remote => true,
25
                                  :method => :delete,
26
                                  :data => {:confirm => l(:text_are_you_sure)},
27
                                  :title => l(:label_relation_delete),
28
                                  :class => 'icon-only icon-link-break'
29
                                 ) if User.current.allowed_to?(:manage_issue_relations, @project) %></td>
22
  <td class="buttons"><%= icon_link(relation_path(relation),
23
                                    :remote => true,
24
                                    :method => :delete,
25
                                    :data => {:confirm => l(:text_are_you_sure)},
26
                                    :title => l(:label_relation_delete),
27
                                    :class => 'icon-only icon-link-break'
28
                                   ) if User.current.allowed_to?(:manage_issue_relations, @project) %></td>
30 29
  </tr>
31 30
<% end %>
32 31
</table>
app/views/my/blocks/_timelog.html.erb
42 42
    <td class="hours"><%= html_hours("%.2f" % entry.hours) %></td>
43 43
    <td class="buttons">
44 44
    <% if entry.editable_by?(@user) -%>
45
        <%= link_to '', {:controller => 'timelog', :action => 'edit', :id => entry},
46
                    :title => l(:button_edit),
47
                    :class => 'icon-only icon-edit' %>
48
        <%= link_to '', {:controller => 'timelog', :action => 'destroy', :id => entry},
49
                    :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,
50
                    :title => l(:button_delete),
51
                    :class => 'icon-only icon-del' %>
45
        <%= icon_link({:controller => 'timelog', :action => 'edit', :id => entry},
46
                      :title => l(:button_edit),
47
                      :class => 'icon-only icon-edit') %>
48
        <%= icon_link({:controller => 'timelog', :action => 'destroy', :id => entry},
49
                      :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,
50
                      :title => l(:button_delete),
51
                      :class => 'icon-only icon-del') %>
52 52
    <% end -%>
53 53
    </td>
54 54
    </tr>
app/views/news/show.html.erb
36 36
<% @comments.each do |comment| %>
37 37
    <% next if comment.new_record? %>
38 38
    <div class="contextual">
39
    <%= link_to_if_authorized '', {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
40
                              :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,
41
                              :title => l(:button_delete),
42
                              :class => 'icon-only icon-del' %>
39
    <%= icon_link_if_authorized({:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
40
                                :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,
41
                                :title => l(:button_delete),
42
                                :class => 'icon-only icon-del') %>
43 43
    </div>
44 44
    <h4><%= avatar(comment.author, :size => "24") %><%= authoring comment.created_on, comment.author %></h4>
45 45
    <div class="wiki">
app/views/reports/issue_report.html.erb
3 3
<div class="splitcontentleft">
4 4
<h3>
5 5
  <%=l(:field_tracker)%>&nbsp;
6
  <%= link_to '', project_issues_report_details_path(@project, :detail => 'tracker'), :class => 'icon-only icon-zoom-in' %>
6
  <%= icon_link project_issues_report_details_path(@project, :detail => 'tracker'),
7
                :class => 'icon-only icon-zoom-in',
8
                :title => l(:label_zoom_in)
9
  %>
7 10
</h3>
8 11
<%= render :partial => 'simple', :locals => { :data => @issues_by_tracker, :field_name => "tracker_id", :rows => @trackers } %>
9 12
<br />
10 13
<h3>
11 14
  <%=l(:field_priority)%>&nbsp;
12
  <%= link_to '', project_issues_report_details_path(@project, :detail => 'priority'), :class => 'icon-only icon-zoom-in' %>
15
  <%= icon_link project_issues_report_details_path(@project, :detail => 'priority'),
16
                :class => 'icon-only icon-zoom-in',
17
                :title => l(:label_zoom_in)
18
  %>
13 19
</h3>
14 20
<%= render :partial => 'simple', :locals => { :data => @issues_by_priority, :field_name => "priority_id", :rows => @priorities } %>
15 21
<br />
16 22
<h3>
17 23
  <%=l(:field_assigned_to)%>&nbsp;
18
  <%= link_to '', project_issues_report_details_path(@project, :detail => 'assigned_to'), :class => 'icon-only icon-zoom-in' %>
24
  <%= icon_link project_issues_report_details_path(@project, :detail => 'assigned_to'),
25
                :class => 'icon-only icon-zoom-in',
26
                :title => l(:label_zoom_in)
27
  %>
19 28
</h3>
20 29
<%= render :partial => 'simple', :locals => { :data => @issues_by_assigned_to, :field_name => "assigned_to_id", :rows => @assignees } %>
21 30
<br />
22 31
<h3>
23 32
  <%=l(:field_author)%>&nbsp;
24
  <%= link_to '', project_issues_report_details_path(@project, :detail => 'author'), :class => 'icon-only icon-zoom-in' %>
33
  <%= icon_link project_issues_report_details_path(@project, :detail => 'author'),
34
                :class => 'icon-only icon-zoom-in',
35
                :title => l(:label_zoom_in)
36
  %>
25 37
</h3>
26 38
<%= render :partial => 'simple', :locals => { :data => @issues_by_author, :field_name => "author_id", :rows => @authors } %>
27 39
<br />
......
31 43
<div class="splitcontentright">
32 44
<h3>
33 45
  <%=l(:field_version)%>&nbsp;
34
  <%= link_to '', project_issues_report_details_path(@project, :detail => 'version'), :class => 'icon-only icon-zoom-in' %>
46
  <%= icon_link project_issues_report_details_path(@project, :detail => 'version'),
47
                :class => 'icon-only icon-zoom-in',
48
                :title => l(:label_zoom_in)
49
  %>
35 50
</h3>
36 51
<%= render :partial => 'simple', :locals => { :data => @issues_by_version, :field_name => "fixed_version_id", :rows => @versions } %>
37 52
<br />
38 53
<% if @project.children.any? %>
39 54
<h3>
40 55
  <%=l(:field_subproject)%>&nbsp;
41
  <%= link_to '', project_issues_report_details_path(@project, :detail => 'subproject'), :class => 'icon-only icon-zoom-in' %>
56
  <%= icon_link project_issues_report_details_path(@project, :detail => 'subproject'),
57
                :class => 'icon-only icon-zoom-in',
58
                :title => l(:label_zoom_in)
59
  %>
42 60
</h3>
43 61
<%= render :partial => 'simple', :locals => { :data => @issues_by_subproject, :field_name => "project_id", :rows => @subprojects } %>
44 62
<br />
45 63
<% end %>
46 64
<h3>
47 65
  <%=l(:field_category)%>&nbsp;
48
  <%= link_to '', project_issues_report_details_path(@project, :detail => 'category'), :class => 'icon-only icon-zoom-in' %>
66
  <%= icon_link project_issues_report_details_path(@project, :detail => 'category'),
67
                :class => 'icon-only icon-zoom-in',
68
                :title => l(:label_zoom_in)
69
  %>
49 70
</h3>
50 71
<%= render :partial => 'simple', :locals => { :data => @issues_by_category, :field_name => "category_id", :rows => @categories } %>
51 72
<br />
app/views/repositories/_related_issues.html.erb
11 11
<ul>
12 12
<% @changeset.issues.visible.each do |issue| %>
13 13
  <li id="<%= "related-issue-#{issue.id}" %>"><%= link_to_issue issue %>
14
    <%= link_to('',
15
                {:controller => 'repositories', :action => 'remove_related_issue',
16
                  :id => @project, :repository_id => @repository.identifier_param,
17
                  :rev => @changeset.identifier, :issue_id => issue},
18
                :remote => true,
19
                :method => :delete,
20
                :data => {:confirm => l(:text_are_you_sure)},
21
                :title => l(:label_relation_delete),
22
                :class => 'icon-only icon-link-break'
23
               ) if manage_allowed %>
14
    <%= icon_link({:controller => 'repositories', :action => 'remove_related_issue',
15
                    :id => @project, :repository_id => @repository.identifier_param,
16
                    :rev => @changeset.identifier, :issue_id => issue},
17
                  :remote => true,
18
                  :method => :delete,
19
                  :data => {:confirm => l(:text_are_you_sure)},
20
                  :title => l(:label_relation_delete),
21
                  :class => 'icon-only icon-link-break'
22
                 ) if manage_allowed %>
24 23
  </li>
25 24
<% end %>
26 25
</ul>
app/views/roles/permissions.html.erb
9 9
    <th><%=l(:label_permissions)%></th>
10 10
    <% @roles.each do |role| %>
11 11
    <th>
12
        <%= link_to_function('',
13
                             "toggleCheckboxesBySelector('input.role-#{role.id}')",
14
                             :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
15
                             :class => 'icon-only icon-checked') %>
12
        <%= icon_link_to_function("toggleCheckboxesBySelector('input.role-#{role.id}')",
13
                                  :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
14
                                  :class => 'icon-only icon-checked') %>
16 15
        <%= content_tag(role.builtin? ? 'em' : 'span', role.name) %>
17 16
    </th>
18 17
    <% end %>
app/views/settings/_repositories.html.erb
119 119
                    ) %>
120 120
      </td>
121 121
      <td class="buttons">
122
        <%= link_to('', '#',
123
                    :class => 'delete-commit-keywords icon-only icon-del') %>
122
        <%= icon_link('#',
123
                      :class => 'delete-commit-keywords icon-only icon-del',
124
                      :title => l(:button_delete)
125
                     ) %>
124 126
      </td>
125 127
    </tr>
126 128
    <% end %>
......
130 132
      <td></td>
131 133
      <td></td>
132 134
      <td class="buttons">
133
        <%= link_to('', '#',
134
                    :class => 'add-commit-keywords icon-only icon-add') %>
135
        <%= icon_link('#',
136
                      :class => 'add-commit-keywords icon-only icon-add',
137
                      :title => l(:button_add)
138
                     ) %>
135 139
      </td>
136 140
    </tr>
137 141
  </tbody>
app/views/timelog/_list.html.erb
21 21
    <%= raw @query.inline_columns.map {|column| "<td class=\"#{column.css_classes}\">#{column_content(column, entry)}</td>"}.join %>
22 22
    <td class="buttons">
23 23
    <% if entry.editable_by?(User.current) -%>
24
        <%= link_to '', edit_time_entry_path(entry),
25
                    :title => l(:button_edit),
26
                    :class => 'icon icon-edit' %>
27
        <%= link_to '', time_entry_path(entry),
28
                    :data => {:confirm => l(:text_are_you_sure)},
29
                    :method => :delete,
30
                    :title => l(:button_delete),
31
                    :class => 'icon-only icon-del' %>
24
        <%= icon_link edit_time_entry_path(entry),
25
                      :title => l(:button_edit),
26
                      :class => 'icon icon-edit' %>
27
        <%= icon_link time_entry_path(entry),
28
                      :data => {:confirm => l(:text_are_you_sure)},
29
                      :method => :delete,
30
                      :title => l(:button_delete),
31
                      :class => 'icon-only icon-del' %>
32 32
    <% end -%>
33 33
    </td>
34 34
  </tr>
test/unit/helpers/application_helper_test.rb
1242 1242
    result = textilizable(raw, :edit_section_links => {:controller => 'wiki', :action => 'edit', :project_id => '1', :id => 'Test'}).gsub("\n", "")
1243 1243

  
1244 1244
    # heading that contains inline code
1245
    assert_match Regexp.new('<div class="contextual" title="Edit this section" id="section-4">' +
1246
      '<a class="icon-only icon-edit" href="/projects/1/wiki/Test/edit\?section=4"></a></div>' +
1245
    assert_match Regexp.new('<div class="contextual" id="section-4">' +
1246
      '<a class="icon-only icon-edit" title="Edit this section" href="/projects/1/wiki/Test/edit\?section=4">' +
1247
      '<span class="hidden-for-sighted">Edit this section</span>' +
1248
      '</a></div>' +
1247 1249
      '<a name="Subtitle-with-inline-code"></a>' +
1248 1250
      '<h2 >Subtitle with <code>inline code</code><a href="#Subtitle-with-inline-code" class="wiki-anchor">&para;</a></h2>'),
1249 1251
      result
1250 1252

  
1251 1253
    # last heading
1252
    assert_match Regexp.new('<div class="contextual" title="Edit this section" id="section-5">' +
1253
      '<a class="icon-only icon-edit" href="/projects/1/wiki/Test/edit\?section=5"></a></div>' +
1254
    assert_match Regexp.new('<div class="contextual" id="section-5">' +
1255
      '<a class="icon-only icon-edit" title="Edit this section" href="/projects/1/wiki/Test/edit\?section=5">' +
1256
      '<span class="hidden-for-sighted">Edit this section</span>' +
1257
      '</a></div>' +
1254 1258
      '<a name="Subtitle-after-pre-tag"></a>' +
1255 1259
      '<h2 >Subtitle after pre tag<a href="#Subtitle-after-pre-tag" class="wiki-anchor">&para;</a></h2>'),
1256 1260
      result
(1-1/3)