Skip to content

Commit

Permalink
Ticket #85 - Added tests for getFile
Browse files Browse the repository at this point in the history
  • Loading branch information
OscarGodson committed Jun 22, 2012
1 parent cde266a commit b414c42
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions spec/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {

Expand Down

0 comments on commit b414c42

Please sign in to comment.