Commit graph

574 commits

Author SHA1 Message Date
Dan Stillman
4eee369b66 Use /keys/current for key requests
Possible after https://github.com/zotero/dataserver/commit/beb38579ca1
2016-04-25 02:51:35 -04:00
Dan Stillman
a05134e903 Fix search by file type
Fixes #966
2016-04-25 00:50:27 -04:00
Dan Stillman
6a47d1dc44 Fix #962, 5.0: Add item by identifier in collection
Also adds a test for this, but lookup tests are disabled
until #699 is resolved.
2016-04-24 04:28:56 -04:00
Dan Stillman
87a2eece3a Fix #959, 5.0: Submit to Zotero Server is not working 2016-04-24 04:04:40 -04:00
Dan Stillman
300c8e8aea Leave default log level at 5 during test runs
Otherwise if debug output logging is enabled in the prefs nothing is
logged. Test output is still controlled by '-d n'.
2016-04-24 04:02:33 -04:00
Dan Stillman
a91957c588 Fix #956, 5.0: Merging of duplicate items is not working 2016-04-24 02:44:21 -04:00
Dan Stillman
f633db1f01 Miscellaneous tweaks 2016-04-23 00:59:20 -04:00
Dan Stillman
9c7663979e Fix dragging of URLs into items list 2016-04-22 22:48:58 -04:00
Dan Stillman
f1af54236e Add Zotero.Notifier.Queue to keep event groups separate, and use for sync
A queue can be created and passed as an option to data layer methods, which
will then queue events on that queue instead of the main internal queue. A
queue or an array of queues can then be passed to Zotero.Notifier.commit() to
commit those events.

Some auxiliary functions don't yet take a queue, so those events will still get
run on DB transaction commit.

Sync data processing now processes notifier events in batches to reduce
repaints, even though individual objects are processed within their own
transactions (so that failures don't roll back other objects' data).

