[ARVADOS] updated: 96facc8c94c8f2d59d05c64ca3aa845fae59e554

Git user git at public.curoverse.com
Mon Apr 10 17:27:38 EDT 2017


Summary of changes:
 .../app/assets/javascripts/selection.js.erb        |  2 +-
 .../workbench/test/integration/collections_test.rb | 67 +++++++++++++++++++++-
 2 files changed, 67 insertions(+), 2 deletions(-)

       via  96facc8c94c8f2d59d05c64ca3aa845fae59e554 (commit)
      from  78ae065d149dff4cc1027f9c7941a9116f4ae51a (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 96facc8c94c8f2d59d05c64ca3aa845fae59e554
Author: radhika <radhika at curoverse.com>
Date:   Mon Apr 10 17:26:57 2017 -0400

    11365: add integration test to click on lock / unlock and verify file selectors.

diff --git a/apps/workbench/app/assets/javascripts/selection.js.erb b/apps/workbench/app/assets/javascripts/selection.js.erb
index 77c5a33..f60bef7 100644
--- a/apps/workbench/app/assets/javascripts/selection.js.erb
+++ b/apps/workbench/app/assets/javascripts/selection.js.erb
@@ -80,7 +80,7 @@ function enable_disable_selection_actions() {
         closest('li').
         toggleClass('disabled',
                     ($checked.length < 0) ||
-                    !(collection_lock_classes && collection_lock_classes.includes("fa-unlock") && ($checked.length>0)));
+                    !($checked.length > 0 && collection_lock_classes && collection_lock_classes.indexOf("fa-unlock") !=-1));
 }
 
 $(document).
diff --git a/apps/workbench/test/integration/collections_test.rb b/apps/workbench/test/integration/collections_test.rb
index eb9c2e8..5d253e8 100644
--- a/apps/workbench/test/integration/collections_test.rb
+++ b/apps/workbench/test/integration/collections_test.rb
@@ -300,9 +300,15 @@ class CollectionsTest < ActionDispatch::IntegrationTest
   end
 
   test "remove a file from collection using checkbox and dropdown option" do
+    need_selenium 'to confirm unlock'
+
     visit page_with_token('active', '/collections/zzzzz-4zz18-a21ux3541sxa8sf')
     assert(page.has_text?('file1'), 'file not found - file1')
 
+    # unlock before removing a file
+    first('.lock-collection-btn').click
+    page.driver.browser.switch_to.alert.accept
+
     # remove first file
     input_files = page.all('input[type=checkbox]')
     input_files[0].click
@@ -317,11 +323,15 @@ class CollectionsTest < ActionDispatch::IntegrationTest
   end
 
   test "remove a file in collection using trash icon" do
-    need_selenium 'to confirm remove'
+    need_selenium 'to confirm unlock'
 
     visit page_with_token('active', '/collections/zzzzz-4zz18-a21ux3541sxa8sf')
     assert(page.has_text?('file1'), 'file not found - file1')
 
+    # unlock before removing a file
+    first('.lock-collection-btn').click
+    page.driver.browser.switch_to.alert.accept
+
     first('.fa-trash-o').click
     page.driver.browser.switch_to.alert.accept
 
@@ -330,8 +340,14 @@ class CollectionsTest < ActionDispatch::IntegrationTest
   end
 
   test "rename a file in collection" do
+    need_selenium 'to confirm unlock'
+
     visit page_with_token('active', '/collections/zzzzz-4zz18-a21ux3541sxa8sf')
 
+    # unlock before renaming a file
+    first('.lock-collection-btn').click
+    page.driver.browser.switch_to.alert.accept
+
     within('.collection_files') do
       first('.fa-pencil').click
       find('.editable-input input').set('file1renamed')
@@ -357,4 +373,53 @@ class CollectionsTest < ActionDispatch::IntegrationTest
       assert_nil first('.fa-trash-o')
     end
   end
+
+  test "unlock collection to modfiy files" do
+    need_selenium 'to confirm remove'
+
+    collection = api_fixture('collections')['collection_owned_by_active']
+
+    # On load, collection is locked, and upload tab, rename and remove options are disabled
+    visit page_with_token('active', "/collections/#{collection['uuid']}")
+
+    assert_selector 'a[data-toggle="disabled"]', text: 'Upload'
+
+    within('.collection_files') do
+      file_ctrls = page.all('.btn-collection-file-control')
+      assert_equal 2, file_ctrls.size
+      assert_equal true, file_ctrls[0]['class'].include?('disabled')
+      assert_equal true, file_ctrls[1]['class'].include?('disabled')
+      find('input[type=checkbox]').click
+    end
+
+    click_button 'Selection'
+    within('.selection-action-container') do
+      assert_selector 'li.disabled', text: 'Remove selected files'
+      assert_selector 'li', text: 'Create new collection with selected files'
+    end
+
+    # Unlock and verify the file modification controls are enabled
+    first('.lock-collection-btn').click
+    page.driver.browser.switch_to.alert.accept
+
+    assert_no_selector 'a[data-toggle="disabled"]', text: 'Upload'
+    assert_selector 'a', text: 'Upload'
+
+    within('.collection_files') do
+      file_ctrls = page.all('.btn-collection-file-control')
+      assert_equal 2, file_ctrls.size
+      assert_equal false, file_ctrls[0]['class'].include?('disabled')
+      assert_equal false, file_ctrls[1]['class'].include?('disabled')
+      # previous checkbox selection won't result in firing a new event;
+      # undo and redo checkbox to fire the selection event again
+      find('input[type=checkbox]').click
+      find('input[type=checkbox]').click
+    end
+
+    click_button 'Selection'
+    within('.selection-action-container') do
+      assert_no_selector 'li.disabled', text: 'Remove selected files'
+      assert_selector 'li', text: 'Remove selected files'
+    end
+  end
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list