From b414c42ae0032ef0bd03fb340922b92d9c32207d Mon Sep 17 00:00:00 2001 From: Oscar Godson Date: Fri, 22 Jun 2012 07:54:16 -0700 Subject: [PATCH] Ticket #85 - Added tests for getFile --- spec/spec.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/spec/spec.js b/spec/spec.js index 3199d66..33a0aea 100644 --- a/spec/spec.js +++ b/spec/spec.js @@ -199,6 +199,36 @@ describe('EpicEditor.getElement', function () { }); +describe('EpicEditor.getFiles', function () { + var testEl, editor, fooFile, barFile; + + before(function () { + localStorage.clear(); + testEl = _createTestElement(); + editor = new EpicEditor({ basePath: '/epiceditor/', container: testEl }).load(); + fooFile = 'foo'+_randomNum(); + barFile = 'bar'+_randomNum(); + editor.importFile(fooFile, 'foo'); + editor.importFile(barFile, 'bar'); + }); + + after(function () { + editor.unload(); + }); + + it('check to see if the correct number of files is returned when asking for all files', function () { + var fileCount = 0; + for (x in editor.getFiles()) { + fileCount++; + } + expect(fileCount).to(be, 3); + }); + + it('check to see if a single (and correct) file is returned when the name param is specified', function () { + expect(editor.getFiles(fooFile).content).to(be, 'foo'); + }); +}); + describe('EpicEditor.open', function () {