From 71c975ee65738e302884100964a76c4e20989c75 Mon Sep 17 00:00:00 2001 From: "J. Jordan" Date: Sun, 15 Apr 2012 15:20:45 -0400 Subject: [PATCH] Add test for filenames with spaces --- lib/open.js | 2 +- test/open.js | 4 ++++ test/support/with space.html | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 test/support/with space.html diff --git a/lib/open.js b/lib/open.js index 6aee766..876efd7 100644 --- a/lib/open.js +++ b/lib/open.js @@ -31,5 +31,5 @@ function open(target, callback) { // TODO: what are the implications of quoting target? // - we'll need to look at target to see if its already quoted // - different platforms may treat quotes differently - return exec(opener + ' ' + target + '', callback); + return exec(opener + ' "' + target + '"', callback); } diff --git a/test/open.js b/test/open.js index 3ab2e9c..5d508f2 100644 --- a/test/open.js +++ b/test/open.js @@ -21,6 +21,10 @@ describe('open', function() { it('should open txt file in default text editor', function(done) { open(pathTo('asset.txt'), done); }); + + it('should open files with spaces', function(done) { + open(pathTo('with space.html'), done); + }); }); diff --git a/test/support/with space.html b/test/support/with space.html new file mode 100644 index 0000000..e9eca5a --- /dev/null +++ b/test/support/with space.html @@ -0,0 +1,4 @@ + +

open.js test asset

+

If this is your default browser, it worked. You can close this.

+