Commit graph

7138 commits

Author SHA1 Message Date
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
526c5f8112 Don't break Dan Cohen's library
(Though if you think about it, all of our publications may indeed become
Dan Cohen's eventually.)
2015-06-12 03:30:08 -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
Dan Stillman
4bc5479b19 Merge pull request #760 from aurimasv/charsets
Add toCanonical and toLabel for Zotero.CharacterSets
2015-06-11 22:06:53 -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
c407675d6a Fix more Travis timeouts, hopefully 2015-06-11 16:06:00 -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
33c19715a8 Avoid error when dragging over header row 2015-06-08 04:29:16 -04:00
Dan Stillman
9a45fa94bd Move transaction wait debug output to level 6, and strip Bluebird lines
This output is basically only useful when something hangs, so it can
stay off all other times.

For now, 6 can be the new only-use-when-something-is-actively-broken
level. At some point we may want to move DB activity to 4 and make this
sort of thing 5, because we don't have much that's 4 right now.
2015-06-08 04:14:47 -04:00
Dan Stillman
2d6143dce1 Clean up notifier debug output 2015-06-08 04:14:46 -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
Dan Stillman
ec89a98f9d Add group.eraseTx() 2015-06-08 04:05:47 -04:00
Dan Stillman
cd2898ece3 Update Bluebird to v2.9.27 2015-06-08 04:05:46 -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
337a835fed Merge pull request #753 from zotero/sjk/translation-save
Use Zotero.Item.fromJSON() for saving from attachments
2015-06-07 17:41:10 -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
Simon Kornblith
ec5e20659b Improve error handling for attachment saving 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
Simon Kornblith
e27d907973 Throw an error if HTTP request yields non-OK in importFromURL() 2015-06-07 16:06:59 -04:00
Dan Stillman
6935310c75 Fix Zotero.Users.setCurrentUsername() 2015-06-07 15:50:07 -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
53706d633a Make Zotero.HTTP exceptions instances of Error 2015-06-07 15:43:09 -04:00
Dan Stillman
16706ba481 Allow Zotero.HTTP.request() to be mocked
sinon.useFakeXMLHttpRequest() doesn't work in our case, but if
Zotero.HTTP.mock is set, Zotero.HTTP.request() will create new instances of
that object instead of the built-in XMLHttpRequest, so it can be set to
FakeXMLHttpRequest:

Zotero.HTTP.mock = sinon.FakeXMLHttpRequest;
var server = sinon.fakeServer.create();
server.autoRespond = true;
server.respondWith("GET", "/users/1",
  [200, {"Content-Type": "application/json"}, '{"userID": 1}']);
var userInfo = yield getUser();
Zotero.HTTP.mock = null;
server.restore(); // probably not necessary
2015-06-07 15:23:12 -04:00
Simon Kornblith
38eeab06a3 Some snapshot-related fixes 2015-06-07 14:02:20 -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
582799e428 Fix Zotero.Attachments.importSnapshotFromFile 2015-06-04 20:22:54 -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
3ad15f7b59 Use Zotero.Utilities.Internal.exec() for PDF tool calls 2015-06-02 14:58:44 -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