Also remove some unused notifier code
2016-04-22 22:48:58 -04:00
Dan Stillman
e7d27ee0f3 Close #931, [Async DB] Update long tag fixer 2016-04-21 11:46:23 -04:00
Dan Stillman
e2cbfbd0fe Deasyncify Zotero.Tags.getID()/getAsync(), and add Zotero.Tags.create() 2016-04-21 11:07:16 -04:00
Dan Stillman
3dabd63a0a Close #930, [API Syncing] Sync synced settings 2016-04-19 05:22:16 -04:00
Dan Stillman
0fca78bb7e Try to fix intermittent Travis error 2016-04-15 05:14:52 -04:00
Dan Stillman
a1ef16a0a6 Add .library to Zotero.DataObject
This should replace uses of Zotero.Libraries.get(item.libraryID).
2016-04-10 19:46:10 -04:00
Dan Stillman
0469d6506a Show toolbar icon and collections pane while items are loading
Items in a library are now loaded only when a library is clicked on and
at sync time. There might be some other areas where they need to be
loaded or where this causes problems (e.g., drag and drop, word
processor integration).
2016-04-10 19:01:36 -04:00
Dan Stillman
23e01fcefd Fix saving to My Library if Zotero pane hasn't been opened 2016-04-09 18:34:54 -04:00
Dan Stillman
1c19fe8d81 Use proper on-detect handler rather than pageshow in browser tests
Otherwise the test could run scrapeThisPage() before translators were ready. It
would be good to make scrapeThisPage wait for detection to complete so that an
early press still uses a translator for saving, but this way tests can also
test for the proper icon (though they don't now).
2016-04-09 18:26:13 -04:00
Dan Stillman
14341ca16c Clear item creators when calling setCreators() with an empty array 2016-04-07 21:10:11 -04:00
Dan Stillman
79748b9132 Fix #940, UI not updating when dragging child item between parents 2016-04-07 21:10:11 -04:00
Adomas Venčkauskas
3dc0ad3745 Add feed menu buttons. Close adomasven/zotero#9. 2016-04-01 12:25:37 +03:00
Dan Stillman
4f54214f11 Disable auto-sync pref for tests
We don't want auto-sync to try to run during unrelated tests.
Additionally, even though the sync process wouldn't actually start due
to the absence of an API key (which is injected directly into the sync
functions for sync tests), since auto-sync kicks off after a one-second
delay on pane open, during tests the Zotero object has often been torn
down by the time the check code runs, producing spurious errors in the
console.
2016-04-01 02:49:50 -04:00
Adomas Venčkauskas
2b41f7af1d Close #934. Remove feed item read state syncing 2016-03-31 12:37:01 +03:00
Dan Stillman
cebf2a3125 Throw an error from queryAsync() if onRow throws an error
If onRow throws StopIteration, the query will stop gracefully.
2016-03-28 17:47:25 -04:00
Dan Stillman
35530af1fb Gzip-compress API uploads larger than 1000 characters 2016-03-28 02:38:28 -04:00
Dan Stillman
144d02e36c Upgrade Sinon to 1.17.3 2016-03-27 23:10:17 -04:00
Dan Stillman
b7b246e741 Saved search fixes
- Fix saved search editing
- Refresh items list on search change
- Generate correct conditions array for search JSON
2016-03-26 04:14:56 -04:00
Dan Stillman
15a9fd5494 Make various collection methods synchronous
- Collection::getDescendents()
- Collections.getByLibrary()
- Collections.getByParent()

And various things that depend on those. (View with -w.)
2016-03-25 18:44:24 -04:00
Dan Stillman
7dfb62b8fc Remove delay() in test 2016-03-25 16:53:28 -04:00
Dan Stillman
234127e65a Update toolbar icons on group editability change
And trigger 'group' 'modify' notifier event for inherited Zotero.Library
properties
2016-03-25 16:49:26 -04:00
Dan Stillman
bc31a29e5a Fix test breakage from db33163a9 2016-03-25 02:31:54 -04:00
Dan Stillman
afee1d16ad Fix saving an item with a child note into a collection 2016-03-25 02:24:22 -04:00
Dan Stillman
c5702abb7b Don't include 'filename' in linked_file attachment JSON 2016-03-24 22:26:50 -04:00
Dan Stillman
fc6c113f25 Show intro text for My Publications in middle pane when no items
ZoteroPane.setItemsPaneMessage() and setItemPaneMessage() can now
optionally take a DOM node instead of a string.

Closes #705
2016-03-24 09:03:59 -04:00
Dan Stillman
db33163a99 Fix Advanced Search window 2016-03-23 20:45:02 -04:00
Dan Stillman
d826e6b0e8 Disable Firefox Health Check in tests 2016-03-23 04:29:38 -04:00
Dan Stillman
a1ce85decb Overhaul object downloading/processing during data syncs
Previously, objects were first downloaded and saved to the sync cache,
which was then processed separately to create/update local objects. This
meant that a server bug could result in invalid data in the sync cache
that would never be processed. Now, objects are saved as they're
downloaded and only added to the sync cache after being successfully
saved. The keys of objects that fail are added to a queue, and those
objects are refetched and retried on a backoff schedule or when a new
client version is installed (in case of a client bug or a client with
outdated data model support).

An alternative would be to save to the sync cache first and evict
objects that fail and add them to the queue, but that requires more
complicated logic, and it probably makes more sense just to buffer a few
downloads ahead so that processing is never waiting for downloads to
finish.
2016-03-23 04:29:04 -04:00
Dan Stillman
6ac35c75c1 Fix display of sync error icon on error 2016-03-22 22:44:02 -04:00
Dan Stillman
af8865f3f3 Fix behavior of Zotero.Utilities.Internal.delayGenerator and add tests
Also convert to an ES6 generator
2016-03-22 22:44:02 -04:00
Dan Stillman
c099bd432a Handle multi-collection/search add in collectionTreeView::notify() 2016-03-22 22:44:00 -04:00
Dan Stillman
6c43e75d26 Merge pull request #902 from adomasven/feature/feed-reader-UI
Feed Reader UI

(I squashed a bunch of commits from the PR.)
2016-03-22 07:31:03 -04:00
Adomas Venčkauskas
12fc6cfbe8 Various feeds changes
- Hide notes, tags and related for feed items in itembox
- Add feed support for <enclosure> elements
- Add feed syncing methods for synced settings (additional work is
  needed on the sync architecture to download synced settings from the
  server)
- Change feed item clear policy to be less aggressive
- Adjust for deasyncification
- Disable translate-on-select
- Close adomasven/zotero#7, Remove context menu items from feeds
2016-03-22 06:56:36 -04:00
Adomas Venčkauskas
9e88969f3d Refactor ProgressWindow translation messages show for feed items 2016-03-22 06:56:35 -04:00
Adomas Venčkauskas
e206b0af5e Various feeds changes
- Change sort order for feed items to natural order
- Remove display of dates in itembox
- Trim html tags from creators in FeedReader parser
2016-03-22 06:56:33 -04:00
Adomas Venčkauskas
5e706c31ad Translate and add items to library on drag 2016-03-22 06:56:33 -04:00
Adomas Venčkauskas
e6ede4b36f Various feeds changes
And move Z.Attachments.cleanAttachmentURI() to Z.Utilities.cleanURL()
2016-03-22 06:56:30 -04:00
Adomas Venčkauskas
8a2dc6e7f2 Adds Zotero.FeedReader tests 2016-03-22 06:56:29 -04:00
Dan Stillman
74cf2a3c22 Fix hang on import that includes an HTML attachment
Closes #734, for the moment
2016-03-22 01:31:20 -04:00
Dan Stillman
42968949b6 Fix collection export
Closes #734, maybe?
2016-03-21 18:11:30 -04:00
Dan Stillman
e70f2164c1 Fix broken support test after 220cf2c29 2016-03-21 01:33:37 -04:00
Dan Stillman
20ece48a57 Fix saving of single files to library root via save button 2016-03-21 01:30:16 -04:00
Dan Stillman
51b286528c Fix export translation
This reverts Zotero.Translate.ItemGetter.prototype.nextItem() to being
synchronous post-deasyncification. This will need to be made to work
asynchronously in the future if _attachmentToArray(), which is called by
nextItem, is changed to use async file access (which might be required
at some point).

Addresses #734, [Async DB] Import/export fails
2016-03-20 23:39:12 -04:00
Dan Stillman
da45df06cc Load reverse relations mappings at startup
This allows Zotero.Relations.getByPredicateAndObject()/getByObject() and
Zotero.Item::getLinkedItem()/Zotero.Collection::getLinkedCollection() to
be synchronous, which is necessary for word processor integration.
2016-03-18 04:31:37 -04:00
Dan Stillman
5d3e7f555c Update test submodules (accidentally downgraded in daf4a8fe4) 2016-03-17 16:28:02 -04:00
Dan Stillman
a949d6bf8d Merge branch 'deasyncification' 2016-03-16 02:02:41 -04:00
Dan Stillman
28dc7d17e2 Fix setting of local mtime when remote file change matches local file 2016-03-16 02:01:51 -04:00
Dan Stillman
b9444892a0 Ring bell on test error if interactive shell 2016-03-15 01:18:55 -04:00
Dan Stillman
5cd3ab22ba Make sure "Unfiled Items" is showing before test 2016-03-15 01:18:55 -04:00
Dan Stillman
be04f3d33c Restore colored tags at top of tag selector when not linked to item 2016-03-15 01:18:55 -04:00
Dan Stillman
8e5016ae4d Load synced settings (incl. tag colors) at startup 2016-03-15 01:18:55 -04:00
Dan Stillman
60830c27ee Remove items from open Unfiled Items view when added to collection 2016-03-13 22:59:19 -04:00
Dan Stillman
6b509820b3 Fixes #918, Enabling "Show Unfiled Items" or "Show Duplicates" breaks UI 2016-03-13 20:31:15 -04:00
Dan Stillman
75bf69526c Daylight saving time: it's a thing! 2016-03-13 20:28:12 -04:00
Dan Stillman
0fc91a4ef2 Tests for showing/hiding virtual folders 2016-03-12 05:03:47 -05:00
Dan Stillman
c4ca22ca62 Fix duplicate merging
Fixes #919
2016-03-11 09:27:03 -05:00
Dan Stillman
1982938bc7 Store userLibraryID in test 2016-03-11 09:26:32 -05:00
Dan Stillman
f795240bbf Fix display of Duplicate/Unfiled Items rows 2016-03-11 09:25:33 -05:00
Dan Stillman
394aa8dded Update display title after item edit 2016-03-11 09:25:33 -05:00
Dan Stillman
ae6d560a66 Fix Item::multiDiff() 2016-03-11 07:48:24 -05:00
Dan Stillman
7a03b1e527 Accept ISO dates in Item::setField() 2016-03-11 07:48:24 -05:00
Dan Stillman
28eaaaf2bf Don't try to parse non-SQL dates in Date.sqlToDate() 2016-03-11 07:48:24 -05:00
Dan Stillman
de897d2878 Add "new" to File constructor for Firefox 45 2016-03-07 20:12:48 -05:00
Dan Stillman
208d470531 Fix test failures 2016-03-07 17:13:30 -05:00
Dan Stillman
daf4a8fe4d Deasyncification 🔙 😢
While trying to get translation and citing working with asynchronously
generated data, we realized that drag-and-drop support was going to
be...problematic. Firefox only supports synchronous methods for
providing drag data (unlike, it seems, the DataTransferItem interface
supported by Chrome), which means that we'd need to preload all relevant
data on item selection (bounded by export.quickCopy.dragLimit) and keep
the translate/cite methods synchronous (or maintain two separate
versions).

What we're trying instead is doing what I said in #518 we weren't going
to do: loading most object data on startup and leaving many more
functions synchronous. Essentially, this takes the various load*()
methods described in #518, moves them to startup, and makes them operate
on entire libraries rather than individual objects.

The obvious downside here (other than undoing much of the work of the
last many months) is that it increases startup time, potentially quite a
lot for larger libraries. On my laptop, with a 3,000-item library, this
adds about 3 seconds to startup time. I haven't yet tested with larger
libraries. But I'm hoping that we can optimize this further to reduce
that delay. Among other things, this is loading data for all libraries,
when it should be able to load data only for the library being viewed.
But this is also fundamentally just doing some SELECT queries and
storing the results, so it really shouldn't need to be that slow (though
performance may be bounded a bit here by XPCOM overhead).

