Commits

Shlomi Fish  committed 2f0353d

Add get_relative_path + a test.

  • Participants
  • Parent commits 2620284
  • Branches convert-from-jquery-treeview-to-jqtree-plugin

Comments (0)

Files changed (1)

File Tests/js/jqtree-from-h-w-json-nav-menu-test.js

     return ('./' + ('../'.repeat(count)));
 }
 
+function get_relative_path (args) {
+    return get_base_relative_path(args) + args.to;
+}
+
 function test_nav_menu_generation()
 {
     module("NavMenu.Main.ToJQTree");
 
     test("NavMenu main test", function () {
-        expect(5);
+        expect(6);
 
         // TEST
         ok (true, "True is, well, true.");
             './../../',
             "relative path with trailing .html page"
         );
+
+        // TEST
+        equal (
+            get_relative_path(
+                {
+                    base: 'http://www.shlomifish.org/',
+                    current: 'http://www.shlomifish.org/humour/',
+                    to: 'me/intros/writers/'
+                }
+            ),
+            './../me/intros/writers/'
+        );
     });
 }