### Eclipse Workspace Patch 1.0
#P fluid-engage-core
Index: components/myCollection/html/myCollection.html
===================================================================
--- components/myCollection/html/myCollection.html	(revision 9489)
+++ components/myCollection/html/myCollection.html	(working copy)
@@ -78,12 +78,12 @@
 				
 			<!-- hidden link to the navigation list template -->
 			<a class="flc-myCollection-navigationList-link fl-myCollection-navigationList-link" href="../../../../fluid-engage-core/components/navigationList/html/NavigationList.html"/>
+			     
+	        <div class="flc-myCollection-sendMailDialog fl-myCollection-sendMailDialog" title="Dialog Title">
+	            <div class="flc-myCollection-sendMailMessage">We'll send your collection to the email address below.</div>
+	            <input class="flc-myCollection-sendEmailInput fl-myCollection-sendEmailInput fl-centered" type="text"/>
+	        </div>
 		</div>
-		
-		<div class="flc-myCollection-sendMailDialog fl-myCollection-sendMailDialog" title="Dialog Title">
-            <div class="flc-myCollection-sendMailMessage">We'll send your collection to the email address below.</div>
-            <input class="flc-myCollection-sendEmailInput fl-myCollection-sendEmailInput fl-centered" type="text"/>
-        </div>
 
 		<script id="flc-initBlock" type="text/javascript">
 			fluid.engage.initComponentWithLocalData("fluid.engage.myCollection", ".flc-myCollection");
Index: tests/component-tests/myCollection/html/myCollectionView-test.html
===================================================================
--- tests/component-tests/myCollection/html/myCollectionView-test.html	(revision 9489)
+++ tests/component-tests/myCollection/html/myCollectionView-test.html	(working copy)
@@ -21,7 +21,7 @@
         <script type="text/javascript" src="../../../../../fluid-infusion/src/webapp/tests/lib/qunit/js/testrunner.js"></script>
         <script type="text/javascript" src="../../../../../fluid-infusion/src/webapp/tests/test-core/jqUnit/js/jqUnit.js"></script>
 
-        <script type="text/javascript" src="../../../../../fluid-engage-core/framework/js/engageClientUtils.js"></script>
+        <script type="text/javascript" src="../../../../../fluid-engage-core/framework/js/engageRenderUtils.js"></script>
    		<script type="text/javascript" src="../../../../../fluid-engage-core/components/myCollection/js/MyCollectionView.js"></script>
 		<script type="text/javascript" src="../../../../../fluid-engage-core/components/navigationBar/js/NavigationBar.js"></script>   		
    		<script type="text/javascript" src="../../../../../fluid-engage-core/components/navigationList/js/NavigationList.js"></script>   				
Index: tests/component-tests/myCollection/js/myCollectionTests.js
===================================================================
--- tests/component-tests/myCollection/js/myCollectionTests.js	(revision 9489)
+++ tests/component-tests/myCollection/js/myCollectionTests.js	(working copy)
@@ -17,7 +17,20 @@
         var tests = {};
         var model = [];
         var component;
+        
+        var mail = "abc@xyz.org";
 
+        // Put tests inside this function that will be called by the component
+        var sendEmailHook = function (params) {
+            jqUnit.assertEquals("Action parameter is correct", "add", params.action);
+            jqUnit.assertNotUndefined("Artifacts parameter is defined", params.artifacts);
+            var artifacts = params.artifacts.split(",");
+            jqUnit.assertNotUndefined("Artifact number matches model", model.length, artifacts.length);
+            for (var i = 0; i < model.length; i++) {
+                jqUnit.assertEquals("Artifact #" + i + " is in parameters", model[i].artifactId, artifacts[i]);
+            }
+        };
+        
         var setup = function () {
             tests.fetchTemplate(
                     "../../../../components/myCollection/html/myCollection.html",
@@ -50,9 +63,10 @@
                         }
                     }
                 },
-                model: model
+                model: model,
+                sendEmailFn: sendEmailHook
             });
-
+            
             // Here we delay the running of the tests to allow the My Collection component
             // to be initialized. This is necessary because its initialization is delayed.
             stop();
@@ -78,8 +92,6 @@
                         component.navigationList);
             });
 
-
-            
             tests.test("Component model test", function () {
                 expect(3);
                 
@@ -90,6 +102,14 @@
                 jqUnit.assertEquals("Model node museum matches passed museum.",
                         model[0].museum, component.model[0].museum);
             });
