Commit graph

6836 commits

Author SHA1 Message Date
Dan Stillman
db2348f100 Tests for data layer and item fixes/changes 2015-04-25 03:17:42 -04:00
Dan Stillman
8ff258fe03 Don't require parent item to be loaded when setting item parent 2015-04-25 03:17:41 -04:00
Dan Stillman
6126a49fea Don't require non-identified items to have loaded data in getField()
This allows getField() on an unsaved item to work properly without a pointless
loadItemData() call.
2015-04-25 03:17:41 -04:00
Dan Stillman
5c8209da5c Fix 'this' binding in ZoteroPane.selectItem() 2015-04-25 03:17:41 -04:00
Dan Stillman
2f556d0da1 Adjust identifier registration on object save
Previously, object identifiers were registered in a commit callback, but that
meant that they wouldn't be available to getLibraryAndKeyFromID/
getIDFromLibraryAndKey within a transaction. Instead, register them before
saving and clear them in a tranasction rollback if necessary.

This changes Zotero.DataObject to call its own _finalizeSave() in addition to a
descendent one.
2015-04-25 03:17:41 -04:00
Dan Stillman
f8ac21d891 Return object instead of array from Zotero.DataObjects.getLibraryAndKeyFromID()
Object contains 'libraryID' and 'key' properties

This is due to changed array destructuring behavior in Firefox. Previously,
`var [foo, bar] = maybeArrayMaybeFalse()` always worked, leaving foo and bar
undefined if the function returned false. Now (with ES6, I assume), if the
function returns false it results in a "false[Symbol.iterator] is not a
function" error. But `var {libraryID, key} = false` works as expected, leaving
both values undefined, so instead we can just return an object with those
properties from getLibraryAndKeyFromID(). To assign to different variables, use
`var {libraryID, key: parentItemKey} = ...`.
2015-04-25 03:17:41 -04:00
Dan Stillman
90f4996d9d Remove some excessive error logging from Bluebird
And hide errors from DB transaction rollback tests
2015-04-25 03:17:41 -04:00
Dan Stillman
9e3e680be8 Rework DB transaction handling
Rollback callbacks weren't being properly called, and some other things were in
the wrong place, particularly with nested transactions.
2015-04-25 03:17:41 -04:00
Dan Stillman
4cb5e7e4d5 Remove check for ES5 generators in Zotero.DB.executeTransaction()
This doesn't work properly in some contexts and can break things. There might
be a better test, but we probably don't need this anymore.
2015-04-25 03:17:40 -04:00
Dan Stillman
f78b18c692 Fix ES6 warning calling UInt8Array without 'new' 2015-04-25 03:17:40 -04:00
Dan Stillman
0e800f350c Throw errors instead of logging for some item load calls
Reverts a change in b83bc404, and changes one debug line introduced
there into an error
2015-04-25 03:17:40 -04:00
Dan Stillman
f68a595a2b Remove Zotero.DataObject._eraseRecoverFromFailure() 2015-04-25 03:17:40 -04:00
Dan Stillman
4b040c78a7 Fix various saved search bugs, and add tests
Search condition ids are now indexed from 0, and always saved
contiguously (no more 'fixGaps' option), since they're just in an array
in the API. (They're still returned as an object from
Zotero.Search.prototype.getConditions() because it's easier for the
advanced search window to not have to deal with shifting ids between
saves.)
2015-04-17 19:29:37 -04:00
Dan Stillman
d9c32a8e90 Fix search saving, and add some unit tests
Also:

- Return an object from `Zotero.Search.prototype.getConditions()`
  instead of an array.
- Add support function `getPromiseError(promise)` to return the error
  thrown from a chain of promises, or false if none. (We could make an
  `assert.throwsAsync()`, but this allows testing of various properties
  such as `.name`, which even the built-in `assert.throws()` can't
  test.)
- Clarify some search save errors
2015-04-17 00:25:09 -04:00
Dan Stillman
59773f3f6d Zotero.Search.getSearchCondition(s) -> getCondition(s) 2015-04-17 00:25:09 -04:00
Dan Stillman
1952fbccd4 Wait for Zotero.Searches initialization 2015-04-16 20:50:15 -04:00
Dan Stillman
51c7ae6e5c Add -b option to skip translator/style installation in tests
'b' for *b*undled files

Translators and styles take a long time to install and initialize in
source installations, and they're unnecessary for many tests.

