diff options
Diffstat (limited to 'test/spec/YamlSpec.js')
-rw-r--r-- | test/spec/YamlSpec.js | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/test/spec/YamlSpec.js b/test/spec/YamlSpec.js index f9808a8..a65d3c5 100644 --- a/test/spec/YamlSpec.js +++ b/test/spec/YamlSpec.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 1.7.1 -var YAML; +var YAML, examplePath, url, _ref; if (typeof YAML === "undefined" || YAML === null) { YAML = require('../../src/Yaml'); @@ -626,3 +626,30 @@ describe('Dumped YAML Documents', function() { }))); }); }); + +url = typeof document !== "undefined" && document !== null ? (_ref = document.location) != null ? _ref.href : void 0 : void 0; + +if (!(url != null) || url.indexOf('file://') === -1) { + examplePath = 'spec/example.yml'; + if (typeof __dirname !== "undefined" && __dirname !== null) { + examplePath = __dirname + '/example.yml'; + } + describe('YAML loading', function() { + it('can be done synchronously', function() { + return expect(YAML.load(examplePath)).toEqual({ + "this": 'is', + a: ['YAML', 'example'] + }); + }); + return it('can be done asynchronously', function(done) { + return YAML.load(examplePath, function(result) { + console.log(result); + expect(result).toEqual({ + "this": 'is', + a: ['YAML', 'example'] + }); + return done(); + }); + }); + }); +} |