diff --git a/js/testing/test-name.html b/js/testing/test-name.html
index aca50d9..318511d 100644
--- a/js/testing/test-name.html
+++ b/js/testing/test-name.html
@@ -32,73 +32,81 @@
     var name1 = new Name([entree, comp1, ab2]);
     var name1Uri = name1.to_uri();
     var name1UriExpected = "/entr%C3%A9e/..../%00%01%02%03";
-    result.innerHTML += "Name from '" + entree + "', Uint8Array of '.' and ArrayBuffer of 0,1,2,3:<br>";
+    result.innerHTML += "Name from '" + entree + "', Uint8Array of '.' and ArrayBuffer of 0,1,2,3:<br/>";
     if (name1Uri == name1UriExpected)
-        result.innerHTML += "SUCCESS: " + name1Uri + ".<br>";
+        result.innerHTML += "SUCCESS: " + name1Uri + ".<br/>";
     else
-        result.innerHTML += "ERROR: got " + name1Uri + ", expected " + name1UriExpected + " .<br>";
+        result.innerHTML += "ERROR: got " + name1Uri + ", expected " + name1UriExpected + " .<br/>";
 
-    result.innerHTML += "Compare with same Name from '" + entree + "', '.' and ArrayBuffer:<br>";
+    result.innerHTML += "Compare with same Name from '" + entree + "', '.' and ArrayBuffer:<br/>";
     // Equivalent with name1
     var name2 = new Name([entree, ".", comp2]);
     if (name2.components.length != name1.components.length)
         result.innerHTML += "ERROR: Got name with " + name2.components.length + 
-            " components, expected " + name1.components.length + ".<br>";
+            " components, expected " + name1.components.length + ".<br/>";
     else {
         var allEqual = true;
         for (var i = 0; i < name1.components.length; ++i) {
             if (!DataUtils.arraysEqual(name1.components[i], name2.components[i])) {
                 allEqual = false;
-                result.innerHTML += "ERROR: Names differ at component at index " + i + ".<br>";
+                result.innerHTML += "ERROR: Names differ at component at index " + i + ".<br/>";
             }
         }
         if (allEqual)
-            result.innerHTML += "SUCCESS: Names are equal.<br>";
+            result.innerHTML += "SUCCESS: Names are equal.<br/>";
     }
     
-    result.innerHTML += "Compare with same Name from URI:<br>";
+    result.innerHTML += "Compare with same Name from URI:<br/>";
     // Equivalent with name1; when Name constructor is passed a string, it is treated as a URI
     var name3 = new Name("/entr%C3%A9e/..../%00%01%02%03");
     if (name3.components.length != name1.components.length)
         result.innerHTML += "ERROR: Got name with " + name3.components.length + 
-            " components, expected " + name1.components.length + ".<br>";
+            " components, expected " + name1.components.length + ".<br/>";
     else {
         var allEqual = true;
         for (var i = 0; i < name1.components.length; ++i) {
             if (!DataUtils.arraysEqual(name1.components[i], name3.components[i])) {
                 allEqual = false;
-                result.innerHTML += "ERROR: Names differ at component at index " + i + ".<br>";
+                result.innerHTML += "ERROR: Names differ at component at index " + i + ".<br/>";
             }
         }
         if (allEqual)
-            result.innerHTML += "SUCCESS: Names are equal.<br>";
+            result.innerHTML += "SUCCESS: Names are equal.<br/>";
     }    
     
-    result.innerHTML += "Compare with Name prefix of first 2 components:<br>";
+    result.innerHTML += "Compare with Name prefix of first 2 components:<br/>";
     // Returns new Name([entree, "."])
     var name4 = name2.getPrefix(2);
     if (name4.components.length != 2)
         result.innerHTML += "ERROR: Got name with " + name4.components.length + 
-            " components, expected 2.<br>";
+            " components, expected 2.<br/>";
     else {
         var allEqual = true;
         for (var i = 0; i < name4.components.length; ++i) {
             if (!DataUtils.arraysEqual(name1.components[i], name4.components[i])) {
                 allEqual = false;
-                result.innerHTML += "ERROR: Names differ at component at index " + i + ".<br>";
+                result.innerHTML += "ERROR: Names differ at component at index " + i + ".<br/>";
             }
         }
         if (allEqual)
-            result.innerHTML += "SUCCESS: First 2 components are equal: " + name4.to_uri() + " .<br>";
+            result.innerHTML += "SUCCESS: First 2 components are equal: " + name4.to_uri() + " .<br/>";
     }    
     
-    result.innerHTML += "Check with Name component at index 2:<br>";
+    result.innerHTML += "Check with Name component at index 2:<br/>";
     // Returns ArrayBuffer of "%00%01%02%03"
     var component2Out = new Uint8Array(name1.getComponent(2));
     if (DataUtils.arraysEqual(component2Out, comp2))
-        result.innerHTML += "SUCCESS: Components at index 2 are equal.<br>";
+        result.innerHTML += "SUCCESS: Components at index 2 are equal.<br/>";
     else
-        result.innerHTML += "ERROR: Components at index 2 are different.<br>";
+        result.innerHTML += "ERROR: Components at index 2 are different.<br/>";
+    
+    var name5 = new Name("/localhost/user/folders/files/%00%0F");
+    result.innerHTML += "Check chaining calls to add() to create Name: " + name5.to_uri() + "<br/>";
+    if (name5.equalsName(new Name(new Name("/localhost")).add(new Name("/user/folders")).add
+          ("files").addSegment(15)))
+        result.innerHTML += "SUCCESS: Names are equal.<br/>";
+    else
+        result.innerHTML += "ERROR: Names are different.<br/>";
 }
 
 	</script>
