Project

General

Profile

Defect #15634 ยป 15634.patch

Takenori TAKAKI, 2021-07-13 07:54

View differences:

app/views/watchers/create.js.erb
4 4
                :locals => {:watchables => @watchables, :users => @users})) %>');
5 5

  
6 6
<% if @watchables.size == 1 %>
7
  $('#watchers').html(
8
    '<%= escape_javascript(
9
           render(:partial => 'watchers/watchers',
10
                  :locals => {:watched => @watchables.first})) %>');
7
  <%= render(:partial => 'watchers/set_watcher',
8
             :locals => {:watched => @watchables, :user => User.current}) %>
11 9
<% end %>
app/views/watchers/destroy.js.erb
1 1
<% if @watchables.size == 1 %>
2
$('#watchers').html('<%= escape_javascript(render(:partial => 'watchers/watchers', :locals => {:watched => @watchables.first})) %>');
2
  <%= render(:partial => 'watchers/set_watcher',
3
            :locals => {:watched => @watchables, :user => User.current}) %>
3 4
<% end %>
test/system/issues_test.rb
290 290
    assert issue1.reload.watched_by?(jsmith)
291 291
  end
292 292

  
293
  def test_change_watch_or_unwatch_icon_from_sidebar
294
    user = User.find(2)
295
    log_user('jsmith', 'jsmith')
296
    visit '/issues/1'
297
    assert page.has_css?('#content .contextual .issue-1-watcher.icon-fav-off')
298
    # add watcher 'jsmith' from sidebar
299
    page.find('#watchers .contextual a', :text => 'Add').click
300
    page.find('#users_for_watcher label', :text => 'John Smith').click
301
    page.find('#new-watcher-form p.buttons input[type=submit]').click
302
    assert page.has_css?('#content .contextual .issue-1-watcher.icon-fav')
303
    # remove watcher 'jsmith' from sidebar
304
    page.find('#watchers ul li.user-2 a.delete').click
305
    assert page.has_css?('#content .contextual .issue-1-watcher.icon-fav-off')
306
  end
307

  
293 308
  def test_bulk_watch_issues_via_context_menu
294 309
    log_user('jsmith', 'jsmith')
295 310
    visit '/issues'
    (1-1/1)