diff --git a/js/utils/dropbox.js b/js/utils/dropbox.js index ec08cbf4..f5c4fb99 100644 --- a/js/utils/dropbox.js +++ b/js/utils/dropbox.js @@ -28,7 +28,6 @@ define(function(require) { clientId: key }); - // var state = Dropbox.Util.Oauth.randomAuthStateParam(); var url = client.getAuthenticationUrl(redirect_uri); var popup = window.open(url, '_blank', 'width=500, height=500'); $(window).on('message.dropboxclient', function(e) { @@ -125,6 +124,8 @@ define(function(require) { var data = item_to_data(item); if (data.isFolder) { folders[data.path] = data; + } else if (options.pdfOnly && !data.name.match(/.*\.pdf$/)) { + return; } files.push(data); }); @@ -160,13 +161,15 @@ define(function(require) { var conflate_caller = function(conflate_callback, result) { if (result && result.cursor) { client.filesListFolderContinue({ - cursor: result.cursor + cursor: result.cursor, + include_media_info: true }).then(conflate_callback); } else { client.filesListFolder({ path: is_lazy ? options.folder : '', - recursive: !is_lazy + recursive: !is_lazy, + include_media_info: true }).then(conflate_callback); } }; diff --git a/test/acceptance/spec/open.js b/test/acceptance/spec/open.js index 73ae8107..2247052b 100644 --- a/test/acceptance/spec/open.js +++ b/test/acceptance/spec/open.js @@ -51,17 +51,16 @@ define(function(require) { it('WHEN a FinalDraft file is loaded THEN editor is set to its converted content', function(done) { // WHEN env.scenarios.load_local_file({ - name: 'test.fountain', - content: 'Action. Action.' - }, - function() { - env.user.theme.open_plugin('editor'); + name: 'test.fountain', + content: 'Action. Action.' + }, + function() { + env.user.theme.open_plugin('editor'); - // THEN - env.assert.editor.editor_content('\nAction. Action.\n'); - done(); - } - ); + // THEN + env.assert.editor.editor_content('\nAction. Action.\n'); + done(); + }); }); it('WHEN open from Dropbox is clicked THEN list of files is displayed', function(done) { diff --git a/test/acceptance/spec/preview.js b/test/acceptance/spec/preview.js index 0afb9203..4f00846c 100644 --- a/test/acceptance/spec/preview.js +++ b/test/acceptance/spec/preview.js @@ -59,7 +59,7 @@ define(function(require) { env.assert.popup.dialog_input_content_is('screenplay.pdf'); }); - it.only('WHEN save pdf to Dropbox button is clicked THEN save pdf to Dropbox dialog is displayed', function(done) { + it('WHEN save pdf to Dropbox button is clicked THEN save pdf to Dropbox dialog is displayed', function(done) { // GIVEN env.user.theme.open_plugin('preview'); diff --git a/test/acceptance/spec/save.js b/test/acceptance/spec/save.js index 2acb7100..e8861c36 100644 --- a/test/acceptance/spec/save.js +++ b/test/acceptance/spec/save.js @@ -2,7 +2,7 @@ define(function(require) { var Env = require('acceptance/env'); - describe.only('Save plugin', function() { + describe('Save plugin', function() { var env; @@ -84,11 +84,14 @@ define(function(require) { env.scenarios.initialise_saving_to_dropbox('fountain', function() { env.user.popup.select_file('file.fountain'); env.user.popup.save_popup(); - - // THEN - env.assert.dropbox.dropbox_saved(1); - env.assert.popup.dialog_message_is('File saved!'); - done(); + + Promise.resolve().then(function() { + // THEN + env.browser.tick(1000); + env.assert.dropbox.dropbox_saved(1); + env.assert.popup.dialog_message_is('File saved!'); + done(); + }); }); }); @@ -99,11 +102,14 @@ define(function(require) { env.dropbox.disable(); env.user.popup.save_popup(); - - // THEN - env.assert.dropbox.dropbox_saved(0); - env.assert.popup.dialog_message_is('Could not save the file. Try again later.'); - done(); + + Promise.resolve().then(function() { + // THEN + env.browser.tick(1000); + env.assert.dropbox.dropbox_saved(0); + env.assert.popup.dialog_message_is('Could not save the file. Try again later.'); + done(); + }); }); });