Skip to content

Commit b414c42

Browse files
committed
Ticket #85 - Added tests for getFile
1 parent cde266a commit b414c42

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

spec/spec.js

+30
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,36 @@ describe('EpicEditor.getElement', function () {
199199
});
200200

201201

202+
describe('EpicEditor.getFiles', function () {
203+
var testEl, editor, fooFile, barFile;
204+
205+
before(function () {
206+
localStorage.clear();
207+
testEl = _createTestElement();
208+
editor = new EpicEditor({ basePath: '/epiceditor/', container: testEl }).load();
209+
fooFile = 'foo'+_randomNum();
210+
barFile = 'bar'+_randomNum();
211+
editor.importFile(fooFile, 'foo');
212+
editor.importFile(barFile, 'bar');
213+
});
214+
215+
after(function () {
216+
editor.unload();
217+
});
218+
219+
it('check to see if the correct number of files is returned when asking for all files', function () {
220+
var fileCount = 0;
221+
for (x in editor.getFiles()) {
222+
fileCount++;
223+
}
224+
expect(fileCount).to(be, 3);
225+
});
226+
227+
it('check to see if a single (and correct) file is returned when the name param is specified', function () {
228+
expect(editor.getFiles(fooFile).content).to(be, 'foo');
229+
});
230+
});
231+
202232

203233
describe('EpicEditor.open', function () {
204234

0 commit comments

Comments
 (0)