From 5d022c3ca3cd21237587e668379eb7fe2c633920 Mon Sep 17 00:00:00 2001 From: Barry Tulchinsky Date: Fri, 20 Dec 2013 11:50:59 -0500 Subject: [PATCH] started spec tests and exposed to FileSystem prototype --- src/fs.js | 27 ++++++++++++++++++++++++++- tests/spec/fs.xattr.spec.js | 21 +++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 tests/spec/fs.xattr.spec.js diff --git a/src/fs.js b/src/fs.js index 2476861..b820a8d 100644 --- a/src/fs.js +++ b/src/fs.js @@ -2076,7 +2076,32 @@ define(function(require) { } ); }; - + FileSystem.prototype.setxattr = function (path, name, value, flag, callback) { + callback = maybeCallback(arguments[arguments.length - 1]); + var fs = this; + var error = fs.queueOrRun( + function () { + var context = fs.provider.getReadWriteContext(); + _setxattr(context, path, name, value, flag, callback); + } + ); + if (error) { + callback(error); + } + }; + FileSystem.prototype.getxattr = function (path, name, callback) { + callback = maybeCallback(callback); + var fs = this; + var error = fs.queueOrRun( + function () { + var context = fs.provider.getReadWriteContext(); + _getxattr(context, path, name, callback); + } + ); + if (error) { + callback(error); + } + }; return FileSystem; }); diff --git a/tests/spec/fs.xattr.spec.js b/tests/spec/fs.xattr.spec.js new file mode 100644 index 0000000..a15b57f --- /dev/null +++ b/tests/spec/fs.xattr.spec.js @@ -0,0 +1,21 @@ +define(["IDBFS"], function(IDBFS) { + + describe('fs.utimes', function() { + beforeEach(function() { + this.db_name = mk_db_name(); + this.fs = new IDBFS.FileSystem({ + name: this.db_name, + flags: 'FORMAT' + }); + }); + + afterEach(function() { + indexedDB.deleteDatabase(this.db_name); + delete this.fs; + }); + }); + + it('should be a function', function () { + expect(typeof this.setxattr).toEqual('function'); + }); +} \ No newline at end of file