If we can make this fast enough, it means that third-party plugins
should be able to remain much closer to their current designs. (Some
things, including saving, will still need to be made asynchronous.)
2016-03-07 17:03:58 -05:00
Dan Stillman
2d8f37967e Add -h flag to test runner to display help cleanly 2016-02-22 16:00:37 -05:00
Dan Stillman
ad0d6765d7 Fix Zotero.Attachments.linkFromDocument() 2016-02-11 02:54:52 -05:00
Dan Stillman
a20a6c86bc Closes #899, Setting max chars to 0 should disable full-text indexing 2016-02-07 01:01:26 -05:00
Dan Stillman
72c927c840 Fix Zotero.Utilities tests, which were being skipped accidentally
Unfortunately this will need to be partly redone, since retrieveItem(), and
therefore itemToCSLJSON(), and therefore itemToExportFormat(), need to be
synchronous. The item data load statements in itemToExportFormat() will
probably need to be performed earlier, when they can be async, and made
available to the session for retrieval by retrieveItem(), but I'll let someone
more familiar with the citation infrastructure do that.

This restores some code in retrieveItem() that may have been accidentally
removed in a merge, though it probably won't be useful anymore anyway.

Addresses #529
2016-02-04 04:05:46 -05:00
Dan Stillman
7c6a9bba9f Update test submodules 2016-02-03 02:15:08 -05:00
Dan Stillman
e119e5bf0d Extra logging for waitForWindow() support function 2016-02-03 01:20:11 -05:00
Dan Stillman
9c2a7a9e77 Only retry file sync requests once after 500 error in tests
Now that 500 errors are retried in file downloads (ec28c5a3), we have to
override the default backoff schedule in order to get expected failures.

This also fixes an error that occurred on a retried download.
2016-02-03 01:19:15 -05:00
Dan Stillman
9fb85a263a Fix LIKE errors in Fx44
In Fx44, SQL queries must use '?' with LIKE and cannot concatenate a
placeholder string (e.g., 'foo%'). This is for Sqlite.jsm only, so it
doesn't affect 4.0.
2016-02-03 01:13:30 -05:00
Dan Stillman
3ac4203a75 Increase open files limit during tests
Mozilla file functions (OS.File.move()/copy(),
NetUtil.asyncFetch/asyncCopy()) can leave file descriptors open for a
few seconds (even with an explicit inputStream.close() in the case of
the latter), so a source installation that copies ~500 translators and
styles (with fds for source and target) can exceed the default 1024
limit.
2016-01-26 04:39:36 -05:00
Dan Stillman
aff8e35a0e Fix stuck checkUser prompt in sync prefs tests on Ubuntu
For some reason the confirmEx prompt behaves differently (as a modal
window?) on Ubuntu if it's the only window open, preventing the
setTimeout() callback within support.js::waitForWindow() from being run.
(Passing -c to the test runner fixed it.) This removes a win.close() in
the middle of the file, which was probably a mistake anyway, so that the
pref window stays open until the end of the file.
2016-01-25 18:22:25 -05:00
Dan Stillman
b3e14644f2 Fix sync tests 2016-01-18 13:50:46 -05:00
Dan Stillman
e873617890 Fix trashing of descendant items when deleting a collection
Also allows 'collections' property to be passed to
createDataObject()/createUnsavedDataObject() in tests.
2016-01-18 13:50:46 -05:00
Dan Stillman
f05b98ba20 Fetch top-level items before other items when syncing 2016-01-14 01:50:13 -05:00
Dan Stillman
02eea99128 Get latest cache object versions in bulk during sync downloads 2016-01-12 21:57:00 -05:00
Dan Stillman
eb89b4ed12 Test for DB integrity check 2016-01-08 03:31:43 -05:00
Dan Stillman
50b46bdb19 Don't bother doing a full DB reset after sync tests
Tests should make no assumptions about the presence of bundled files and
should do a full resetDB() if they need them. But most tests don't need
them, and they're very slow to install. We can reconsider this if we
drastically speed up DB resetting in tests (e.g., by caching a pristine
data directory).
2016-01-08 03:23:35 -05:00
Dan Stillman
07fbda2b72 Add "[FAIL]" to test failures, for easier searching of output 2016-01-07 16:49:12 -05:00
Dan Stillman
4a5de628ce Fix WebDAV test failure 2016-01-07 16:48:57 -05:00
Adomas Venčkauskas
2e389de471 Closes #833, Displays a warning dialog if API key present but library empty 2016-01-07 21:11:20 +00:00
Dan Stillman
c5a9987f37 WebDAV file sync overhaul for 5.0
Also:

- Remove last-sync-time mechanism for both WebDAV and ZFS, since it can
  be determined by storage properties (mtime/md5) in data sync
- Add option to include synced storage properties in item toJSON()
  instead of local file properties
- Set "Fake-Server-Match" header in setHTTPResponse() test support
  function, which can be used for request count assertions -- see
  resetRequestCount() and assertRequestCount() in webdavTest.js
- Allow string (e.g., 'to_download') instead of constant in
  Zotero.Sync.Data.Local.setSyncState()