+            
+            tests.test("Send email test", function () {
+                expect(9); // for a 6-artifacts model
+                
+                component.locate("sendEmailInput").attr("value", mail);
+                var okButtonFn = component.sendEmailDialog.dialog("option", "buttons")[component.options.strings.submitEmailButton];
+                okButtonFn();
+            });
         };
 
         myCollectionTests();
Index: components/myCollection/js/MyCollectionView.js
===================================================================
--- components/myCollection/js/MyCollectionView.js	(revision 9489)
+++ components/myCollection/js/MyCollectionView.js	(working copy)
@@ -52,9 +52,9 @@
         };
     };
 
-    var sendEmail = function (that) {
+    var sendEmail = function (params) {
         $.ajax({
-            url: "../myCollection/sendEmail.json" + "?" + $.param(buildSendCollectionParams(that)),
+            url: "../myCollection/sendEmail.json" + "?" + $.param(params),
             type: "GET"        
         });
     };
@@ -147,7 +147,7 @@
             title: " "
         };
         options.buttons[submit] = function () {
-            sendEmail(that);
+            that.options.sendEmailFn(buildSendCollectionParams(that));
             $(this).dialog("close");
         };
         options.buttons[cancel] = function () {
@@ -252,7 +252,9 @@
                 sendEmailDialogMessage: "We'll send your collection to the email address below.",
                 submitEmailButton: "Submit",
                 cancelEmailButton: "Cancel"
-            }        
+            },
+            
+            sendEmailFn: sendEmail
         }
     );
 })(jQuery);
Index: components/myCollection/data/demoData.json
===================================================================
--- components/myCollection/data/demoData.json	(revision 9489)
+++ components/myCollection/data/demoData.json	(working copy)
@@ -4,41 +4,47 @@
         "target": "view.html?q=ME986.104.3.1-2&db=mccord&uuid=c9949e514929699fd0991f46fd1e78f7",
         "image": "http://eich.wsg.mcgill.ca/ThumbView/ME986.104.3.jpg",
         "title": "No Title",
-        "description": "1910-1930, 20th century"
+        "description": "1910-1930, 20th century",
+        "artifactId": "123456"
     },
     {
         "id": "50016071055ed4973757b7ece1f63ced",
         "target": "view.html?q=M956.5&db=mccord&uuid=c9949e514929699fd0991f46fd1e78f7",
         "image": "http://eich.wsg.mcgill.ca/ThumbView/5090.jpg",
         "title": "No Title",
-        "description": "1865-1900, 19th century"
+        "description": "1865-1900, 19th century",
+        "artifactId": "234567"
     },
     {
         "id": "f32010cf5814a9963c6d9290610a7371",
         "target": "view.html?q=M999.70.23&db=mccord&uuid=c9949e514929699fd0991f46fd1e78f7",
         "image": "http://eich.wsg.mcgill.ca/ThumbView/M999.70.23.jpg",
         "title": "Castor Oil, National Drug & Chemical Co.of Can.Ltd.",
-        "description": "1900-1925, 20th century"
+        "description": "1900-1925, 20th century",
+        "artifactId": "345678"
     },
     {
         "id": "e5c9568bfc512e69dd94f8e25e932414",
         "target": "view.html?q=ME892.10&db=mccord&uuid=c9949e514929699fd0991f46fd1e78f7",
         "image": "http://eich.wsg.mcgill.ca/ThumbView/ME892.10-a.jpg",
         "title": "No Title",
-        "description": "1800-1850, 19th century"
+        "description": "1800-1850, 19th century",
+        "artifactId": "456789"
     },
     {
         "id": "df6052db54a07236c0305ad5270f1ae9",
         "target": "view.html?q=M980.37.2&db=mccord&uuid=c9949e514929699fd0991f46fd1e78f7",
         "image": "http://eich.wsg.mcgill.ca/ThumbView/M980.37.2.jpg",
         "title": "No Title",
-        "description": "1892, 19th century"
+        "description": "1892, 19th century",
+        "artifactId": "567890"
     },
    {
         "id": "da4de044a34e150a328d1c42e96937e9",
         "target": "view.html?q=M995.47.2.1-3&db=mccord&uuid=c9949e514929699fd0991f46fd1e78f7",
         "image": "http://eich.wsg.mcgill.ca/ThumbView/M995.47.2.1-3.jpg",
         "title": "No Title",
-        "description": "1905-1910, 20th century"
+        "description": "1905-1910, 20th century",
+        "artifactId": "678901"
     }
 ]
