|
@@ -41,7 +41,7 @@ describe('docregistry/savehandler', () => {
|
|
});
|
|
});
|
|
|
|
|
|
beforeEach(() => {
|
|
beforeEach(() => {
|
|
- context = new Context({ manager, factory, path: uuid() });
|
|
|
|
|
|
+ context = new Context({ manager, factory, path: uuid() + '.txt' });
|
|
handler = new SaveHandler({ context, manager });
|
|
handler = new SaveHandler({ context, manager });
|
|
});
|
|
});
|
|
|
|
|
|
@@ -129,6 +129,8 @@ describe('docregistry/savehandler', () => {
|
|
|
|
|
|
it('should continue to save', (done) => {
|
|
it('should continue to save', (done) => {
|
|
let called = 0;
|
|
let called = 0;
|
|
|
|
+ // Lower the duration multiplier.
|
|
|
|
+ (handler as any)._multiplier = 1;
|
|
context.fileChanged.connect(() => {
|
|
context.fileChanged.connect(() => {
|
|
if (called === 0) {
|
|
if (called === 0) {
|
|
context.model.fromString('bar');
|
|
context.model.fromString('bar');
|
|
@@ -144,6 +146,8 @@ describe('docregistry/savehandler', () => {
|
|
});
|
|
});
|
|
|
|
|
|
it('should overwrite the file on disk', (done) => {
|
|
it('should overwrite the file on disk', (done) => {
|
|
|
|
+ // Lower the duration multiplier.
|
|
|
|
+ (handler as any)._multiplier = 1;
|
|
context.model.fromString('foo');
|
|
context.model.fromString('foo');
|
|
context.save().then(() => {
|
|
context.save().then(() => {
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
@@ -165,6 +169,8 @@ describe('docregistry/savehandler', () => {
|
|
});
|
|
});
|
|
|
|
|
|
it('should revert to the file on disk', (done) => {
|
|
it('should revert to the file on disk', (done) => {
|
|
|
|
+ // Lower the duration multiplier.
|
|
|
|
+ (handler as any)._multiplier = 1;
|
|
context.model.fromString('foo');
|
|
context.model.fromString('foo');
|
|
context.save().then(() => {
|
|
context.save().then(() => {
|
|
context.fileChanged.connect(() => {
|
|
context.fileChanged.connect(() => {
|
|
@@ -201,6 +207,7 @@ describe('docregistry/savehandler', () => {
|
|
handler.start();
|
|
handler.start();
|
|
expect(handler.isActive).to.be(true);
|
|
expect(handler.isActive).to.be(true);
|
|
handler.stop();
|
|
handler.stop();
|
|
|
|
+ expect(handler.isActive).to.be(false);
|
|
});
|
|
});
|
|
|
|
|
|
});
|
|
});
|