[ARVADOS] updated: 6c40c1c5b000b2eb0967df0f7ebaf613393501bc

Git user git at public.curoverse.com
Thu Jun 1 13:00:26 EDT 2017


Summary of changes:
 .../app/views/application/_breadcrumbs.html.erb    |  2 +-
 .../views/trash_items/_show_trash_rows.html.erb    | 12 +--
 apps/workbench/test/integration/trash_test.rb      | 87 ++++++++++++++++++++++
 services/api/test/fixtures/collections.yml         |  2 +-
 4 files changed, 95 insertions(+), 8 deletions(-)
 create mode 100644 apps/workbench/test/integration/trash_test.rb

       via  6c40c1c5b000b2eb0967df0f7ebaf613393501bc (commit)
      from  5a625a53394fa99ef7fb44ab63104b8195d963df (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 6c40c1c5b000b2eb0967df0f7ebaf613393501bc
Author: radhika <radhika at curoverse.com>
Date:   Thu Jun 1 12:59:57 2017 -0400

    9587: test /trash page

diff --git a/apps/workbench/app/views/application/_breadcrumbs.html.erb b/apps/workbench/app/views/application/_breadcrumbs.html.erb
index 1af3ddc..71af8de 100644
--- a/apps/workbench/app/views/application/_breadcrumbs.html.erb
+++ b/apps/workbench/app/views/application/_breadcrumbs.html.erb
@@ -69,7 +69,7 @@
         <ul class="nav navbar-nav navbar-right">
           <li>
             <a href="/trash">
-              <i class="fa fa-lg fa-fw fa-trash-o" style="padding-right: 1em"></i>
+              <i class="fa fa-lg fa-fw fa-trash-o"></i>Trash
             </a>
           </li>
         </ul>
diff --git a/apps/workbench/app/views/trash_items/_show_trash_rows.html.erb b/apps/workbench/app/views/trash_items/_show_trash_rows.html.erb
index 7e01e3d..0d433bf 100644
--- a/apps/workbench/app/views/trash_items/_show_trash_rows.html.erb
+++ b/apps/workbench/app/views/trash_items/_show_trash_rows.html.erb
@@ -1,7 +1,9 @@
 <% @objects.sort_by { |obj| obj.created_at }.reverse.each do |obj| %>
     <tr data-object-uuid="<%= obj.uuid %>" data-kind="<%= obj.kind %>" >
       <td>
-        <%= check_box_tag 'uuids[]', obj.uuid, false, :class => 'persistent-selection' %>
+        <% if obj.editable? %>
+          <%= check_box_tag 'uuids[]', obj.uuid, false, :class => 'persistent-selection' %>
+        <% end %>
       </td>
       <td>
         <%= if !obj.name.blank? then obj.name else obj.uuid end %>
@@ -11,15 +13,13 @@
         <%= obj.trash_at.to_s if obj.trash_at %>
       </td>
       <td>
-        <% i = 0 %>
-        <% while i < 5 and i < obj.files.length %>
+        <% for i in (0..[2, obj.files.length-1].min) %>
           <% file = obj.files[i] %>
           <% file_path = "#{file[0]}/#{file[1]}" %>
           <%= file_path %><br />
-          <% i += 1 %>
         <% end %>
-        <% if i < obj.files.length %>
-          …
+        <% if obj.files.length > 3 %>
+          ⋮
         <% end %>
       </td>
       <td>
diff --git a/apps/workbench/test/integration/trash_test.rb b/apps/workbench/test/integration/trash_test.rb
new file mode 100644
index 0000000..6cac1be
--- /dev/null
+++ b/apps/workbench/test/integration/trash_test.rb
@@ -0,0 +1,87 @@
+require 'integration_helper'
+
+class TrashTest < ActionDispatch::IntegrationTest
+  setup do
+    need_javascript
+  end
+
+  test "trash page" do
+    deleted = api_fixture('collections')['deleted_on_next_sweep']
+    expired1 = api_fixture('collections')['unique_expired_collection']
+    expired2 = api_fixture('collections')['unique_expired_collection2']
+
+    # visit trash page
+    visit page_with_token('active', "/trash")
+
+    assert_text deleted['name']
+    assert_text expired1['name']
+    assert_text expired2['name']
+    assert_no_text 'foo_file'
+
+    # Un-trash one item using selection dropdown
+    within('tr', text: deleted['name']) do
+      first('input').click
+    end
+
+    click_button 'Selection...'
+    within('.selection-action-container') do
+      click_link 'Un-trash selected items'
+    end
+
+    wait_for_ajax
+
+    assert_text expired1['name']      # this should still be there
+    assert_no_text deleted['name']    # this should no longer be here
+
+    # expired2 is not editable by me; checkbox and recycle button shouldn't be offered
+    within('tr', text: expired2['name']) do
+      assert_nil first('input')
+      assert_nil first('.fa-recycle')
+    end
+
+    # Un-trash another item using the recycle button
+    within('tr', text: expired1['name']) do
+      first('.fa-recycle').click
+      accept_alert
+    end
+
+    wait_for_ajax
+
+    assert_text expired2['name']
+    assert_no_text expired1['name']
+
+    # verify that the two un-trashed items are now shown in /collections page
+    visit page_with_token('active', "/collections")
+    assert_text deleted['uuid']
+    assert_text expired1['uuid']
+    assert_no_text expired2['uuid']
+  end
+
+  test "trash page with search" do
+    deleted = api_fixture('collections')['deleted_on_next_sweep']
+    expired = api_fixture('collections')['unique_expired_collection2']
+
+    visit page_with_token('active', "/trash")
+
+    assert_text deleted['name']
+    assert_text expired['name']
+
+    page.find_field('Search trash').set 'expired'
+
+    assert_text expired['name']
+    assert_no_text deleted['name']
+
+    click_button 'Selection...'
+    within('.selection-action-container') do
+      assert_selector 'li.disabled', text: 'Un-trash selected items'
+    end
+
+    first('input').click
+
+    click_button 'Selection...'
+    within('.selection-action-container') do
+      assert_selector 'li', text: 'Un-trash selected items'
+      assert_selector 'li.disabled', text: 'Un-trash selected items'
+    end
+  end
+end
diff --git a/services/api/test/fixtures/collections.yml b/services/api/test/fixtures/collections.yml
index f48fbf1..8aedbdc 100644
--- a/services/api/test/fixtures/collections.yml
+++ b/services/api/test/fixtures/collections.yml
@@ -297,7 +297,7 @@ unique_expired_collection:
   trash_at: 2001-01-01T00:00:00Z
   delete_at: 2038-01-01T00:00:00Z
   manifest_text: ". 29d7797f1888013986899bc9083783fa+3 0:3:expired\n"
-  name: unique_expired_collection
+  name: unique_expired_collection1
 
 unique_expired_collection2:
   uuid: zzzzz-4zz18-mto52zx1s7sn3jr

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list