5375: add test to verify that collection#show page enalbles / disables file viewing...
authorRadhika Chippada <radhika@curoverse.com>
Wed, 18 Mar 2015 00:42:40 +0000 (20:42 -0400)
committerRadhika Chippada <radhika@curoverse.com>
Wed, 18 Mar 2015 00:42:40 +0000 (20:42 -0400)
apps/workbench/test/controllers/collections_controller_test.rb
services/api/test/fixtures/collections.yml

index dfbe69f987f25c75cf03f7fe5b5a3a7398fd919d..17cd741a9ace24d04185361de4904910e0054732 100644 (file)
@@ -403,4 +403,31 @@ class CollectionsControllerTest < ActionController::TestCase
     assert_equal 'test description update', assigns(:object).description
     assert_equal collection['manifest_text'], assigns(:object).manifest_text
   end
+
+  test "view collection and verify none of the file types listed are disabled" do
+    show_collection(:collection_with_several_supported_file_types, :active)
+
+    files = assigns(:object).files
+    assert_equal true, files.length>0, "Expected one or more files in collection"
+
+    disabled = css_select('[disabled="disabled"]').collect do |el|
+      el
+    end
+    assert_equal 0, disabled.length, "Expected no disabled files in collection viewables list"
+  end
+
+  test "view collection and verify file types listed are all disabled" do
+    show_collection(:collection_with_several_unsupported_file_types, :active)
+
+    files = assigns(:object).files.collect do |_, file, _|
+      file
+    end
+    assert_equal true, files.length>0, "Expected one or more files in collection"
+
+    disabled = css_select('[disabled="disabled"]').collect do |el|
+      el.attributes['title'].split[-1]
+    end
+
+    assert_equal files.sort, disabled.sort, "Expected to see all collection files in disabled list of files"
+  end
 end
index bd508f8c934a249f7f4786e07deff45506aa4d2e..d3e6beb209d7fbc1e9f3c13f0156aec3cf99cd16 100644 (file)
@@ -519,6 +519,30 @@ multi_level_to_combine:
   manifest_text: ". 85877ca2d7e05498dd3d109baf2df106+95 0:0:file1 0:0:file2 0:0:file3\n./dir1 85877ca2d7e05498dd3d109baf2df106+95 0:0:file1 0:0:file2 0:0:file3\n./dir1/subdir 85877ca2d7e05498dd3d109baf2df106+95 0:0:file1 0:0:file2 0:0:file3\n./dir2 85877ca2d7e05498dd3d109baf2df106+95 0:0:file1 0:0:file2 0:0:file3\n"
   name: multi_level_to_combine
 
+# collection with several file types to test view icon enabled state in collection show page
+collection_with_several_supported_file_types:
+  uuid: zzzzz-4zz18-supportedtypes1
+  portable_data_hash: 7a6ef4c162a5c6413070a8bd0bffc818+150
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  created_at: 2014-02-03T17:22:54Z
+  modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+  modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f
+  modified_at: 2014-02-03T17:22:54Z
+  updated_at: 2014-02-03T17:22:54Z
+  manifest_text: ". 85877ca2d7e05498dd3d109baf2df106+95 0:0:file.csv 0:0:file.fa 0:0:file.fasta 0:0:file.gif 0:0:file.json 0:0:file.md 0:0:file.pdf 0:0:file.py 0:0:file.R 0:0:file.sam 0:0:file.sh 0:0:file.tiff 0:0:file.tsv 0:0:file.txt 0:0:file.vcf 0:0:file.xml 0:0:file.xsl 0:0:file.yml\n"
+  name: collection_with_several_supported_file_types
+
+collection_with_several_unsupported_file_types:
+  uuid: zzzzz-4zz18-supportedtypes2
+  portable_data_hash: 7a6ef4c162a5c6413070a8bd0bffc818+150
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  created_at: 2014-02-03T17:22:54Z
+  modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+  modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f
+  modified_at: 2014-02-03T17:22:54Z
+  updated_at: 2014-02-03T17:22:54Z
+  manifest_text: ". 85877ca2d7e05498dd3d109baf2df106+95 0:0:file 0:0:file.bam\n"
+  name: collection_with_several_unsupported_file_types
 
 # Test Helper trims the rest of the file