From 970dcb69802e96369925bf95a382f6e224674050 Mon Sep 17 00:00:00 2001 From: iexus <2.-@twopointline.com> Date: Thu, 6 Mar 2014 21:20:12 +0000 Subject: [PATCH] Added tests for webpath utils method --- tests/utils.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/utils.js b/tests/utils.js index 981bd88d..6e1c5a5f 100644 --- a/tests/utils.js +++ b/tests/utils.js @@ -76,4 +76,20 @@ suite.add(new YUITest.TestCase({ } })); +suite.add(new YUITest.TestCase({ + name: 'produce valid web urls', + 'test: Adds paths onto end in sequence' : function() { + var url = Y.webpath('foo', 'bar', 'baz'); + Assert.areEqual('foo/bar/baz', url, 'parts should be added in sequence'); + }, + 'test: normalises windows paths into web happy urls' : function() { + var url = Y.webpath('foo\\bar', 'baz'); + Assert.areEqual('foo/bar/baz', url, '\\ should be normalised to /'); + }, + 'test: joins relative paths' : function() { + var url = Y.webpath('./foo/bar', './baz/'); + Assert.areEqual('foo/bar/baz/', url, 'should join relative paths'); + } +})); + YUITest.TestRunner.add(suite);