This shaves about 10 seconds off each test run for me on one system (and
that's with some help from filesystem caching).
2015-04-16 20:50:15 -04:00
Dan Stillman
0154e44c2f Mark all data as loaded when loading primary data for nonexistent object 2015-04-16 20:49:18 -04:00
Dan Stillman
293f7c6dd4 Zotero.Search.prototype.addCondition() doesn't need to be async 2015-04-16 20:48:59 -04:00
Dan Stillman
973e602cfc Enable Bluebird generator support in Mocha
Promise-yielding ES6 generator functions can now be used for test
functions, and they'll automatically be wrapped with Bluebird's
coroutine().
2015-04-15 01:35:53 -04:00
Dan Stillman
384a547693 Merge branch '4.0' into api_syncing
Conflicts:
	chrome/content/zotero/lookup.js
2015-04-15 00:56:25 -04:00
Dan Stillman
a8d1080cd6 Unpromisify a couple Zotero.Translator.get() calls
More to be done to fix translation
2015-04-15 00:50:22 -04:00
Dan Stillman
96f3cc1861 Enable debug.time pref in tests 2015-04-15 00:48:03 -04:00
Dan Stillman
71d2aa9337 Update resetDB test for async DB 2015-04-15 00:45:59 -04:00
Dan Stillman
e8b7b38290 Remove some obsolete synchronous DB code 2015-04-15 00:45:59 -04:00
Dan Stillman
4f9366749c Add Zotero.alert() method
This is just a wrapper around nsIPromptService.alert() that takes
Zotero.noUserInput into consideration, which avoids long timeouts during
testing (e.g., for lookup failures).
2015-04-14 16:09:55 -04:00
Dan Stillman
7b72d47070 Zotero.File.putContentsAsync() fixes
Breakage from e6ccca3230
2015-04-13 03:45:25 -04:00
Dan Stillman
915542e696 Throw Error, not Exception 2015-04-13 03:45:25 -04:00
Dan Stillman
2a3af13ddf Automatically return local user URI from Zotero.URI.getLibraryURI()
Previously, getItemURI and getCollectionURI had to check the libraryID
to determine whether to return a local URI, and were doing so using an
obsolete check.
2015-04-13 03:45:25 -04:00
Dan Stillman
6dfdae870e Q -> Bluebird in tests 2015-04-13 03:44:59 -04:00
Dan Stillman
a91151756b Fix test running after schema updates
Tests still need to be updated for Bluebird/promisification
2015-04-13 02:25:34 -04:00
Dan Stillman
fec43f1f62 Merge branch '4.0' into api_syncing 2015-04-13 02:01:43 -04:00
Dan Stillman
9511c43432 Create empty data directory in test profile
This prevents the data directory migration prompt from showing up if
there's an existing data directory inside the Standalone profile.
2015-04-12 20:28:50 -04:00
Dan Stillman
a0b3c1f6ac Merge pull request #698 from aurimasv/patch-1
More informative error messages for failed file loads
2015-04-10 21:40:44 -04:00
Aurimas Vinckevicius
164f4e4321 More informative error messages for failed file loads 2015-04-10 19:46:57 -05:00
Dan Stillman
b599aed8ed Fix pasting of non-HTTP URLs into notes from non-note sources
Copying zotero:// and other non-HTTP links from a note itself was fixed
in #452, but copying such links from other sources still stripped the
hrefs. This removes the patch in #452 and just gets the HTML directly
from the clipboard. I'm not sure why TinyMCE doesn't try to do this by
default (it only tries for plaintext), so maybe there's a problem with
this approach, but it seems to work for me (strips bad HTML, etc.).

Fixes #697
2015-04-10 13:08:25 -04:00
Dan Stillman
1c2b2575f7 Fix excessive file sync mtime updates/checks (probably?) 2015-04-09 03:47:43 -04:00
Dan Stillman
f5ce2d238e Fixes #546, Advanced search : match "any" is broken 2015-04-09 02:57:29 -04:00
Dan Stillman
c1a581168a Merge locales from Transifex 2015-04-09 00:26:12 -04:00
Dan Stillman
1e2346eba1 Revert to modified 3.02 binaries on Windows
To deal with issues running .vbs scripts on some systems. If the 3.02
binaries haven't been reinstalled since this version, reinstall them as
3.02a automatically or on manual upgrade to fix corrupted binaries from
previous gzip issue.

Other platforms unchanged
2015-04-09 00:22:32 -04:00
Dan Stillman
b2d5612526 Fix sync and debug output submission in Nightly
(sendAsBinary() removal)
2015-04-07 16:59:33 -04:00
Dan Stillman
2afebc79d0 Set tree image height to 16px everywhere
Windows maybe also doesn't handle HiDPI tree images correctly otherwise
2015-04-07 14:37:13 -04:00
Dan Stillman
c398353d5d Remove obsolete CSS include 2015-04-07 14:26:49 -04:00
Dan Stillman
fe79954b96 Fix HiDPI icons in trees on Linux 2015-04-07 14:25:24 -04:00
Dan Stillman
152b1c0d83 Merge pull request #692 from aurimasv/test-beta_build
Add Firefox Beta for Travis-CI testing
2015-04-07 03:13:19 -04:00
Dan Stillman
61e11f9afa Fix main toolbar icons in 2x mode on Win/Linux 2015-04-07 03:06:25 -04:00
Dan Stillman
adadc9e03a Accept a string path in Zotero.Utilities.Internal.exec() 2015-04-07 01:16:17 -04:00
Dan Stillman
31941c0798 Fix flashing console window for Retrieve Metadata on Windows 2015-04-07 01:14:18 -04:00
Aurimas Vinckevicius
f6510419cb Skip test for "recognizePDF without DOI" on Travis-CI
Breaks due to CAPTCHA when tests are run frequently
2015-04-06 23:17:41 -05:00
Aurimas Vinckevicius
ac363101fc Always use latest Firefox version and echo it for tests
Don't echo version on Windows, because it hangs Firefox
Also add testing with Firefox Beta (and prior ESR, but commented out for now, since we don't support it and we know it breaks)
2015-04-06 23:16:44 -05:00