- Misc storage tweaks
2015-12-30 05:14:50 -05:00
Dan Stillman
8933e3b586 Item.toJSON() should output unset mtime/md5 as null, not undefined 2015-12-22 01:49:45 -05:00
Dan Stillman
cfee7ea9d2 Merge pull request #879 from adomasven/feature/transparent-api-keygen
Restores the functionality of 4.0 for sync settings
2015-12-14 19:28:56 -05:00
Adomas Venčkauskas
ffd9a07164 Restores sync credential functionality of 4.0.
Improves UX of sync authentication.
The account is now linked and unlinked and an API key related to
the client is generated transparently in the background.
The API key is deleted on unlinking.
No sync options are allowed before linking an account.
2015-12-14 23:55:28 +00:00
Adomas Venčkauskas
3fcfba5d36 Add sinon-as-promised for mocking promises 2015-12-14 23:05:54 +00:00
Dan Stillman
177dac3fd2 Closes #805, Translation shouldn't create new item in My Publications
And in download overlay, save and switch to My Library if My
Publications is selected.
2015-12-10 01:11:41 -05:00
Dan Stillman
e3033b056e Fix intermittent error in FullText.getUnsyncedContent() test 2015-12-09 04:51:48 -05:00
Dan Stillman
18349b2232 Restore certificate checking for API syncing errors
Closes #864

This adds a 'channel' property to Zotero.HTTP.UnexpectedStatusException,
because the 'channel' property of the XHR can be garbage-collected
before handling, and the channel's 'securityInfo' property is necessary
to detect certificate errors.
2015-12-09 04:11:27 -05:00
Dan Stillman
01fddc9bb9 Tweak DataObject::save() tests 2015-12-08 16:38:58 -05:00
Dan Stillman
08cb63f66d Fix various cases of saving items to selected collection
This changes Zotero.Translate.Base.translate() to take an options object (in
order to take a 'collections' parameter, which is passed to the
Zotero.Translate.ItemSaver constructor). The old parameters are still supported
with a deprecation warning, and there may be other places that still need to be
updated.
2015-11-15 17:49:31 -05:00
Dan Stillman
22b1fa8cf8 Don't load bundled files before each storageLocal test 2015-11-15 17:49:31 -05:00
Dan Stillman
57dfd1885d Allowing passing window to loadZoteroPane() support function 2015-11-15 17:49:31 -05:00
Dan Stillman
6d64526648 Ignore unknown fields in Zotero.Item::fromJSON() 2015-11-12 17:24:03 -05:00
Dan Stillman
563cfb4fd4 Add test PDF file 2015-11-12 15:40:42 -05:00
Dan Stillman
62aeb1da32 Full-text syncing support via API [DB reupgrade] 2015-11-12 02:54:51 -05:00
Dan Stillman
ae277391b6 Miscellaneous tweaks 2015-11-12 02:48:41 -05:00
Dan Stillman
bad9833896 Resolve caller.start() promise when passed functions finish
Instead of waiting for all queued functions to finish
2015-11-11 02:14:30 -05:00
Dan Stillman
3100f10396 Make Zotero.Libraries.getAll() return sorted Zotero.Library instances
My Library, My Publications, and then groups sorted by name
2015-11-04 14:04:21 -05:00
Dan Stillman
687ee6ba07 Fix sync error from items dragged between libraries before first sync
And fix bug in Zotero.URI.getURILibrary()
2015-11-02 20:36:47 -05:00
Dan Stillman
d07756d68d Store API key in login manager, and add temp field in prefs 2015-11-02 03:22:37 -05:00
Dan Stillman
7f43ca9503 Merge branch '4.0' 2015-11-01 21:22:13 -05:00
Dan Stillman
7e3ba7bc61 Misc. debug tweaks 2015-11-01 03:59:01 -05:00
Dan Stillman
1e6c29766f Add deletion uploading to API syncing [DB reupgrade]
Tags deletions are not currently synced, and maybe don't need to be.
2015-11-01 03:58:54 -05:00
Dan Stillman
6b8e5bafc6 Don't show deleted items outside of trash 2015-11-01 03:36:23 -05:00
Dan Stillman
532d485793 Delete older versions of processed objects in cache
And recover from "Sync cache had later version than remote" error, which
shouldn't actually happen...
2015-10-31 15:19:50 -04:00
Dan Stillman
c2ad4ceb0a Output 'deleted' as 1 instead of true in item JSON
Good idea? Not sure, but that's what the API does.
2015-10-30 19:07:12 -04:00
Dan Stillman
73f4d28ab2 ZFS file sync overhaul for API syncing
This mostly gets ZFS file syncing and file conflict resolution working
with the API sync process. WebDAV will need to be updated separately.

Known issues:

- File sync progress is temporarily gone
- File uploads can result in an unnecessary 412 loop on the next data
  sync
- This causes Firefox to crash on one of my computers during tests,
  which would be easier to debug if it produced a crash log.

Also:

- Adds httpd.js for use in tests when FakeXMLHttpRequest can't be used
  (e.g., saveURI()).
- Adds some additional test data files for attachment tests
2015-10-29 04:38:27 -04:00
Dan Stillman
76a37b4f9b Update maxVersion 2015-10-29 03:57:08 -04:00
Dan Stillman
0803bb84e3 Don't set collections: "" in PATCH JSON when changing item to child 2015-10-29 03:57:08 -04:00
Dan Stillman
5c32962bb1 Add test for Zotero.Utilities.Internal.md5Async() 2015-10-29 03:57:08 -04:00
Dan Stillman
ae69fbbd9b Disable Firefox extension signature checking during tests 2015-10-29 03:57:04 -04:00
Dan Stillman
ee6793a9e6 ConcurrentCaller changes
- Different constructor parameters
- id property for logging
- fcall() -> start()
- add() to enqueue without starting
- runAll() to run down queue and return promises for all current tasks
- wait() to wait for all running tasks to finish
2015-10-29 02:57:42 -04:00
Dan Stillman
62e586073d concurrent-caller.js -> concurrentCaller.js 2015-10-29 02:49:31 -04:00
Dan Stillman
7d8a1b2573 Make Zotero.DataObject#fromJSON() synchronous
When called on an identified object (i.e., one with an id or
library/key), loadAllData() must be called first. When called on a new
object (which is more common anyway), fromJSON() can be called
immediately.
2015-10-29 01:19:14 -04:00
Dan Stillman
2b8a5ba0b7 Disable extension signing check for test runs 2015-10-26 05:00:38 -04:00
Dan Stillman
493d37d1c7 Fix 100% CPU usage with pane open (since 9e356a7e6)
And make Zotero.Item.prototype.fileExists() check the file regardless of
whether there's a cached state.
2015-10-12 23:08:02 -04:00
Dan Stillman
1b333be23f Add Zotero.Library.prototype.lastStorageSync 2015-09-29 04:42:13 -04:00
Dan Stillman
691819bd32 Add Zotero.Library.prototype.libraryTypeID
Get the library-type-specific id for the library (e.g., userID for user
library, groupID for group library)
2015-09-29 04:42:13 -04:00
Dan Stillman
4b83d157b9 Add "use strict"; to test file 2015-09-29 04:42:13 -04:00
Dan Stillman
7633c7de30 Set test timeout in resetDB() instead of separate this.timeout() calls
'thisArg: this' should be passed to resetDB to have it adjust the
timeout
2015-09-29 04:42:12 -04:00
Dan Stillman
88627adcdb Update linked attachment base directory code
- Replace nsIFile and persistent descriptors with OS.File and string paths
- Add tests for base dir settings
2015-09-29 04:42:12 -04:00
Dan Stillman
9e356a7e63 Migrate relative/persistent descriptors to string paths [DB reupgrade]
Absolute paths have been stored as strings on all platforms for a while,
but old Mac persistent descriptors (Base64-encoded opaque alias records)
could still exist in the DB. Additionally, relative paths for stored
files were stored as Mozilla-specific opaque strings rather than UTF-8
strings.

