Exemple #1
0
 it('should just save if the file name does not change', async () => {
   const path = context.path;
   await context.initialize(true);
   const promise = context.saveAs();
   await acceptDialog();
   await promise;
   expect(context.path).to.equal(path);
 });
 it('should save the document to a different path chosen by the user', (done) => {
   waitForDialog().then(() => {
     let dialog = document.body.getElementsByClassName('jp-Dialog')[0];
     let input = dialog.getElementsByTagName('input')[0];
     input.value = 'bar';
     acceptDialog();
   });
   context.saveAs().then(() => {
     expect(context.path).to.be('bar');
     done();
   }).catch(done);
 });
Exemple #3
0
      it('should save the document to a different path chosen by the user', async () => {
        const initialize = context.initialize(true);
        const newPath = UUID.uuid4() + '.txt';

        const func = async () => {
          await initialize;
          await waitForDialog();
          const dialog = document.body.getElementsByClassName('jp-Dialog')[0];
          const input = dialog.getElementsByTagName('input')[0];

          input.value = newPath;
          await acceptDialog();
        };
        const promise = func();
        await initialize;
        await context.saveAs();
        expect(context.path).to.equal(newPath);
        await promise;
      });
Exemple #4
0
      it('should bring up a conflict dialog', async () => {
        const newPath = UUID.uuid4() + '.txt';

        const func = async () => {
          await waitForDialog();
          const dialog = document.body.getElementsByClassName('jp-Dialog')[0];
          const input = dialog.getElementsByTagName('input')[0];
          input.value = newPath;
          await acceptDialog();
          await acceptDialog();
        };
        const promise = func();
        await manager.contents.save(newPath, {
          type: factory.contentType,
          format: factory.fileFormat,
          content: 'foo'
        });
        await context.initialize(true);
        await context.saveAs();
        expect(context.path).to.equal(newPath);
        await promise;
      });
Exemple #5
0
 it('should keep the file if overwrite is aborted', async () => {
   const oldPath = context.path;
   const newPath = UUID.uuid4() + '.txt';
   const func = async () => {
     await waitForDialog();
     const dialog = document.body.getElementsByClassName('jp-Dialog')[0];
     const input = dialog.getElementsByTagName('input')[0];
     input.value = newPath;
     await acceptDialog(); // Accept rename dialog
     await dismissDialog(); // Reject conflict dialog
   };
   await manager.contents.save(newPath, {
     type: factory.contentType,
     format: factory.fileFormat,
     content: 'foo'
   });
   await context.initialize(true);
   const promise = func();
   await context.saveAs();
   await promise;
   expect(context.path).to.equal(oldPath);
 });
Exemple #6
0
 return context.initialize(true).then(() => {
   return context.saveAs();
 }).then(() => {
Exemple #7
0
 }).then(() => {
   return context.saveAs();
 }).then(() => {
Exemple #8
0
 return initialize.then(() => context.saveAs()).then(() => {