Commit graph

1611 commits

Author SHA1 Message Date
Abe Jellinek
310e741a01
Fix duplicate attachment row from attachments-box notify() (#4250) 2024-06-19 02:23:46 -04:00
Dan Stillman
fad3e25278 Local API: Return 404 for unknown group library 2024-06-19 00:40:13 -04:00
Bogdan Abaev
a532cfb475 trash functionality for collections and searches (#3307)
When a collection or a saved search is deleted, it appears in
trash among other trashed items. From there, it can be restored
or permanently deleted.

Items of trashed collections are not affected my the trashing/permanent
deletion of a collection and need to be deleted separately like before.

Subcollections of a trashed collection do not appear in the trash and
are restored or permanently deleted with the top-most trashed parent.
2024-06-17 23:14:21 -04:00
Adomas Venčkauskas
338afc2b80 Add tests for HTTP integration endpoints 2024-06-17 12:45:28 +03:00
Dan Stillman
137a1ddcc0 Missing file for 639b4b5623 2024-06-15 00:45:28 -04:00
Dan Stillman
639b4b5623 Use local HTTP server for Zotero.BrowserDownload test 2024-06-15 00:40:03 -04:00
Abe Jellinek
50e2250fe0
Add pref to enable local API (#4236)
And keep enabled in tests
2024-06-14 06:25:39 -04:00
Dan Stillman
17539404b2 Fix test failure calling item.toResponseJSON() with no library set
After #4270
2024-06-12 05:50:36 -04:00
Abe Jellinek
5d197e4b12 Mostly complete (read-only) compatibility with web library (#4270)
- Add pagination, limits, and Link header
- Add schema endpoints and dummy /settings endpoint
- Add /file endpoints
  - Browser security restrictions prevent the web library from actually loading
    the file: URIs that the local API returns, but out-of-browser use will work
    fine
- Add toResponseJSONAsync() DataObject function: delegates to toResponseJSON()
  by default, adds information that requires awaiting promises
  - Best attachment (links.attachment) and file size (links.enclosure.length)
    for items, meta.numItems for groups
  - Separate function for compatibility with the existing test code that uses
    toResponseJSON(), but we could consider unifying

This commit does not add the Access-Control headers that allow webpages to make
requests to the local API, since I don't think we actually want that.
2024-06-12 05:45:48 -04:00
Abe Jellinek
44d9530ecf Add local implementation of Zotero web API (#4270)
This required some tweaks to other parts of Zotero infrastructure:
- Search:
  - Add 'includeDeleted' condition to match behavior of 'includeTrashed' API
    parameter in a single search
- Data objects:
  - Improve toResponseJSON() implementations so output better matches the web
    API
    - Add toResponseJSON() to Zotero.Tags - has to be async so it can query the
      database and generally works differently from other toResponseJSON()
      functions, but accomplishes the same task
  - Remove unused getAPIData() and apiDataGenerator() DataObject functions. They
    aren't functional and wouldn't really make implementing the local server
    easier, so now seemed like a decent time to remove them
- Server:
  - Support resolving routes using pathparser.jsm
    - Add allowMissingParams option to PathParser#add(): prevents /route from
      matching /route/:param
  - Replace the query property of the data object sent to endpoint init()s with
    searchParams, an instance of URLSearchParams - supports #getAll() for
    repeatable parameters
- URIs:
  - Make getObjectURI() public, add utilities for converting URIs to API
    endpoints and web library URLs
2024-06-12 05:45:38 -04:00
windingwind
a6076ce76c
Fix item pane header (#4159)
* Improve feed item pane header (fixes #4141)
* Show item pane custom head when headerMode is none (fixes #4116)
* fx115: Fix button style on windows (fixes #4120)
* Move split-menu-button styles to SCSS
2024-06-04 02:14:20 -04:00
abaevbog
e7c7367509
zp tab focus tests pass if run on their own (#4183)
Make sure that more than one tab is opened before tab navigation
tests are run so that the tabs menu is always focusable.

Fixes: #4180
2024-05-31 05:54:26 -04:00
windingwind
5ebd6c4141 Try to fix unstable attachments pane test 2024-05-29 21:27:13 +08:00
Martynas Bagdonas
e96426d18c Adjust fulltext test 2024-05-28 17:32:03 +03:00
Martynas Bagdonas
97c37de7f7 Update reader and pdf-worker submodules and partially disable one test 2024-05-28 17:18:56 +03:00
windingwind
fe3dae2d15
Refactor AttachmentPreview render and discard (#4161) 2024-05-28 00:05:29 -04:00
Abe Jellinek
3176516b79 Feeds: Fix error parsing items with rights information
- 59afef6 added a duplicate assignment to item.rights that was putting
  a TextConstruct(!!!!) in the item JSON field instead of a string
- info.rights was being set to a TextConstruct (preexisting issue!)
2024-05-23 14:20:44 -04:00
Abe Jellinek
92bb96ac49 Feeds: De-prioritize prism:copyright
Seems to be more used for copyright owner names than license
information, which is probably what we want in that field when it's
available.
2024-05-23 14:16:38 -04:00
abaevbog
9325f773cc
fix tagsbox enter glitch (#4160)
The 'blur' event needs to be dispatched by editable-text
before its state is reset (not after) because tagsbox uses
.initialValue in the 'blur' handler.

followup to 101e6d55d5

Fixes: #3575
2024-05-23 00:16:36 -04:00
Dan Stillman
721f54fe49 Disable tagsbox test again due to CI failures (#3575) 2024-05-22 23:22:05 -04:00
Dan Stillman
debe5590f2 Temporarily disable intermittently failing tests (#4139) 2024-05-22 23:02:56 -04:00
Abe Jellinek
59afef6c2e
Feeds: Refactor to move field extraction to FeedProcessor (#4158)
And support more PRISM fields.
2024-05-22 18:29:58 -04:00
Dan Stillman
14c6d26f20 Clarify comment for numDistinctFileAttachmentsForLabel() test 2024-05-19 00:54:13 -04:00
Dan Stillman
47bf4de08a Add test for numDistinctFileAttachmentsForLabel() filter function 2024-05-19 00:52:36 -04:00
windingwind
bc47ee46c8 Fix item pane buttons after CEification
Fixes #4115
2024-05-15 06:45:10 -04:00
windingwind
9a23031c12 Rename ItemPaneHeader CE localName to item-pane-header
Closes #4114
2024-05-15 06:45:09 -04:00
windingwind
91c0c28b5d Fix attachments & annotation box refresh bugs and add tests (#4031)
Fixes #3993
Fixes #3995
Closes #4082
2024-05-15 06:45:01 -04:00
Dan Stillman
07e8f0a01d Try to make numDistinctFileAttachmentsForLabel() test more reliable 2024-05-15 06:09:40 -04:00
Dan Stillman
0c8d3f0829 Improve counting of file attachments for Show File and Export PDFs
If a parent item and its primary attachment are selected, it should
still say "Show File" rather than "Show Files". This adds the
questionably named `Zotero.Items.numDistinctFileAttachmentsForLabel()`
to try to figure out if we're operating on 0, 1, or >1 items.

Follow-up to #4124
2024-05-15 05:50:47 -04:00
Dan Stillman
9783cc57c4 Add test for placement of creator rows in Info pane 2024-05-11 04:09:12 -04:00
Bogdan Abaev
be1c890051 After new item creation, focus title in itemBox (#4113)
When item is created manually, title field in itemBox
will be focused instead of the title in the itemPane as before.
If the itemBox is collapsed, it will be opened.

Added 'open' setter to item pane section for brevity

Fixes #4111
2024-05-11 04:09:05 -04:00
Abe Jellinek
59b1d75b98
Item pane header customization (#3791) 2024-05-10 08:23:26 -04:00
Dan Stillman
85f58cc97d Fix Utilities.Internal.md5Async() on missing files and empty strings
https://forums.zotero.org/discussion/114208/zotero-7-beta-bug-report-consistent-error-when-syncing
2024-05-08 01:16:37 -04:00
Abe Jellinek
8f2bf50cec
Try to prevent ConcurrentCaller from failing CI (#4097) 2024-05-07 19:38:44 -04:00
Abe Jellinek
bd9048861c HiddenBrowser: Test download blocking
9b7d3edbb3
2024-05-07 11:17:30 -04:00
Abe Jellinek
da1eb6fda9 Feeds: Prefer content to summary when available 2024-04-30 02:14:57 -04:00
Dan Stillman
81ed1f6ebb Strip line and paragraph separators in filenames
And don't fail on existing filenames with these characters in
`Item::attachmentFilename`

https://forums.zotero.org/discussion/114025/pdf-files-renaming-casuing-syncing-issue
2024-04-28 07:51:25 -04:00
Abe Jellinek
a5393ca0e5 Merge: Keep external annotations on master, don't erase on other
PDFWorker only re-imports external annotations when the file changes on
disk. Keep annotation items corresponding to external annotations so
that they don't disappear after the merge (and then come back when the
file is edited).

Tweaks behavior introduced in 2aa34a6.

https://forums.zotero.org/discussion/113943/zotero-7-beta-merging-pdf-files-leaves-ghost-external-annotations
2024-04-25 16:35:09 -04:00
Dan Stillman
704d90cd83 Use startHTTPServer() in FeedReader test 2024-04-20 06:41:57 -04:00
Dan Stillman
9ffb430207 Return baseURL from startHTTPServer() test support function
Since it should almost always just be `http://localhost:${port}/`
2024-04-20 06:41:57 -04:00
Abe Jellinek
8b13f717b4 SAXXMLReader: Handle non-UTF-8 encodings (#3846) 2024-04-20 06:41:51 -04:00
Abe Jellinek
f7dc68c7f4
Render RSS description as HTML (#3956) 2024-04-18 06:39:17 -04:00
abaevbog
2835d6fe83
tag selector focus edits, fix windowing breakage (#3984)
* tag selector focus edits

- no tabstop on the tag selector scrollable area
- change tag selector's role from default "grid" to "group".
"grid" is not quite correct semantically and leads to
voiceover suggesting irrelevant commands.
- move all keyboard handling logic to tagSelectorList.jsx.
Tabbing through tag selector is now handled in ZoteroPane,
so the only logic left there is arrow navigation
between tags, and there's no reason to not have it
together with the tags list.
- a workaround to deal with focused tags when windowing
kicks in. When a tag is focused, record its index.
Each time tags are re-rendered, if the saved index is not
among rendered tags, refocus it, otherwise, move focus
to the tags list.
2024-04-18 08:39:36 +03:00
Dan Stillman
4fe0ebc63b Fix skipBundledFiles not being passed to Zotero.reinit() in tests
Making tests much slower

Regression from 2051f08b4c
2024-04-16 06:09:59 -04:00
abaevbog
c7c3784413
fix focus test breakage after zotero@6859614 (#3977)
- edits to zoteroPaneTest.js focus tests to expect the updated focus
sequence: selected tab -> tabs menu -> sync button -> collectionTree
toolbar -> collectionTree -> tags selector -> itemTree toolbar
- updated tags selector keydown handling to explicitly handle all
tab/shift-tab events using moveFocus. It is more readable and explicit
focus handling for all components is required for programmic tab/shiftTab
events dispatched in tests to actually move focus
Fixes: #3975
2024-04-14 02:16:16 -04:00
Dan Stillman
2e8073ab9d Disable failing tabbing tests
To be fixed in #3975
2024-04-13 03:54:58 -04:00
Abe Jellinek
5263c79ea8 BlockingObserver: Re-enable in CI 2024-04-11 22:59:48 -04:00
Dan Stillman
b44757ad3c CI: Re-enable retractions tests
See #3962
2024-04-11 06:09:12 -04:00
Dan Stillman
bef389e110 CI: Temporarily disable BlockingObserver test due to #3962 2024-04-11 05:58:51 -04:00
Dan Stillman
02a48c5a84 Add test for importing BibTeX from the clipboard 2024-04-10 07:13:47 -04:00
windingwind
49923780ca
fx115: replace text/unicode with text/plain in clipboard code (#3945) 2024-04-09 17:47:40 -04:00
Dan Stillman
38dc364f57 CI: Temporarily disable retractions tests due to failure in fx115 2024-04-08 03:11:23 -04:00
Dan Stillman
b3d07a5ddf Remove initPDFToolsPath() call 2024-04-06 16:16:04 -04:00
Dan Stillman
20d6cde85f Remove obsolete initPDFToolsPath() in tests 2024-04-06 04:38:33 -04:00
windingwind
b2ad17d604 CEify itemPane 2024-03-30 00:58:57 -04:00
Dan Stillman
5730bf690e fx115: Don't try to spy on IOUtils function in test
Since it doesn't work
2024-03-30 00:58:55 -04:00
Dan Stillman
03d414f3bd fz115: Update SingleFile tests to expect <html style>
Which I guess we get now instead of `<html>`?
2024-03-30 00:58:54 -04:00
Dan Stillman
920461cd9d fx115: Update lots of OS.File/OS.Path uses 2024-03-30 00:58:54 -04:00
Dan Stillman
33db3c28fc fx115: Restore test runner 2024-03-30 00:58:53 -04:00
Abe Jellinek
63f54d3184 FileHandlers: Fall back when _getSystemHandler() fails
Continue to Zotero.launchFile() as intended.

https://forums.zotero.org/discussion/113179/pdfs-will-not-open-in-system-reader-when-double-clicked
2024-03-27 13:23:54 -04:00
Abe Jellinek
65db66eb33 Add tests for shortTitle tag closing 2024-03-22 13:14:52 -04:00
Tom Najdek
16fa1ac893
Fix attachment icon remains after deleting attachment. Fix #3779 2024-03-08 15:22:15 +01:00
Abe Jellinek
ea63780600 FileHandlers tests: Wait for notifier instead of _setState() call
_setState() doesn't await setAttachmentLastPageIndex(), so the setting
sometimes won't be updated in the cache by the time we call
getAttachmentLastPageIndex() below. Notifier event should work every
time (and is a lot simpler).
2024-02-29 11:05:12 -08:00
Abe Jellinek
352f71e32e
Fix zotero://open/ and FileHandlers regressions (#3761) 2024-02-29 05:08:33 -05:00
Abe Jellinek
5e10e627c3
Replace calls to keepParents() with keepTopLevel() (#3766) 2024-02-28 19:13:20 -05:00
Tom Najdek
cffb5cdd4b
Fix best attachment type sometimes missing. Fix #3740 2024-02-26 13:14:27 +01:00
Abe Jellinek
a7d59a90d3
Unify attachment opening code and support EPUB/snapshot note links (#3705) 2024-02-23 06:38:11 -05:00
Tom Najdek
b1333d0e9d
More attachment type icons in the item tree (#3645) 2024-02-23 06:11:40 -05:00
Abe Jellinek
64b8c7b250
SingleFile actor: Skip cross-origin frames to fix error (#3721) 2024-02-21 06:43:45 -05:00
Abe Jellinek
1f599283df
Fix indexing files with text content types that Firefox won't display (#3708) 2024-02-19 05:11:16 -05:00
Tom Najdek
1b751d675b
Trim spaces from values in getFileBaseNameFromItem (#3711) 2024-02-19 04:43:19 -05:00
Tom Najdek
abe8def0f1
Trim leading/trailing space in filename format string. Fix #3701 2024-02-16 10:17:03 +01:00
Abe Jellinek
4a91df1b1d
Add test for SandboxItem#setExtra() (#3572) 2024-02-09 09:34:47 +02:00
abaevbog
4b3f61d8ca
Fix to tagsbox test timeout in CI (#3665)
Activate the window only when the document does not have focus.
Some platforms (macOS) require the window to be brought to the front,
while others (Linux) place it at the front from the start, and activation
should be skipped.
2024-02-06 02:30:29 -05:00
Dan Stillman
7094945dff Add missing await in advanced-search test 2024-02-01 00:55:02 -05:00
Dan Stillman
d116d8d0b7 Disable item-tags-box test for now
Failing in CI only
2024-01-25 00:00:25 -05:00
Dan Stillman
db4d7d5838 Fix recognizeDocument test failures
Wait for all progress-queue rows to be done processing before moving on
to the next test. Without this, preview rendering or other operations
can cause test failures by delaying the `ZoteroPane.selectItems()` call
for the new parent item in `_processItem()` until the middle of a
following test (due to the await for file renaming [1]). If it's delayed
until after the next attachment has been created, the previous parent
item will be selected after the new attachment and `recognizeSelected()`
in the test won't work. This is most pronounced with the reader, but it
was apparently happening previously due to something else, hence the
explicit item selection (now removed) in one test.

[1] 21e50add60/chrome/content/zotero/xpcom/recognizeDocument.js (L289-L301)
2024-01-24 23:32:22 -05:00
Abe Jellinek
a0ab7783ee Remove explicit delay in tag update test 2024-01-24 23:32:21 -05:00
Dan Stillman
a8916b797e Fix quick-search test 2024-01-24 23:32:20 -05:00
windingwind
6f466b25bd Fix Item pane "should refresh on file rename" test 2024-01-24 23:32:20 -05:00
abaevbog
91876e4185 updated collection filter collapsed rows test
It should ensure that all rows that were collapsed before filtering
are collapsed once the filter is cleared.
2024-01-24 23:32:20 -05:00
abaevbog
ac7cc34485 updated tagsbox test to work with the new design 2024-01-24 23:32:20 -05:00
Dan Stillman
b66ac0d493 Remove tags-box tests in note editor tests
Will be moved to separate tags-box tests
2024-01-24 23:32:20 -05:00
Abe Jellinek
b24d7d8f44 Fix tags box tests 2024-01-24 23:32:18 -05:00
Abe Jellinek
fbd8db3c8e Fix New Collection test 2024-01-24 23:32:17 -05:00
Abe Jellinek
301058cf9d Fix notes pane tests 2024-01-24 23:32:17 -05:00
Bogdan Abaev
8e4fd75f1d passing newItem tests 2024-01-24 23:32:16 -05:00
abaevbog
1e793a37a8 fix collection tree test breakage
Save the child collection after removing its parent in toJSON() collectionTest.
Otherwise, getDescendents throws an error if the parent collection
tries to access the deleted child in later tests.
2024-01-24 23:32:12 -05:00
abaevbog
8c0116d1db tabs menu update and minor refactoring
- tabs menu button is disabled when no reader tabs are opened
- tabs menu popup will be hidden if all tabs are closed
- keypress event handling moved from tabBar.jsx to zoteroPane.js
because all other keyboard navigation events are handled there
and it already has the functionality to skip disabled or hidden components
(e.g. tabs menu button, sync error)
- minor tweaks to tests to wait for collection search bar to hide
to get keyboard navigation tests passing
2024-01-24 23:32:01 -05:00
Bogdan Abaev
13de06cd52 itemBox redesign
- Table structure rewrite to use grid layout instead
of the <table> component so that screen readers can see the content
- Added icons to mirror right-click actions
- Moved creator actions to the options menu
- Drag-drop to reorder creators
- Using editable-text instead of clicky component
- Consolidated autocomplete logic in one function
- Added @focus-ring to all components of the itemBox
- Fields are focusable and navigatable via keyboard in non-edit modes
- General refactoring to consolidate stylesheets across platforms
and remove code that's not more used (mainly related to handling old
clicky text component).
- Retractions panel background set for --material-background instead
of light pink in dark mode.
2024-01-24 23:31:52 -05:00
abaevbog
fb26921e11 Opened tabs menu with a search bar
- Matching substrings from tab's title are bolded.
- Drag-and-drop functionality to reorder tabs.
- ArrowUp/ArrowDown navigate the tab's titles. Tab/Shift-Tab move
across both titles and close buttons. Enter from filter field focuses
the first tab's title. Home/PageUp focuses the filter field. End/PageDown
focuses the last tab's title. ArrowUp/ArrowDown from the filter focus
the last/first tab's title respectively. ArrowUp from the first tab or
ArrowDown from the last tab focus the filter.
2024-01-24 23:31:51 -05:00
Dan Stillman
ce1bdba37a Sort tests case-insensitively and without "Test.js"
So HiddenBrowserTest.js doesn't run before advancedSearchTest.js and
zoteroPaneTest.js doesn't run before zoteroTest.js
2024-01-24 04:03:35 -05:00
Dan Stillman
51b615c54c Fix relatedbox tests after redesign 2024-01-24 04:03:35 -05:00
Bogdan Abaev
f8a6b82c63 collection search 2024-01-24 04:03:12 -05:00
Abe Jellinek
810402c9c7 Implement pane header, non-tabbed layout, collapsible sections, and new abstract box 2024-01-24 03:42:43 -05:00
abaevbog
200e1d7564 toolbar and keyboard navigation updates
1. Toolbarbuttons changes:
	1. “New Library” moved from toolbar to File menu
	2. “New note” on click makes a standalone note
	3. “New attachment” on click adds stored copy of a file
	4. Menuitems from old note or attachment menus moved to the File menu
	5. “Advanced search” removed. Sync and Locate buttons moved to the top-right corner (Locate - temporarily)
	6. Added “Opened tabs” toolbarbutton
	7. Updated tooltips
2. Added a toolbarbutton that reveals collection search field on click. Search field is hidden on blur if empty. Keyboard accessibility via tab/shift-tab.
3. Tab based navigation restructuring. For each component, create a mapping of target ids with desired focus destination for each relevant keyboard event and use that to determine where to move focus next. Fixed bugs with focus wraparound not working when a note or attachment is opened in contextMenu.
4. Make quick-search dropmarker a sibling of the textfield. QuickSearchTextbox does not extend search-textfield anymore. It serves as a container to house dropmarker and textfield as siblings. This is needed to remove focus ring from quick search textbook when focus moves onto the dropmarker.
5. Separate toolbars for item and collection trees. Removed unused code manually setting the width of toolbar section
6. Focusable tabs + keyboard navigation:
	1. Shift-tab from opened tabs menu moves focus to the currently opened tab
	2. When a tab has focus, use left/right arrows to select tabs, or CMD/Ctrl + arrows to move focus between tabs
	3. Enter or Space on a focused tab will select it if needed and move focus to the contentPane of the reader of this tab
	4. Shift-tab from tabs wraps focus around to itemTree or itemPane
7. “New collection” creates collection contextually within currently selected library or collection.
8. Items pane minimum width increase to avoid quicksearch from being squashed
9. Do not move focus to title field of itemBox after itemTypeMenu is closed with ESC.
10. Display all itemTypes without "Show more" submenu in "New Item" meunu. Removed "Store Copy of File" and "Link to File" from "New Item" menu.
2024-01-24 03:42:42 -05:00
Adomas Venčkauskas
7811d78cb0 Fix quick search item tree issues when moving attachments into/out of parents
Closes #3561
2024-01-12 10:31:00 +02:00
Adomas Ven
8b77c96e97
Displays a browser window to clear captcha when saving attachments. (#3526)
- Currently enabled only for ScienceDirect. Can be enabled via a whitelist
- Matches the HiddenBrowser loaded HTML page for a captcha element. If
  the captcha element class changes, this will break (but the
  alternative is potentially displaying a captcha clearing window when
  something else that is not a captcha guard is loaded).
- Captcha clear timeout for 60s.
- Doesn't automatically switch focus back to the browser which intiated
  the item save via the Connector.
- Stores the cookies used to clear the captcha for future saves from the
  same domain. Discards Connector supplied User Agent, since CF bot
  detector checks UA header against actual UA behavior like TLS handshake
  and if the UA acts different to what it's supposed to, the bot
  challenge is not cleared.

Other changes:
- Adjusted the cookie sandbox to allow multiple cookie sandboxes to be
  active (and simplified some legacy code that was meant to cover a bug
  in old FX codebase).
- HiddenBrowser API changed to be Object oriented, translator tester
  in the translate repo will need to be updated after a merge (have the
  change ready).
- Improved Connector Server attachment progress handling
2023-12-27 04:43:50 -05:00
Adomas Venčkauskas
32ba987c28 Fix failing Advanced Search test (regression 172fe371) 2023-12-12 18:14:19 +02:00
Dan Stillman
f1373652e6 Fix file:// URI handling in getBinaryContentsAsync() 2023-11-10 15:58:53 -05:00