This adds a schema step to convert those to strings paths in the DB.
Since Mac persistent descriptors aren't converted if the file isn't
found, we still handle and (convert) old-style persistent descriptors if
necessary when reading paths from the DB.

This also moves path string handling -- converting a path to a prefixed
string for stored or base-dir-relative files -- to the
Zotero.Item#attachmentPath setter instead of save() so that reading it
back immediately returns the correct value. One consequence is that the
attachment link mode must now be set before setting the path.

Zotero.Item#getFile() is now deprecated in favor of getFilePath() and
getFilePathAsync() (which checks file existence).

Zotero.File.directoryContains() now takes string paths instead of files.
2015-09-29 04:42:08 -04:00
Dan Stillman
d9b5e17c9c Asyncify Zotero.Attachments.getNumFiles() and add hasMultipleFiles()
Latter is probably all that's needed
2015-09-22 04:11:31 -04:00
Dan Stillman
fc1137b769 Asyncify Zotero.Attachments.getTotalFileSize() 2015-09-22 04:11:30 -04:00
Dan Stillman
add9481c63 Adjust error and feed tests for access error on read-only libraries 2015-09-22 03:52:31 -04:00
Aurimas Vinckevicius
995bc9667b Open a window for syncRunner tests
For some reason setTimeout in waitForWindow sometimes does not fire without a window open.
2015-09-21 17:08:23 -05:00
Aurimas Vinckevicius
d122323dbf Fix fullText tests on Windows 2015-09-21 17:08:22 -05:00
Aurimas Vinckevicius
38b9bbc8c8 Fix Translate tests on Windows 2015-09-21 17:08:22 -05:00
Aurimas Vinckevicius
8900a83b7d Fix Zotero.DataObject.key test 2015-09-21 17:08:21 -05:00
Aurimas Vinckevicius
88ab129ffb Add Feed and FeedItem
Also:
* _finalizeErase in Zotero.DataObject is now inheritable
* Call _initErase before starting a DB transaction
* removes Zotero.Libraries.add and Zotero.Libraries.remove (doesn't seem like this is used any more)
2015-09-21 17:08:21 -05:00
Aurimas Vinckevicius
76511eca08 Fix stack formatting in unit testing output 2015-09-21 02:28:10 -05:00
Aurimas Vinckevicius
87d5625bac Add Chai-as-Promised 2015-09-18 03:34:03 -05:00
Dan Stillman
b53892fe54 Fix various collection-dragging UI bugs
Fixes #823, hopefully
2015-08-08 17:26:42 -04:00
Dan Stillman
9fa53439ef Update hasChildCollections() when child moved to another collection 2015-08-08 16:45:51 -04:00
Dan Stillman
5a61ac4871 Don't try to select unselectable row on library tree row removal
(If deleting a group, don't select the header or separator before it.)
2015-08-07 16:36:53 -04:00
Dan Stillman
cbf4876173 Fix attachment renaming
Fixes #822
2015-08-07 15:36:46 -04:00
Dan Stillman
536cd867d7 Fix toJSON for attachment items 2015-08-06 15:55:37 -04:00
Dan Stillman
f963413170 Handle conflict resolution for remote item deletions 2015-08-06 06:03:45 -04:00
Dan Stillman
f8af231f1a Make CR wizard button assertions Mac-only for now
Wizard buttons are handled differently on Linux/Windows
2015-08-06 05:45:36 -04:00
Dan Stillman
51253fb933 Delete from sync cache when deleting object 2015-08-06 05:25:45 -04:00
Dan Stillman
0aecaad761 Update conflict resolution for API syncing
This will appear much less frequently, since non-conflicting field changes on
both sides can be resolved automatically, but genuine field conflicts still
require manual conflict resolution.

The merge pane is no longer editable, since the itembox code to do that is
async and can't run in a modal window, but it's not really necessary,
particularly with conflicts happening less frequently.

TODO:

- Remote item deletions
- File conflicts
- Maybe handle some edge cases where the conflicted items fail to save
2015-08-06 04:14:49 -04:00
Aurimas Vinckevicius
711b823552 Add tests for itemFromCSLJSON and make sure data round-trips 2015-08-04 15:22:35 -05:00
Aurimas Vinckevicius
bb15336fdb Fix season export in CSL JSON 2015-08-04 14:19:39 -05:00
Dan Stillman
7075300a17 Fix hasChanged() bug related to 'synced' 2015-08-02 05:26:02 -04:00
Dan Stillman
f02a9aa95e Check remote delete log during full sync
If an object is marked as synced locally and doesn't exist remotely but
is in the remote delete log, delete it locally
2015-08-02 03:44:14 -04:00
Dan Stillman
4600318ad7 Support 'successful' property in upload response
Save uploaded data to cache, and update local object if necessary (which
it mostly shouldn't be except for invalid characters and HTML filtering
in notes)

Also add some upload and JSON tests
2015-08-01 05:28:42 -04:00
Dan Stillman
70d9b9870c Fix a few small data layer bugs, and tidy up a little
I don't think these were triggered by any client code, but I found them while
porting code to the server.
2015-07-31 04:09:24 -04:00
Aurimas Vinckevicius
1cbd7f71cf Parse author names in itemToCSLJSON 2015-07-27 18:37:45 -05:00
Dan Stillman
a452af6c3a Sort descendant collections alphabetically in advanced search window
https://forums.zotero.org/discussion/50679/
2015-07-21 00:45:30 -04:00
Dan Stillman
984789d304 API syncing megacommit
There's a lot more to do, and this isn't ready for actual usage, but the
basic functionality is mostly in place and has decent test coverage. It
can successfully upgrade a library last used with classic syncing and
pull down changes via the API. Uploading mostly works but is currently
disabled for safety until it has better test coverage.

Downloaded JSON is first saved to a cache table, which is then used to
populate other tables and later for generating PATCH requests and
automatically resolving conflicts (since it shows what was changed
locally and what was changed remotely). Objects with unmet dependencies
or unknown fields are skipped for now but don't block the rest of the
sync.

Some of the bigger remaining to-dos:

- Tests for uploading
- Re-do the preferences to get an API key
- File sync integration
- Full-text syncing integration
- Manual conflict resolution (though this already includes much smarter
  conflict handling that automatically resolves many conflicts)
2015-07-20 18:16:57 -04:00
Dan Stillman
258b70b455 Throw an error saving an empty item with no item type 2015-07-20 04:15:27 -04:00
Dan Stillman
cd4d084dd9 Support for automatically merging collections and searches 2015-07-20 02:12:14 -04:00
Dan Stillman
02cd71ebb5 Allow overriding startup options in Zotero.reinit()
And use it in resetDB() test support function, mainly to allow
skipBundledFiles for resetDB calls. Translator installation and
initialization can take a long time, but tests that need a clean DB
don't necessarily rely on translators. Without this, running resetDB()
in beforeEach() for many tests is prohibitively slow.
2015-07-20 02:12:14 -04:00
Dan Stillman
4f55f28e7d Honor .synced on data objects in all cases
Previously, if .synced was already true, setting it to true and saving
would result in .synced == false unless skipSyncedUpdate was passed. Now
the value assigned to .synced is always used on the next save. If the
value hasn't changed and no other values have changed, a save will be a
no-op.
2015-07-20 02:12:14 -04:00
Dan Stillman
6c536fc784 Don't create Quick Start Guide item for new libraries
The default items cause problems with conflict resolution for existing
users (and not syncing them or ignoring conflicts for them is kind of
weird), and they require remote changes for new databases. I do like
there not being a completely empty library, but I think it's probably
better just to display a virtual welcome message with a link to the
Quick Start Guide somewhere else, such as in the right-hand pane. (A new
installation also opens the start page on zotero.org.)
2015-07-20 02:12:13 -04:00
Dan Stillman
d868f007e9 Don't select new groups in collections pane 2015-07-20 02:12:01 -04:00
Dan Stillman
5c523d8694 Merge branch '4.0' 2015-07-18 07:09:53 -04:00
Dan Stillman
f07fe7184d Ignore trailing period in domain for Quick Copy
From @aurimasv
2015-07-03 23:46:39 -04:00
Dan Stillman
899e33c993 Add a test to make sure HTTPS URLs aren't failing for Quick Copy 2015-07-03 22:14:08 -04:00
Dan Stillman
242581a270 Fix Quick Copy in tab mode, but for real 2015-07-03 22:06:12 -04:00
Aurimas Vinckevicius
5334a09ee0 Fix institutional author export to CiteProcJS 2015-06-29 23:22:09 -05:00
Aurimas Vinckevicius
e3ab3ab03e Add institutional author to sample test data 2015-06-29 23:22:09 -05:00
Dan Stillman
99dd1c0697 Merge branch '4.0'
Since modal windows (e.g., the Create Bib window and the Quick Copy site
editor window) can't use yield, style retrieval
(Zotero.Styles.getVisible()/getAll()) is now synchronous, depending on a
previous async Zotero.Styles.init(). The translator list is generated in
the prefs window and passed into the Quick Copy site editor, but it's
possible the translators API should be changed to make getTranslators()
synchronous with a prior init() as well.
2015-06-27 16:59:58 -04:00
Dan Stillman
3a5854f49f Update versions and submodules 2015-06-26 02:40:18 -04:00
Dan Stillman
0d1d4ee5cb Don't change selection unnecessarily when creating trashed item 2015-06-23 16:56:10 -04:00
Dan Stillman
33dedd1753 Tags overhaul [DB reupgrade]
- Simplified schema
- Tags are now added without reloading entire tag selector
  - On my system, adding 400 tags to an item (separately, with the tag
    selector updating each time) went from 59 seconds to 42. (Given that
    it takes only 13 seconds with the tag selector closed, though,
    there's clearly more work to be done.)
- Tag selector now uses HTML flexbox (in identical fashion, for now, but
  with the possibility of fancier changes later, and with streamlined
  logic thanks to the flexbox 'order' property)
- Various async fixes
- Tests
2015-06-23 05:21:58 -04:00
Dan Stillman
b602cc4bd2 waitForWindow()/waitForDialog() test function tweaks
- Give any window onload functions time to run before running
  waitForWindow()
- Allow custom dialog URI in waitForDialog
2015-06-23 05:20:50 -04:00
Dan Stillman
0d59bde186 Clean up DataObject erasing, and fix search unloading 2015-06-16 19:51:21 -04:00
Dan Stillman
4f155e3432 Fix group.fromJSON() with no 'admins' or 'members' arrays 2015-06-16 19:51:21 -04:00
Dan Stillman
79f0e4761f Handle delays for all non-cancel buttons in waitForDialog() in tests
When the button delay is enabled, all buttons other than Cancel are
delayed.
2015-06-16 19:51:21 -04:00
Simon Kornblith
2f7d2c09f0 Extend timeout for import test 2015-06-12 17:08:30 -04:00
Simon Kornblith
5cbb8de96b Re-enable import progress indicator 2015-06-12 17:06:07 -04:00
Simon Kornblith
6db380b132 Fix importing files and add a basic test
Still need to make the progress indicator work again. Also there may be
some performance to be gained by pooling item saves into a transaction
if one is already open.
2015-06-12 16:58:57 -04:00
Dan Stillman
f7216298b4 Update character set handling
Restore prepopulated charset table, but this time with just the
encodings from the WHATWG Encoding Standard. Assigning a charset to
Zotero.Item::attachmentCharset runs the value through
Zotero.CharacterSets.toCanonical() automatically.

This migrates attachment charsets to the new canonical values, clearing any
that are unsupported.

Other legacy mappings could still be added back, as disussed in #760.
2015-06-12 02:46:02 -04:00
Aurimas Vinckevicius
16ab576a1c Add toCanonical and toLabel for Zotero.CharacterSets 2015-06-11 17:17:28 -05:00
Dan Stillman
213325636d Disable automatic backups during test runs 2015-06-11 16:06:32 -04:00
Dan Stillman
037bc07a3c Fix timeout on Travis loading 'allTypesAndFields' data 2015-06-11 02:19:49 -04:00
Dan Stillman
f8684cc9d8 Fix tag purging and Zotero.Tags.getName() 2015-06-09 16:47:04 -04:00
Dan Stillman
ac440b2b38 Don't reload collections list when sources are modified
Just update the row that changed, moving it if necessary.
2015-06-09 16:47:04 -04:00
Dan Stillman
1d45c6c882 Reselect the same row when an item is removed 2015-06-09 03:27:45 -04:00
Dan Stillman
1a3ef8ab7f Add comment in resetDB() test 2015-06-08 04:29:16 -04:00
Dan Stillman
2eed12abeb 'collectionsView' -> 'cv' in collectionTreeView tests 2015-06-08 04:14:46 -04:00
Dan Stillman
f93e6706fa Don't refresh collections view when removing groups
Remove rows one by one
2015-06-08 04:14:46 -04:00
Dan Stillman
b43a735b93 Include libraryID in group.erase() notifier data 2015-06-08 04:05:47 -04:00
Simon Kornblith
900a957318 Put a Z at the end of the accessDates in generateAllTypesAndFieldsData
Doesn't actually make a difference to the tests, but it's more correct
2015-06-07 18:52:31 -04:00
Simon Kornblith
70f021f945 Use ISO 8601 accessDates everywhere
This uses ISO 8601 dates for generateAllTypesAndFieldsData (and
changes populateDBWithSampleData to use Item#fromJSON), and makes
translators expect ISO 8601 accessDates, although SQL accessDates are
still supported with a deprecation warning. Canonicalization happens in
Zotero.Translate, so I need to remember to update connectors as well.
2015-06-07 18:50:57 -04:00
Dan Stillman
8448203583 Expect ISO 8601 access dates in Zotero.Item::fromJSON()
This causes translator tests to fail, because the sample data currently
has SQL access dates instead.
2015-06-07 17:54:44 -04:00
Simon Kornblith
3fc38d750b Use Zotero.Item.fromJSON() for saving from translators
Also:
  - Move some canonicalization of items returned by translators to
    Zotero.Translate
  - Make Zotero.Translate#translate return a promise
  - Add tests
2015-06-07 17:30:41 -04:00
Simon Kornblith
e10deedc7e Emit valid prefs.js even when debugging not enabled 2015-06-07 17:22:57 -04:00
Dan Stillman
426ac172ff Disable emptyTrash() test again
This reverts commit 0eea3eaf99.
2015-06-07 17:16:41 -04:00
Dan Stillman
0eea3eaf99 Reenable emptyTrash() assertion to see if it still fails on Travis 2015-06-07 16:48:47 -04:00
Dan Stillman
a22c4969e6 Move editable and filesEditable props to libraries table [DB reupgrade]
And add group.fromJSON(json, userID), which sets editable and
filesEditable properties based on the group JSON (libraryReading, role
lists, etc.) and the given user
2015-06-07 15:50:07 -04:00
Dan Stillman
aa2e0a8582 Update Zotero.Relations.updateUser() for new relations schema
Also adds Zotero.DataObjects::getLoaded(), which returns an array of all
loaded objects of the given type. This is useful for selective
reloading, for example with item.reload(['relations'], true).
2015-06-04 20:38:49 -04:00
Dan Stillman
195a737049 Allow item.addRelatedItem() to work on unsaved item without libraryID
Production code should just assign a libraryID, but this is useful for
tests, and addCollection() does it.
2015-06-04 20:38:41 -04:00
Dan Stillman
da627e137a Add waitForDialog(onOpen, button) support function
Waits for an alert or confirmation dialog to open and closes it
automatically, optionally after running onOpen(dialog) to check its
contents (e.g., with dialog.document.documentElement.textContent) and
optionally clicking a button other than 'accept' (e.g., 'cancel',
extra1').

Supports delayed accept buttons
2015-06-04 20:31:48 -04:00
Simon Kornblith
d476626c74 Change item.save() to item.saveTx() 2015-06-03 23:45:12 -04:00
Simon Kornblith
7253a2dd8c Map base fields to item-specific fields in Item#fromJSON() 2015-06-03 23:42:08 -04:00
Dan Stillman
87db29f060 Add .gitignore file for PDF tool cache dir in test data directory 2015-06-02 20:32:55 -04:00
Dan Stillman
20ca8edf87 Fix getContentsAsync() with invalid characters 2015-06-02 20:32:31 -04:00
Dan Stillman
424cae173b Fix getField/setField behavior/tests with regard to falsy values
In particular, 0 is kept as a value, and passing undefined to setField
now throws an error.

I'm not sure if we actually want to return an empty string in all cases
for missing/invalid fields, but that's what we do currently.
2015-06-02 19:09:58 -04:00
Dan Stillman
ffff044ce6 Add stack traces to Chai assertion failures 2015-06-02 16:31:33 -04:00
Dan Stillman
dbf47a3e1e Merge pull request #751 from aurimasv/tests-legacy_generators
Check if attempting to use a legacy generator function in Mocha tests
2015-06-02 15:14:06 -04:00
Dan Stillman
77f12527aa Fix NS_BASE_STREAM_CLOSED error, for real
The input stream produced by asyncFetch is closed automatically at EOL,
so the available() call throws this for an empty file.
2015-06-02 14:58:43 -04:00
Aurimas Vinckevicius
294f01bb3a Check if attempting to use a legacy generator function in Mocha tests 2015-06-02 13:34:51 -05:00
Dan Stillman
ee777c5be6 Enable logging for NS_BASE_STREAM_CLOSED error 2015-06-02 05:11:40 -04:00
Dan Stillman
ef3bf8d596 Fix a few test failures/warnings
And simplify tree view load event handling, which may or may not have
been contributing to intermittent test failures, but is cleaner this way
regardless.
2015-06-02 03:51:09 -04:00
Dan Stillman
1f643c1baa Fix skipNotifier option with DataObject::erase() 2015-06-02 03:51:09 -04:00
Simon Kornblith
26673a30c5 See if sorting the test files is enough to get alpha order on Travis 2015-06-01 23:42:38 -04:00
Simon Kornblith
a4e5478957 Run tests in order (I think) 2015-06-01 23:32:57 -04:00
Dan Stillman
a740658452 Relations overhaul (requires new DB upgrade from 4.0)
Relations are now properties of collections and items rather than
first-class objects, stored in separate collectionRelations and
itemRelations tables with ids for subjects, with foreign keys to the
associated data objects.

Related items now use dc:relation relations rather than a separate table
(among other reasons, because API syncing won't necessarily sync both
items at the same time, so they can't be stored by id).

The UI assigns related-item relations bidirectionally, and checks for
related-item and linked-object relations are done unidirectionally by
default.

dc:isReplacedBy is now dc:replaces, so that the subject is an existing
object, and the predicate is now named
Zotero.Attachments.replacedItemPredicate.

Some additional work is still needed, notably around following
replaced-item relations, and migration needs to be tested more fully,
but this seems to mostly work.
2015-06-01 20:28:30 -04:00
Dan Stillman
75bcfcb685 Clean up initialization of attachments tests 2015-06-01 20:23:21 -04:00
Dan Stillman
67663497ec Allow library and item titles to be set in create(Unsaved)DataObject() 2015-06-01 20:23:20 -04:00
Dan Stillman
c1cb832b0b Add getGroup() and createGroup() test support functions
getGroup() can be used to access a default group library for general
group tests. createGroup() can be used to create one for a particular
test or set of tests.
2015-06-01 20:23:20 -04:00
Dan Stillman
5a5a8a93f9 Zotero.Item::addTag() tests 2015-06-01 20:23:20 -04:00
Dan Stillman
5fc524bcb2 Generalize Zotero.CachedTypes.add(), and tweak item charset handling
.attachmentCharset on an item now requires a string, not a charsetID.
(It accepted a charset before but didn't quite work right.)
2015-06-01 20:23:20 -04:00
Dan Stillman
bf0d2a1bf4 Fix collectionTreeView::expandToCollection() 2015-06-01 15:31:57 -04:00
Dan Stillman
c2e7b8ccc0 A couple Zotero.Translate.ItemGetter test fixes 2015-06-01 06:12:11 -04:00
Dan Stillman
b3555983d2 Fix -g test switch 2015-06-01 01:10:54 -04:00
Simon Kornblith
9bb01d737c Merge branch '4.0' into sjk/659 2015-06-01 00:03:20 -04:00
Dan Stillman
5ba344516e Update PDF tool handling in tests
The test runner now downloads and caches the PDF tools for the current
platform within the test data directory and only redownloads them when
out of date, and it updates the download URL so that the full-text code
pulls from the cache directory via a file:// URL.

The installPDFTools() support function now installs the files directly
instead of going through the prefs, and a new uninstallPDFTools()
function removes the tools. Since the presence of the PDF tools can
affect other tests, tests that need the tools should install them in a
before() and uninstall them in an after(), leaving most tests to run
without PDF indexing.

This also adds a callback to the waitForWindow() support function. If a
modal dialog is opened, it blocks the next promise handler from running,
so a callback has to be used to interact with and close the dialog
immediately.
2015-05-31 23:50:26 -04:00
Dan Stillman
1ecd934d04 Merge pull request #743 from egh/feature/search_tests
Add basic tests for fulltext search
2015-05-31 17:46:26 -04:00
Dan Stillman
365f8181e3 Disable emptyTrash() assertion, which is still faiing on Travis 2015-05-31 17:45:25 -04:00
Erik Hetzner
aac1255d3d Add basic tests for full-text search
- also add importFileAttachment support function
2015-05-31 14:39:37 -07:00
Dan Stillman
9e573cdce2 Work around Zotero.Items::emptyTrash() test failure for now
Until I figure out the race condition that's causing this to fail on
Travis, use a different check so that all builds aren't failing.
2015-05-31 17:19:30 -04:00
Simon Kornblith
ca0af1abd6 Missed a UTC adjustment in 673168ea7b 2015-05-31 17:13:32 -04:00
Dan Stillman
8ff108cbdf Merge pull request #745 from Juris-M/simpler-stable-stringify
Simplification of stableStringify()
2015-05-31 17:10:42 -04:00
Simon Kornblith
673168ea7b Don't adjust accessDate for UTC and set version to 0 in Item#toJSON
Ref discussions:
https://github.com/zotero/zotero/pull/746/files#r31394225
https://github.com/zotero/zotero/pull/746#commitcomment-11445605
2015-05-31 17:02:20 -04:00
Frank Bennett
ff1d4fa602 Simplification of stableStringify() 2015-05-31 19:46:11 +09:00
Dan Stillman
fd45032210 Add -g flag to run only tests matching a pattern (grep)
(Actually, it's only matching strings for me, not patterns, but according to
Mocha it's supposed to compile the patterns using RegExp.)
2015-05-31 03:37:45 -04:00
Dan Stillman
420985661b Default to user library when assigning unsaved item to collection
And fix some issues setting the libraryID property on unsaved objects

Also return .deleted as false, not an empty string
2015-05-31 02:03:53 -04:00
Dan Stillman
ed1c0a4637 Fix updating of cached child collections/items, and make more efficient 2015-05-30 19:03:42 -04:00
Dan Stillman
e19ee53f3d Enable debugging for test that's failing on Travis 2015-05-29 14:36:02 -04:00
Dan Stillman
2154673dd3 Return a Zotero.Item from all Zotero.Attachments methods
These previously returned an itemID, but now that new saved items can be edited
without a refetch, they should just return the new item.

(Possible I missed a few spots where these are called.)
2015-05-29 05:33:54 -04:00
Dan Stillman
f3a6b41c1c Add -f test flag to stop after first test failure
(Mocha has a 'bail' config flag that's supposed to do this, but it doesn't seem
to work when passed to mocha.setup() (maybe because we're setting a custom fail
handler?), so this just calls abort() on the runner manually.)
2015-05-29 04:01:40 -04:00
Dan Stillman
4c5920ba9a Remove stray this.timeout() call 2015-05-29 01:38:47 -04:00
Dan Stillman
5051b938ae Increase default timeout to 5 seconds from 2
This is arbitrary, and we could increase it more or make it configurable via
the command line if Travis continue to time out, but this allows all tests to
complete for me in a VM.
2015-05-29 01:34:20 -04:00
Dan Stillman
025411f9b4 Wait 250ms before quitting after tests, to avoid DB errors
Not crazy about this, but (at least on my system) it's an easy way to
avoid DB errors due to interrupted transaction or query errors after the
DB connection was cleaned up. (I can reproduce those pretty reliably
right now by running collectionTreeView tests alone.)
2015-05-29 01:15:04 -04:00
Dan Stillman
4e1dd6f5b6 Restore DB parameter checking and add tests
Some parameter situations also weren't being properly handled
2015-05-29 01:15:04 -04:00