forked from OscarGodson/EpicEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.remove.js
50 lines (42 loc) · 1.35 KB
/
test.remove.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*global createContainer:false, removeContainer:false, rnd:false */
describe('.remove(name)', function () {
var testEl
, id
, editor
, removeMeFile
, dontRemoveMeFile
, eventFired;
before(function (done) {
id = rnd();
testEl = createContainer(id);
editor = new EpicEditor({ basePath: '/epiceditor/', container: testEl });
removeMeFile = 'removeMe' + id;
dontRemoveMeFile = 'dontRemoveMe' + id;
editor.load();
editor.importFile(removeMeFile, 'hello world').importFile(dontRemoveMeFile, 'foo bar');
done();
});
after(function (done) {
editor.unload();
removeContainer(id);
done();
});
it('should begin with the foo file imported correctly', function () {
expect(editor.exportFile(removeMeFile)).to.be('hello world');
});
it('should cause exportFile to return false after removing the foo file', function () {
editor.remove(removeMeFile);
expect(editor.exportFile(removeMeFile)).to.be(undefined);
});
it('should not remove any file other than the fileName passed', function () {
expect(editor.exportFile(dontRemoveMeFile)).to.be('foo bar');
});
it('should fire the remove event', function () {
editor.on('remove', function () {
eventFired = true;
});
editor.open(removeMeFile);
editor.remove(removeMeFile);
expect(eventFired).to.be(true);
});
});