Commit graph

1744 commits

Author SHA1 Message Date
Dan Stillman
87d27f9c51
Close ProgressQueueDialog after connector server tests (#5446)
Since some connector operations trigger recognition

This will hopefully fix the tags box test failures.
2025-07-31 21:54:15 -04:00
windingwind
773ca6f724
Improve item pane test stability (#5436) 2025-07-31 21:51:40 -04:00
Dan Stillman
5063a8b396 isAbove → isAtLeast in sync engine tests for testing delays
Maybe related to Bluebird?
2025-07-31 10:45:19 -04:00
windingwind
08e2be9875 fx140: fix item pane test further
Should call updateLayout after changing layout
Should wait for notify after saving object
2025-07-30 22:31:11 -04:00
windingwind
0ce54e2b14 Fix item pane test failure
fix: #5421
2025-07-30 22:31:11 -04:00
windingwind
d1c6ee33be Fix plugin API test failure
Fix: #5411
2025-07-30 22:31:09 -04:00
Abe Jellinek
0a62553746 Remove remaining chai-as-promised method calls 2025-07-30 22:31:08 -04:00
Abe Jellinek
9442b7ee6c Fix Zotero.Feed tests after chai-as-promised removal 2025-07-30 22:31:08 -04:00
Abe Jellinek
7e706354f9 Don't try to reject last feed item when FeedReader terminates
As the comment says, this hasn't been useful (and isn't used anywhere),
and I honestly don't understand how the test ever passed - process()
would've resolved all the feed item promises already.

Fixes #5412
2025-07-30 22:31:08 -04:00
Dan Stillman
f81763b173 Remove Chai as Promised
A test using `assert.eventually` was failing after the Bluebird removal
but worked with just `await`, and since there hasn't really been much
point to Chai as Promised since the introduction of `async`/`await` ages
ago, just remove the library instead of figuring out why.
2025-07-30 22:31:08 -04:00
Dan Stillman
6809aa50ad Fix item tree tests after Bluebird removal
Remove uses of PromiseInspection.value()
2025-07-30 22:31:07 -04:00
Dan Stillman
0bf4fc54c4 Remove uses of Promise.isFulfilled() in connector server tests 2025-07-30 22:31:07 -04:00
Dan Stillman
c2b6a9cc12 fx140: Fix NetUtil import in server tests 2025-07-30 22:31:03 -04:00
Dan Stillman
c4cfee1807 fx140: Fix additional mendeleyImport.mjs imports 2025-07-30 22:30:58 -04:00
Abe Jellinek
97dbcc6870 Restore timeout in dataObjectTest.js, fix test
OK, the timeout removed in 05e8da wasn't actually useless, but this test
was.

41706a changed erase() so it no longer forwards skipNotifier when
deleting child items. That means that we *would* get a notify() call for
the deleted child, so the test should have been failing.

However! Because of a bug in Bluebird's filtered catch() implementation,
Promise.TimeoutError wasn't recognized as an Error subclass, and it was
instead used as a predicate function, which would always pass.

So all errors were caught as "timeouts" and suppressed, making this test
always pass. Now it no longer always passes (but does pass with the
current behavior).
2025-07-30 22:30:57 -04:00
Abe Jellinek
6203b9712d Fully asyncify feedTest.js 2025-07-30 22:30:57 -04:00
Abe Jellinek
20e75c3251 Remove Bluebird methods in concurrentCallerTest.js
This is really messy and not ideal, but these tests were written for
Bluebird Promise state inspection, and it's difficult to make them look
nice without that being available.
2025-07-30 22:30:57 -04:00
Abe Jellinek
2bc0afa830 Remove useless timeout() in dataObjectTest.js 2025-07-30 22:30:57 -04:00
Abe Jellinek
d9341bbf1a Use alternate method to test feed check delay 2025-07-30 22:30:56 -04:00
Abe Jellinek
2b7535cd83 Fix test runner
By restoring ZOTERO_TEST=1 in runtests.sh after 711b336.
2025-07-30 22:30:56 -04:00
Abe Jellinek
964b5a0e88 fx140: Fix remaining bare ChromeUtils.import() calls 2025-07-30 22:30:54 -04:00
Dan Stillman
3e0d2c06f1 Support arch-specific builds on Windows and Linux
`fetch_xulrunner`, `dir_build`, and `build.sh` now take an optional `-a`
argument on Windows and Linux to specify the architecture to
fetch/build. If `-a` is omitted for `dir_build` (as in `build_and_run`),
it defaults to the current architecture.

xulrunner hashes are now computed for each architecture. This changes
some filenames in xulrunner/, so you may want to clean out some old
folders/files.

This removes the custom handling for CI, since it will now default to
the architecture of the test runner.
2025-07-30 22:30:53 -04:00
Abe Jellinek
67d2e1cead fx140: Asyncify/ESMify tests
They seem to be succeeding when run individually, but failing when
run as a whole. Not sure why yet.
2025-07-30 22:30:53 -04:00
Abe Jellinek
b9e560d33e fx140: Remove EventUtils
Unused, relied on hiddenDOMWindow.
2025-07-30 22:30:38 -04:00
Abe Jellinek
488bcc484f Replace uses of Zotero.Promise.defer() as a constructor 2025-07-30 22:30:33 -04:00
Abe Jellinek
95038a7da5 fx140: ESMify RemoteTranslate and uses 2025-07-30 22:30:30 -04:00
Abe Jellinek
ece2b59700 fx140: More progress toward startup 2025-07-30 22:18:36 -04:00
Abe Jellinek
8d0923f119 fx140: Remove Bluebird
All module code runs in strict mode, and that breaks Bluebird.

And add a partial shim for the simplest and most useful methods. Not
sure if we actually want that, or if we should just replace it entirely
with native methods.
2025-07-30 22:18:35 -04:00
Abe Jellinek
78534ff2d2 FileHandlers: Infer PDF pageIndex from annotation key
And:

- Update createAnnotation() test support function to create valid EPUB
  and snapshot annotations
- Add more FileHandlers tests
2025-07-30 11:37:52 -04:00
Adomas Venčkauskas
11014be449 Server: Add support for UTF in server headers (RFC2047) 2025-07-24 13:26:23 +03:00
Dan Stillman
b31b71304d ZFS: Don't retry download for canceled redirect with mtime/hash match
This was a regression from the switch to `Zotero.HTTP.download()`. 302
wasn't a success code, so `HTTP.download()` would throw, and since the
status wasn't set correctly on the `XMLHttpRequest` within
`HTTP.UnexpectedStatusException`, it would think it was an interrupted
S3 connection and trigger another download after a delay.
2025-07-24 01:31:25 -04:00
Abe Jellinek
5e1541c5ee Extract activateZoteroPane(), try different activeness check
This should hopefully fix intermittent CI failures.
2025-07-23 11:23:36 -04:00
Dan Stillman
9b1950c9ea Clear HTTP.mock at end of ZFS tests 2025-07-22 22:12:52 -04:00
Dan Stillman
d1ea8a397b Use BrowserDownload for 403 when enforcing type in downloadFile()
Fixed regression (probably in 1f401f0897) causing Find Full Text not to
use BrowserDownload for a 403

https://forums.zotero.org/discussion/125581/zotero-suddenly-fails-to-retrieve-full-text-although-i-have-access
2025-07-22 22:12:00 -04:00
Dan Stillman
dd10111e5d Close all tabs before item tags box tests to try to fix CI failures 2025-07-15 01:01:54 -04:00
Dan Stillman
42e21d4fa1 Disable citeproc-rs tests, which are failing after Chicago style update
Note sure why
2025-07-15 00:46:10 -04:00
Dan Stillman
01683b6ccb More chicago-note-bibliography → chicago-shortened-notes-bibliography 2025-07-15 00:46:10 -04:00
Tom Najdek
98d7d8c408
Re-implement "Create Parent Dialog" without using React (#5380)
* Fixed an issue where the window size did not match the content
* Replaced the semi-transparent progress bar with a spinner
* Fixed a problem that allowed triggering a search while one was already in progress
* Reduced code complexity
2025-07-15 00:29:54 -04:00
Abe Jellinek
aff57c2254 Fix all cookies being lost during remote translation (#5357) 2025-07-14 14:00:38 -04:00
Dan Stillman
408f1274f4 Select library tab before item tags box tests 2025-06-12 09:45:27 -04:00
abaevbog
c493a17b13
Connector server support to adding a note (#5064)
* support adding a note from connector

- pass canUserAddNote flag in ping response to tell
the connector that it should display a note field
- when the connector sends a note, create a child note item
if it does not yet exist and set its content. If the
child item for user-added notes is already created,
update it
- if the connector sends an empty note, user-added child
note item is deleted
- record child notes added by the user in _userAddedNotes
cache to distinguish between user added notes and
notes added by the connector automatically
- if the target library changes, child note items are
moved to the new library as well. _userAddedNotes
will be updated to reflect new itemIDs
- if there are multiple toplevel items being added,
the note is added to all of them

Also fix breakage when switching between collections
from different libraries. Fixes: #5331
2025-06-11 14:50:48 +03:00
Tom Najdek
e50787c94f
File renaming: Add pascal case. Fix unicode handling. (#4876) 2025-06-11 01:03:34 -04:00
abaevbog
6ff349d65d
Select child attachment after a file is drag-dropped onto a top-level item (#5328)
And also handle attachments added via context menu

Fixes: zotero#5320
2025-06-05 02:20:13 -04:00
Tom Najdek
ee35361608 Test for subsequent updates providing stale changed object data
From #5297
2025-05-31 02:20:32 -04:00
abaevbog
46f80ebdfb
Citation Dialog: more optimization of initial loading (#5296)
* citation dialog: interactive before io.getFields

- added io.allCitedDataLoadedPromise, which is resolved
when both io.fieldIndexPromise and io.citationsByItemIDPromise
are resolved. Resolved io.allCitedDataLoadedPromise essentially
means that calls to io.sort() and io.getItems()
will be fast because all necessary data is already loaded.
- citation dialog uses io.allCitedDataLoadedPromise to
not await for functions relying on io.sort() and io.getItems()
before the data is loaded, as it could take an arbitrary
amoung of time. Speicifcally, SearchHandler._getCitedItems() and
CitationDataManager.sort. As soon as allCitedDataLoadedPromise
is resolved, cited items will be sorted.
This means that when retrieving fields takes a long time, one can
still add new items, their bubbles will just not immediately
be sorted.
- this replaces earlier SearchHandler.loadCitedItemsPromise, which
was a special case of this handling.
- added a new test ensuring that bubbles can be added even
when io.allCitedDataLoadedPromise is not resolved yet
- cleanup for buildCitation function to remove handling
of io.citation.sortedItems, which is always empty on
load before io.sort() runs
- added a few Zotero.debug statements for future debugging
- Uses a dummy promise if no allCitedDataLoadedPromise 
(e.g. to accomodate the note editor)
2025-05-21 09:55:41 +03:00
Bogdan Abaev
dfc31d9961 citation dlg: data structure refactor, bug fixes
- replace objects with zoteroItem, citationItem, etc.
as the main representation of an entry in the citation
(CitationDataManager.items) with instances of a new BubbleItem class.
BubbleItem has two static methods to create
a new instance: BubbleItem.fromCitationItem() used
to create entries from io.citation.citationItem on load,
and BubbleItem.fromItem used to create entries from
Zotero.Item when a new item is being added into the citation.
BubbleItem.getCitationItem will return a citationItem
in a format that citeproc consumes. This streamlines
the flow of data, makes it easier to manage and avoids
unnecessary conversions between citationItem and Zotero.Item.
- This refactoring fixes the issue of added suffix/prefix
sticking to an item and persisting even if the bubble
is removed and re-added. Fixes: #5282
- add csl data to virtual item in io.customGetItem
to remain consistent with Zotero.Integration.Citation.loadItemData.
That way, csl data is always found on Zotero.Item
and we don't have to check citationItems.

Also:
- apply deduplication to cited items, so that a cited
item from the library that appears in selected or
opened section does not have a duplicate entry in
the cited section.
- added initial test suite for citation dialog
2025-05-19 09:24:01 +03:00
Dan Stillman
2bc0c4861c Fix changed object data not being passed in notifier extraData
Which I apparently broke a decade ago in afe0412c5

And add support for 'deleted' and 'tags', which now use a different
mechanism
2025-05-12 23:36:58 -04:00
Tom Najdek
ed24cce4a1
Fix custom trash header persisting after items are restored or deleted. Fixes #5279.
This was due to a logic bug in `getCurrentPane()`, which returned the wrong pane, causing the incorrect one to be updated.
2025-05-12 17:28:11 +02:00
Abe Jellinek
9ed3f6363c Add test for synchronous Zotero.done() call
No one should do this nowadays, but EM still does.

zotero/translate@c858ce9613
2025-05-09 14:42:06 -04:00
abaevbog
e625c0009e
Fixes to annotation row behavior in trash (#5266)
- right-click on annotation rows in trash will display
  "Delete Permanently" option, instead of an empty menu
- in trash and other non-editable collection rows, disable
  "Add Note from Annotations" button in itemPane header
- remove ability to add tags to annotations and other
  items by dragging them into tag selector from trash
- remove ability to add items to collections by
  dragging them into collection tree from trash
- fix attachment row being removed from trash if
  its child annotation row is erased

Also:
- fix contextPane in reader tab being editable for item in trash
- fix title being editable in attachmentBox for item in trash

Fixes: #5261
2025-05-09 02:05:53 -04:00