Commit graph

1585 commits

Author SHA1 Message Date
Dan Stillman
14f7d3acad Cycle through httpd ports to prevent CI failures
We didn't seem to be doing this anymore, even though we had a comment
for it, and some tests were failing with NS_ERROR_SOCKET_ADDRESS_IN_USE.
2023-06-19 06:54:19 -04:00
Abe Jellinek
2639981dda
Block remote content when indexing HTML file (#3157) 2023-06-12 23:43:18 -04:00
Dan Stillman
117dbe1fe0 Clear Zotero.skipLoading after data directory tests
This was causing a startup error in the re-enabled debug output tests,
which don't reset app state.
2023-05-25 05:45:53 -04:00
Abe Jellinek
794b27c1ad Test debug output logging again
Now that we run tests in Zotero with application menus.
2023-05-24 20:59:29 +03:00
Dan Stillman
722287b81a Switch back to @mozilla.org/browser/clh;1 and fix tests
In Firefox 102, `-file` was being swallowed by `nsBrowserContentHandler`
in BrowserContentHandler.jsm, so ab7d916e0 overrode that by using the
same contract id for our main nsICommandLineHandler in
zotero-service.js. But `nsBrowserContentHandler` also handles `-chrome`,
which we were using in tests to pass runtests.html. There's no need to
pass in dynamically though -- we can just hard-code that and open the
window ourselves.
2023-05-24 08:21:16 -04:00
Abe Jellinek
caa1036da2 Remote translation: Don't use wantGlobalProperties
Not necessary - just use the properties we inherit from contentWindow. This
fixes the DOMParser constructor, which fails if called without a window context
from a non-system principal.

https://forums.zotero.org/discussion/105163/zotero-7-doi-translator-broken-in-scaffold
2023-05-23 22:30:24 +03:00
Dan Stillman
55fe6f33f5 fx-compat: Fix XMLSerializer calls
https://forums.zotero.org/discussion/105118/zotero-7-error-upon-exporting-in-mods-format
2023-05-22 01:34:41 -04:00
Abe Jellinek
fa31956d28
fx-compat: Fix feed button appearance/overflow behavior (#3114) 2023-05-09 16:38:33 -04:00
Dan Stillman
f21ca49d83 Fix sync engine tests after 00703c0b8 2023-05-05 06:38:00 -04:00
Dan Stillman
e6776fd922 Skip 32-bit Linux build in CI or tests 2023-04-30 06:10:14 -04:00
Dan Stillman
296c0142f2 fx-compat: OS.File.read()IOUtils.read() in getContentsAsync()
https://firefox-source-docs.mozilla.org/dom/ioutils_migration.html

This also fixes a bug when `getContentsAsync()` is passed an
`nsIInputStream` or `nsIChannel` where raw bytes were returned instead
of a string. Not sure if we're doing that anywhere. If we are, this
would presumably break that code, but the function is supposed to return
a decoded string.
2023-04-30 05:23:41 -04:00
Dan Stillman
0858960d33 Better logging for request count mismatches in Find Available PDF tests 2023-04-29 17:50:49 -04:00
Dan Stillman
c326a6c971 Fix more files for combined repos 2023-04-29 07:50:54 -04:00
Dan Stillman
79ef3e3571 Fix path to staging Zotero in test runner on Linux 2023-04-29 07:22:02 -04:00
Dan Stillman
78cc8cc8c9 Don't open Error Console when running tests in CI 2023-04-29 07:14:51 -04:00
Dan Stillman
9a5275b92a Stop bundling the PDF tools 2023-04-29 07:14:51 -04:00
Dan Stillman
a497f501e9 Update pdf-worker and update full-text test
Strip '\f' at end of extracted text and ignore '\n' in the middle of
text from the test PDF
2023-04-29 04:56:28 -04:00
Dan Stillman
26dade03f2 Z7: Fix ZoteroPane tests 2023-04-29 04:27:48 -04:00
Dan Stillman
8fc94a5560 Z7: Fix loadPrefPane() test support function 2023-04-29 04:21:09 -04:00
Dan Stillman
7e6af7f541 Remove executable version output in test runner
Now that we're using our own build, we output it in other places
2023-04-29 04:20:33 -04:00
Dan Stillman
95455dbd83 Fix tagsbox tests after shadow root removal 2023-04-29 03:15:15 -04:00
Dan Stillman
4a77bc4be0 fx-compat: Update conflict resolution merge window (#3090)
Tests passing, but not yet styled properly
2023-04-29 03:13:53 -04:00
Dan Stillman
dbefdaac2c Update snapshot tests for new SingleFile markup 2023-04-28 02:18:52 -04:00
Dan Stillman
46d0ce3cbf Don't load example.com in /saveSnapshot tests 2023-04-28 02:18:19 -04:00
Dan Stillman
fa143f1ea4 Z7: Update retractions tests 2023-04-28 01:54:00 -04:00
Dan Stillman
5f631ff0af Add delay() test support function
`Zotero.Promise.delay()` wrapper
2023-04-28 01:54:00 -04:00
Dan Stillman
ed224dce34 Z7: Update relatedbox tests 2023-04-28 01:54:00 -04:00
Dan Stillman
82b4943d13 Z7: Update note editor tests 2023-04-28 01:54:00 -04:00
Dan Stillman
2c995c913e Z7: Update items test for andJoiner delimiters 2023-04-28 01:54:00 -04:00
Dan Stillman
b6522ae3f5 Z7: Update item pane teets 2023-04-28 01:54:00 -04:00
Dan Stillman
43ba4c3620 Don't check for .zotero-ft-info in test
No longer created
2023-04-27 03:48:49 -04:00
Dan Stillman
f95a6d0f0a Rename Zotero.Fulltext tests to Zotero.FullText 2023-04-27 03:48:01 -04:00
Dan Stillman
3ba78e28bb Update connectorTypeSchemaData and test data for Dataset Number removal 2023-04-27 03:44:25 -04:00
Dan Stillman
2e081ce8d2 Fix RemoteTranslate test after b222bbcccb
And remove duplicate test
2023-04-27 01:05:02 -04:00
Dan Stillman
57a60c1946 Update runtests.sh for combined repos 2023-04-27 01:05:02 -04:00
Dan Stillman
947fa2b558 Ignore numeric values for Type: lines in Extra
https://forums.zotero.org/discussion/comment/433334/#Comment_433334
2023-04-26 04:55:43 -04:00
Dan Stillman
4a30dd2e4f Fix potential sync error after Replace Online Library in group
https://forums.zotero.org/discussion/104431/syncing-problem

Replace Online Library can upload annotations created by others in a
group library, so if the upload resulted in a local write, "Cannot edit
item in library" was thrown, since annotations by others aren't
writable. This should've only been a problem if the uploaded data was
actually modified by the server, but we were also checking whether
objects were editable before checking if they had actually changed, so
it would happen for any upload of another person's annotation.

This fixes the order of checks when saving objects and makes an
edit-check exception for saving uploaded data for group annotations.
2023-04-21 06:51:25 -04:00
Dan Stillman
f57c462b85 fx-compat: Don't use number as OS.Path.join() argument
It's dropped silently from the path in Fx102.
2023-04-19 17:41:11 -04:00
Dan Stillman
8e46e2a4c1 Remove obsolete install.rdf from zotero-unit 2023-04-19 17:27:06 -04:00
Abe Jellinek
a47a17852e Fix feed item drag test's after() callback 2023-04-17 16:28:10 -04:00
Adomas Venčkauskas
096a3c5f2f Add a test for feed update scroll issues. See fd744fb52 2023-04-17 12:30:31 +03:00
Dan Stillman
2397940292 Use httpd.js instead of resource:// URL for feed item drag test
Since HiddenBrowser doesn't work on resource:// URLs (at least without
modifications, and it wouldn't be representative)
2023-04-15 05:07:47 -04:00
Dan Stillman
40fd9e8759 Fix test for opening the Cite prefpane when clicking Manage Styles… 2023-04-15 03:35:17 -04:00
Dan Stillman
085a271b6c Update test prefs
Remove Firefox prefs and skip word processor integration installation,
which no longer depends on extensions being bundled.
2023-04-15 01:21:45 -04:00
Dan Stillman
2796e6c80a Fix attachment tests that depend on HTML indexing
HTML files are now indexed instead of read directly, and indexing was
previous skipped in tests and otherwise performed on a delay, so set a
flag in the affected tests that triggers inline indexing.
2023-04-15 00:24:35 -04:00
Dan Stillman
b99e581929 Fix advanced-search tests 2023-04-15 00:24:02 -04:00
Dan Stillman
033733122a
Merge pull request #2784 from AbeJellinek/fx-compat-loadDocument
fx-compat: Implement Scaffold functions, SingleFile, PDF redirects, and style installation
2023-04-14 15:07:26 -04:00
Abe Jellinek
0612a9e6f5 fx-compat: Run translation and SingleFile in [hidden] browser
And replace loadDocuments().
2023-04-14 11:44:44 -04:00
Abe Jellinek
4b99b2715d fx-compat: HiddenBrowser: Add more options
- Make docShell properties configurable
- Allow requiring a successful HTTP status code
2023-04-14 11:43:48 -04:00
Dan Stillman
33ef7b1641 Prevent setting search .name to empty value
Prevents bug in zotero-citation plugin (at least on macOS) from creating
a search that breaks syncing

We were already checking for a missing name in `saveTx()`, but the
plugin is saving the same search twice in rapid succession, the second
time without a name, and the second attempt clears the search object's
name value after the first save's `_initSave()` check and before its SQL
write. The second save fails, but the first save goes through without a
name, resulting in a sync error.

https://forums.zotero.org/discussion/104274/id-1702002152-cannot-sync
https://github.com/MuiseDestiny/zotero-citation/issues/31
2023-04-12 22:23:13 -04:00
Dan Stillman
cadfca7475 Set a default annotation color if not assigned
https://forums.zotero.org/discussion/104249/sync-issue-on-ipados
2023-04-12 22:23:13 -04:00
Tom Najdek
a6042d3958
Mendeley importer: Fix issue with empty tags (#3018)
Also adds a test for this particular case and for importing tags in
general.
2023-04-06 17:10:13 +02:00
Tom Najdek
96022847d7
Mendeley importer: Fix issue with empty creators (#3016)
It does not appear to be possible to create a creator with no values in
Mendeley, however we got reports of these causing the imports to fail.
This tweak makes the importer more resilient by discarding empty/invalid
creators.
2023-04-06 17:10:13 +02:00
Tom Najdek
197d8d1f3b
Add option to Mendeley importer to relink items
New option only appears if importer version is < 1 or not present.
It will:
    * Skip fetching collections and attachments
    * Skip any new items
    * Update relations on existing items
2023-04-06 17:10:12 +02:00
Tom Najdek
4b523555d6
Mendeley Import: Auth using direct login
* Importer will now ask user for a login and password via form and will
  perform sign-in directly using credentials rather than oauth
* Signing in this way enables importer to obtain desktop document ID
  which is now stored for each item
* It's possible to switch back to the old method (ouath) by setting
  `import.mendeleyUseOAuth` pref to `true`.
* New option to only import new items. This options only appears if
  database contains previously imported items.
* Importer will now update mendeleyDB:documentUUID on existing items to
  match value used in Mendeley Desktop if available
* Importer will no longer create collections when no new items are
  imported * Importer will only report number of new items imported on
  re-import * Importer will now preserve dateAdded on re-import

Co-authored-by: Dan Stillman <dstillman@zotero.org>
2023-04-06 17:10:12 +02:00
Abe Jellinek
f694f87d49 fx-compat: Update item pane tests 2023-04-04 14:52:10 -04:00
Dan Stillman
ab2e163234 Update test sample data for authority/legislativeBody base mapping 2023-04-03 00:41:35 -04:00
Dan Stillman
68a6441b16 Continue generating citeProcJSExport test data
Since it's needed by zotero/utilities
2023-04-02 19:05:53 -04:00
Dan Stillman
430118f071 Write out path when generating item type/field data for tests
It writes to the build folder, so it's easy to think it's not working.
2023-04-01 16:34:43 -04:00
Dan Stillman
e27c1b5335 Add Dataset and Standard item types
zotero/zotero-bits#22
zotero/zotero-bits#52
2023-04-01 16:34:43 -04:00
Dan Stillman
1aa82094f1 Better way of skipping migration of Place and Date from Extra
Or at least a way that we already have built-in and that only applies to
the call in `Zotero.Item::migrateExtraFields()`. This doesn't
distinguish between CSL fields (`publisher-place`, `event-place`,
`issued`) and actual Zotero field, and we really only need to skip
the former, but it's fine.

Follow-up to e3cfeee81, related to #3030
2023-04-01 04:52:30 -04:00
Dan Stillman
e3cfeee813 Temporarily disable extracting Issued from Extra
Until we can parse ranges in the Date field. See #3030.

citeproc-js will still use it (which is the point).
2023-04-01 04:52:14 -04:00
Tom Najdek
01611cbb07
Temporarily disable folder import #2862 2023-03-23 14:16:51 +01:00
Tom Najdek
5ea43bd65c
fx-compat: Convert import wizard to use CE 2023-03-21 20:42:43 +01:00
Tom Najdek
2820add3d1
Add bulk folder import #2252 2023-03-21 20:38:39 +01:00
Tom Najdek
13cc393840
fx-compat: long tag fixer (#2649)
* Manual tag splitting from tag selector
* Only apply split to the tag in current library
* Preserve tag type
2023-03-16 21:20:11 -04:00
Abe Jellinek
fd85411e26
Preserve capitalization in Zotero.HTTP.request() headers (#3002) 2023-02-24 02:15:07 -05:00
Adomas Ven
ba06db2e19 Remove firefox-zotero IPC pipe and switching code (#2990) 2023-02-24 02:11:17 -05:00
Adomas Ven
cfbfcf20bf Refactor l10n code. Remove use of react-intl. (#2975)
Strings from .dtd files are now accessible from Zotero.getMessage
as the eventual move to Fluent would remove their distinction.
2023-02-10 10:26:49 +02:00
Dan Stillman
3813456e2b Fix some lint errors in Zotero.Retractions 2023-02-10 01:55:18 -05:00
Dan Stillman
bac87cbc42 Detect retractions for DOIs with capital letters
https://forums.zotero.org/discussion/102745/retraction-watch-not-working
2023-02-10 01:55:12 -05:00
Dan Stillman
6a1f0251cd Fix incorrect retries if multiple HTTP.request() calls get 500s
https://forums.zotero.org/discussion/comment/425814/#Comment_425814

The passed intervals array was modified, so after a request() got a 500,
subsequent calls would start with longer delays and eventually start
retrying immediately.
2023-01-11 02:20:07 -05:00
Abe Jellinek
fc8a037d12 Zotero.HTTP.request(): Process headers case insensitively
Using the Headers class from the Fetch API.

Before, the added test would fail: `_requestInternal()`, not finding a header
named `Content-Type` (case sensitive), would set it to
`application/x-www-form-urlencoded`. XMLHttpRequest, upon being given both
`content-type`: `application/json`) and `Content-Type`:
`application/x-www-form-urlencoded`, would helpfully merge the two, producing
`content-type`: `application/json, application/x-www-form-urlencoded`. That's
obviously not the correct behavior.
2022-12-23 21:37:15 -05:00
Abe Jellinek
e46ffaf84b Add /connector/request endpoint 2022-12-23 21:37:15 -05:00
Adomas Venčkauskas
e59bcd2b64 Link Mendeley citations in documents to imported items. Closes #2622 2022-11-29 16:27:19 +02:00
Dan Stillman
76f2f0c783 Don't show items with annotated attachments after moving to trash
https://forums.zotero.org/discussion/100775/deleted-items-keep-reappearing-in-my-library

Regression from c3ee588bf
2022-11-28 04:34:49 -05:00
Adomas Venčkauskas
f98ab3b0a6 Import URL from XPCOM code instead of relying on window for Proxy code
Also fix other failing proxy tests. Closes #2928
2022-11-22 15:58:49 +02:00
Adomas Venčkauskas
7e4e66b54d Fix proxy test 2022-11-22 15:51:54 +02:00
Dan Stillman
7ffc509ee6 Fix response content type in Find Available PDF test 2022-11-21 01:14:07 -05:00
Dan Stillman
c6df0b586c Use clearer name for Find Available PDF tests 2022-11-21 01:14:07 -05:00
Dan Stillman
b5862ba780 Handle relative PDF links when using custom PDF resolver 2022-11-21 01:14:07 -05:00
Abe Jellinek
74492e40c4
Improve bidi & RTL support (#2415)
- Render cell text in its native direction
- Fix context menu positioning
- Fix item box (localizations needed)
- Fix column resizing
- Fix bidi text in collection tree
- Always right-align in RTL, always left-align in LTR.
  I'm going off advice from this excellent guide for RTL website design
  by Ahmad Shadeed: https://rtlstyling.com/posts/rtl-styling#tables
- Join creators in the tree ("Smith and Jones") using a format string to
  support languages like Arabic and Hebrew where there shouldn't be a
  space after the "and".
- Fix tabs
- Fix toolbar on Mac, flip icons on other platforms
2022-11-20 18:23:17 -05:00
Abe Jellinek
b6591dba5a
Make Feeds row into a selectable global view of feed items (#2800) 2022-11-14 16:55:28 -05:00
Adomas Venčkauskas
56229136be Adjust tests to not use the dotsToHyphens proxy option 2022-11-10 12:46:14 +02:00
Dan Stillman
8e59e49d29 Avoid infinite/excessive loops in Find Available PDF
https://forums.zotero.org/discussion/100634/potential-infinite-loop-when-trying-to-find-available-pdf

Closes #2883
2022-10-30 04:44:31 -04:00
Dan Stillman
9869eb4bc8 Restore cell.csl for style tests
Removed in a28908f0b4
2022-10-27 05:07:46 -04:00
Dan Stillman
3a77eb85ed Don't match all attachments with annotations for "not" search conditions
Fixes #2867
2022-10-27 03:46:18 -04:00
Adomas Venčkauskas
0d1b194b6b Add an integration test for citation merging 2022-10-25 14:50:22 +03:00
Adomas Venčkauskas
19558a425b Fix wrong given name disambiguation after editing author for citeproc-js
Closes #2870
2022-10-25 14:50:05 +03:00
Adomas Venčkauskas
a28908f0b4 Change integration test citation style to APA and some refactoring 2022-10-25 14:50:05 +03:00
Adomas Venčkauskas
87a567122e Fx102: Fix Integration tests 2022-10-25 13:48:39 +03:00
Abe Jellinek
c1bb910d1c
Clear sync error and start sync after logging in in prefs (#2802)
Also fixes an existing error due to an argumentless call to
Zotero.Sync.Runner.updateIcons() in ZoteroPane.
2022-10-16 15:47:54 -04:00
Martynas Bagdonas
81c6c8deff Add annotation update test to pdf-reader tests 2022-10-13 02:20:42 -04:00
Abe Jellinek
5f9e8f5b7e Automatically relink attachments from LABD (#2374)
Fixes #2092
2022-10-10 10:38:43 -04:00
Martynas Bagdonas
ecd0e50ac4 Tweak pdf-reader annotation creation test 2022-10-10 17:06:00 +03:00
Martynas Bagdonas
3a26f6eb6f Add pdf-reader annotation creation test
(cherry picked from commit af436d34a8)
2022-10-10 16:56:17 +03:00
Tom Najdek
223f44fdfd Map annotation colors colors on import #2819 (#2822) 2022-09-12 19:58:21 -04:00
Dan Stillman
a63c634e3f Add "Create Note from Annotations" option to items list context menu
To allow creation of a standalone note with annotations from all the
selected top-level items and/or attachments. Annotations will be sorted
by the order of the items in the items list.

"Add Note from Annotations" remains when a single regular item or one or
more attachments under a single regular item are selected.
2022-09-12 15:54:03 -04:00
Dan Stillman
e81b43be98 Add collectionID option to EditorInstance.createNoteFromAnnotations()
For adding a standalone note to the current collection
2022-09-12 15:54:03 -04:00
Dan Stillman
39e45221b1 Rename Zotero.Items::keepParents() to keepTopLevel()
So that it works for more than two levels of items

Also fix a bug where the parent item could be returned more than once if
multiple child items were selected.
2022-09-12 15:54:03 -04:00
Dan Stillman
497d6376c8 Add Zotero.Item::topLevelItem and Zotero.Items.getTopLevel(items) 2022-09-12 15:54:03 -04:00
Martynas Bagdonas
f70ec29881 EditorInstance.createNoteFromAnnotations(): Handle multiple attachments 2022-09-12 15:54:03 -04:00
Abe Jellinek
5d6ad703c1 Preferences: Fix tests, improve clarity, and more
- Fix sync and advanced preferences tests; use a new waitForFirstPaneLoad()
  functions instead of the old paneload event listener
- Remove empty preferences_searchTest.js
- Rename some Zotero_Preferences members/functions for better clarity and
  public/private differentiation
- Reorder, also for clarity
- Fix tabIndex parameter causing an error if invalid
- Remove window.sizeToContent() call in Sync.displayFields()
    - So *that's* why the window resized every time the sync pane was loaded...
- Deprecate openURL() and simplify openInViewer()
2022-09-02 11:01:37 -04:00
Dan Stillman
00b24f85c9 Fix HTTP.request() 5xx handling with errorDelayMax=0
This was causing delay-less infinite loops for OPTIONS requests to Box,
which are returning 502 errors.
2022-08-29 23:46:58 +02:00
Abe Jellinek
63864f2f86
duplicateAndConvertSelectedItem: Don't copy abstracts (#2799) 2022-08-29 16:15:31 -04:00
Dan Stillman
170f1962ad Don't repeatedly upload relations
Fixes #2772
2022-08-22 01:15:21 -04:00
Dan Stillman
5103d904f3 Include proper test for b373291c02 for #2771 2022-08-19 12:05:30 -04:00
Dan Stillman
e9e1add9b8 Fixed filed items with annotations appearing in Unfiled Items
Fixes #2771

Regression from 20c6fe67
2022-08-19 12:05:30 -04:00
Abe Jellinek
22b00c33de Empty Trash: Visually remove deleted items, refresh icon (#2606)
There were a few problems causing the incorrect behavior:
1. Rows were being removed only if they had no non-deleted children, which
   wasn't the right check. We want to remove all rows with no *deleted*
   children.
2. Children of the removed rows weren't being removed with them.
3. We weren't invalidating the tree (which _removeRows() doesn't do).

Also:

* Erase trashed annotation after getAnnotations() test

Because ItemTree#notify() doesn't yet correctly handle refresh events on
parent items that are themselves children (three-level nesting: item ->
attachment -> annotation), this test was causing a failure in
itemTreeTest.js.
2022-08-19 09:14:24 -04:00
Dan Stillman
d3d6a6be48 Fix and disable item-tree test for emptying trash
20c6fe6737 caused this to start failing, but only because the test was
testing something too specific. The change in that commit caused more
rows to be left behind when emptying the trash (for reasons I should
probably look into), but the trash wasn't being emptied properly before,
which #2606 should fix. This test should be restored as part of that PR.
2022-08-17 03:35:54 -04:00
Dan Stillman
c3ee588bfe Match parent attachments for annotation tags
Expose annotation tags in tag selector and match parent attachments when
filtering/searching

This also fixes searching for annotation text or comments when using
Everything quick search.

This is temporary until we display annotations in the items list
directly.
2022-08-17 03:35:28 -04:00
Dan Stillman
6cd1a41a32 Fix importing of standalone attachments without URLs
And allow `importSnapshotFromFile()` without `parentItemID` or
`libraryID`, which is more consistent with other attachment functions

Follow-up to 318e4852e9

https://forums.zotero.org/discussion/comment/414802/#Comment_414802
2022-08-16 06:09:00 -04:00
Dan Stillman
676abca671 Fix importing of standalone attachments
Maybe has been broken for years?

https://forums.zotero.org/discussion/99020/warning-data-loss-when-exporting-collections
2022-08-13 16:24:14 -04:00
Dan Stillman
d546caca4c Don't relate book sections to each other when creating from book
Fixes #2757
2022-08-13 05:46:04 -04:00
Dan Stillman
344a10421a Fix copying of standalone attachments between libraries
Regression in f684984b07 (maybe a race condition)
2022-08-13 02:04:07 -04:00
Dan Stillman
c90f8415b3 Improve test for event-title substitution
And add comments

Follow-up to 20d0f103f
2022-08-11 03:57:25 -04:00
Dan Stillman
ebacb83563 Reset Zotero.locale to 'en-US' after cite test 2022-08-11 03:57:20 -04:00
Dan Stillman
7eab91a160 Automatically substitute event-title for event in styles
Stopgap until styles are updated in citation-style-language/styles#6151
2022-08-11 03:57:15 -04:00
Abe Jellinek
df5bde79e5 Add test for 87455d 2022-08-11 03:57:09 -04:00
Abe Jellinek
1f9e518581 Duplicates Merge: Preserve embedded annotations (#2728) 2022-08-11 03:52:40 -04:00
Martynas Bagdonas
d595b3f195 Freeze note schema version to 8
We can do it because it was only used to create a note from annotations.

No need to update schema version in Zotero client, unless using new
features when creating a note from annotations.
2022-08-11 03:50:06 -04:00
Dan Stillman
1e5fd2d551 Disable sort tests from 26a5e2900a for now
Until I can figure out the race-condition breakage they trigger later in
the file
2022-08-11 03:46:56 -04:00
Dan Stillman
612fec8961 Fix test failure after 26a5e2900a 2022-08-11 02:48:39 -04:00
Dan Stillman
d3942ad1f0 Better fix for errors from invalid sort fields
Just catch the error from `ItemTree::sort()` and clear the
secondary-sort and fallback-sort prefs so that sorting works on the next
attempt.

Replacement for a8ed30ce80

https://groups.google.com/g/zotero-dev/c/kc0-C6-SA74/m/bhHniGceAQAJ
2022-08-11 02:48:35 -04:00
Dan Stillman
d747da7c65 Revert "Validate fields in ItemTree::getSortFields()"
This reverts commit a8ed30ce80 and related
commits.

We'll address breakage from invalid sort fields another way, without
inconveniencing plugin authors.

https://groups.google.com/g/zotero-dev/c/kc0-C6-SA74/m/bhHniGceAQAJ
2022-08-11 02:48:31 -04:00
Dan Stillman
3ab661b628 Fix sorting by Item Type and feed item itemID
Regression from a8ed30ce80
2022-08-11 02:48:16 -04:00
Dan Stillman
2c11aadc57 Add localized string for timestamp CSL locator
Not included in the CSL locales:

https://forums.zotero.org/discussion/comment/412060/#Comment_412060
2022-08-11 02:47:46 -04:00
Abe Jellinek
b18967fba4 recursiveCollections: Remove from all subcollections on delete (#2689) 2022-08-11 02:47:28 -04:00
Dan Stillman
387e4dd958 Add CSL 1.0.2 locators and switch to CSL locales for localization
And move Page to middle of list, while still selecting by default

https://forums.zotero.org/discussion/comment/396602/#Comment_396602
2022-08-11 02:47:15 -04:00
Dan Stillman
fea99bf8f8 Fix test failure after a8ed30ce8
We added a `toggleSort()` call on the title, so then when called again
it reverses the direction. To avoid, sort by creator and then title in
the second test.
2022-08-11 02:47:09 -04:00
Dan Stillman
92a1a43cbb Validate fields in ItemTree::getSortFields()
To avoid startup hang if a plugin does something bad:

https://forums.zotero.org/discussion/comment/411843/#Comment_411843

Fixes #2692
2022-08-11 02:47:04 -04:00
Tom Najdek
141258d564 Fix a bug in regex extracting fields to "extra"
Because regex is built using a template string, \s* is actually escaped
into s*, i.e. literal "s" appearing 0 or more times. In most cases this
would mean that output can have spacing slightly off. In extreme case,
when identifier starts with letter "s", this could this could lead to
identifier being stored incorrectly.

Also adjusted tests to be more strict and mock data to cover this case.
2022-08-11 02:46:37 -04:00
Dan Stillman
5920c5d3e5 Update utilities submodule and date-parsing tests
Includes strToDate() fixes
2022-08-11 02:36:04 -04:00
Dan Stillman
3fb9e2162e Use String.fromCharCode() to load Chinese characters in strToDate() test
Follow-up to dc045250a6
2022-08-11 02:34:06 -04:00
Dan Stillman
56151a4198 Fix parsing of Chinese and other non-ASCII month names
https://forums.zotero.org/discussion/97683/bug-locale-issues-concerning-zotero-and-zotero-connector
2022-08-11 02:33:58 -04:00
Dan Stillman
011b60af61 Fix Emoji detection
And move to Zotero.Utilities.Internal.isOnlyEmoji()

Fixes #2643
2022-08-11 02:33:41 -04:00
Abe Jellinek
3481def4f6 Fix sorting by attachment (#2586) 2022-08-11 02:33:03 -04:00
Dan Stillman
65318a442e Fix support tests after 28ed3e34b 2022-08-11 02:29:44 -04:00
Dan Stillman
cb2594f53f Feed import: Don't fail on OPML entry with no title or text
https://forums.zotero.org/discussion/96841/impossible-dimporter-ompl-rss
2022-08-11 02:28:03 -04:00
Abe Jellinek
8d75f37548
fx-compat: Add preferences with full-text/keyword search (#2659) 2022-08-10 18:26:23 -04:00
Adomas Venčkauskas
41907975b0 Adjust integration function comments and test dummy signature 2022-07-26 10:53:05 +03:00
Abe Jellinek
8face792c0
fx-compat: Fix search dialogs (#2631) 2022-07-04 01:48:52 -04:00
Dan Stillman
f827b9ef50 fx-compat: initKeyEvent()new KeyboardEvent()
Quick Format change is untested
2022-06-21 03:31:58 -04:00
Dan Stillman
587ae6ba7e fx-compat: Fix blurring of textarea fields in item box
And fix tests
2022-06-21 03:03:37 -04:00
Dan Stillman
563f91bf18 Rename zoteroIntlTest.js to intlTest.js 2022-06-21 01:39:31 -04:00
Dan Stillman
bbdcb92042 Add missing test data files 2022-06-21 01:39:07 -04:00
Dan Stillman
789a8a5fe9 fx-compat: Use new mozILocaleService API
Replace functions with arrays, as in https://phabricator.services.mozilla.com/D6339
2022-06-20 23:09:46 -04:00
Dan Stillman
6e43d2cd4e fx-compat: Fix tags-box tests 2022-06-20 23:02:09 -04:00
Dan Stillman
3a5c24b6f1 fx-compat: Fix some tag selector tests 2022-06-20 19:32:03 -04:00
Dan Stillman
54529ab461 fx-compat: Pass dialog as second argument to waitForDialog() in tests
Makes it easier to run dialog.getButton(), etc.
2022-06-20 19:30:28 -04:00
Dan Stillman
842e100b73 Additional assertion for sync test from d0c1a1f600 2022-06-20 18:43:02 -04:00
Dan Stillman
d0c1a1f600 fx-compat: Fix sync test involving waitForDialog()
`waitForDialog()` now returns a regular window, and
`window.document.documentElement.textContent` includes all form
elements, so this updates a test to include the checkbox label.
2022-06-20 17:47:15 -04:00
Dan Stillman
5bc1b6ad81 Update tests for itemBox/noteEditor custom elements 2022-06-20 00:47:50 -04:00
Dan Stillman
df3e7a600e Update Zotero.File.getContentsAsync() tests 2022-06-19 18:59:01 -04:00
Dan Stillman
dfff86df72 fx-compat: Fix Zotero.File.download() 2022-06-19 18:58:25 -04:00
Dan Stillman
f8aa14d431 fx-compat: Fix feed test using Array.map() 2022-06-19 15:09:23 -04:00
Dan Stillman
fa2ad2f234 loadBrowserWindow() → loadZoteroWindow() in feed test 2022-06-19 15:07:41 -04:00
Dan Stillman
408453c9e9 fx-compat: Fix dictionaries tests 2022-06-19 04:16:53 -04:00
Dan Stillman
4a3ff46bd7 fx-compat: Fix waitForWindow()/waitForDialog() in tests 2022-06-19 04:16:53 -04:00
Dan Stillman
2b41b0127c Get binary contents in Zotero.File.getSample()
And fix magic numbers for content-type sniffing, which wrongly used the
Unicode replacement character (which likely just meant we were falling
back to file-extension-based detection)
2022-06-17 20:29:01 -04:00
Dan Stillman
13adfd131c fx-compat: Update full-text indexing
Use the new PageData mechanism for character set detection, don't try to
index HTML files directly without properly detecting the charset, and
generally simplify the indexing code.

HTML files are now considered cached files that require indexing and
won't be indexed automatically in Zotero.FullText.findTextInItems(),
which breaks certain expectations, including in some tests. This will
need to be addressed.
2022-06-17 20:29:01 -04:00
Dan Stillman
6a2949be8a fx-compat: Add HiddenBrowser.jsm
Remove Zotero.Browser and add HiddenBrowser.jsm. Post-Fission, web/file
content loads in a separate process, so it's not possible (as best as I
can tell) to directly access the contents of a hidden browser -- it just
appears as about:blank in the parent process. We now use Mozilla's
JSWindowActor mechanism [1] to get page data, including character set
and body text for full-text indexing. We'll have to evaluate other uses
of hidden browsers to see how to handle them.

This also adds include.jsm for loading the Zotero object into a JSM.

[1] https://firefox-source-docs.mozilla.org/dom/ipc/jsactors.html
2022-06-17 20:28:58 -04:00
Dan Stillman
0dd088e98d Add loadZoteroWindow() support function for tests
`loadBrowserWindow()` will need to be updated for loading remote URLs,
but anything needing a Zotero window (including `loadZoteroPane()`) can
use this.
2022-06-17 20:24:43 -04:00
Dan Stillman
730e86d661 fx-compat: Restore tests and test using actual Zotero executable
The test runner now uses the Zotero executable from
`zotero-standalone-build/staging` rather than the Firefox from
`zotero-standalone-build/xulrunner`. Along with testing the actual
program, this restores visible UI updates during tests, which should
make debugging various things easier. We can also now remove anything
related to Zotero being an extension.

Many tests are still broken, but this at least lets us start running
them.
2022-06-17 20:24:43 -04:00
Dan Stillman
5d08359dc9 fx-compat: Update httpd.js from mozilla-central 1739f130 2022-06-17 20:24:43 -04:00
Abe Jellinek
29b270e761 fx-compat: Fix progress queue / Find Available PDFs 2022-05-24 13:52:52 -06:00
Abe Jellinek
a2215cb8f6 fx-compat: Fix hard confirmation dialog
ID changed to commonDialog so we get commonDialog.css styling for free.
2022-05-24 11:43:45 -06:00
Abe Jellinek
547311ff26 Fix Create Bibliography
listbox is gone, but richlistbox is still here as a custom element and
works fine for cases where we don't need virtualization.

groupbox label and richlistitem styles should probably be copied to
somewhere global once tuned a bit.
2022-05-18 19:32:39 -07:00
Dan Stillman
bc68b6e9fe fx-compat: Start to fix tag color chooser dialog
Among other things, need to recreate XBL <customcolorpicker> as a Custom
Element and need to change `ondialogaccept`/etc. to event listeners:

https://searchfox.org/mozilla-central/rev/b72e9d7d63bf499d1d8168291b93d4ec7fde236e/browser/components/places/content/bookmarkProperties.js#232-237
2022-05-13 04:28:57 -04:00
Dan Stillman
d838bc952a fx-compat: Change "pref(" prefix in prefs file to "user_pref(" for tests
We now copy the prefs file into the app omni.ja, which requires
`pref()`, but for tests we copy it to the profile directory, where it
needs to stay as `user_pref()`.
2022-05-13 04:28:56 -04:00
Dan Stillman
94c7e0674d fx-compat: Remove 'context' from onStartRequest()/onStopRequest()/etc. 2022-05-12 05:18:47 -04:00
Dan Stillman
dd2ff63019 fx-compat: Replace nsIDOMParser with new DOMParser() 2022-05-12 02:38:59 -04:00
Dan Stillman
03242e8984 fx-compat: DB.executeTransaction() no longer takes generator functions 2022-05-12 02:38:59 -04:00
Dan Stillman
ccbc785499 fx-compat: XPCOMUtils.generateQI() → ChromeUtils.generateQI() 2022-05-12 02:38:59 -04:00
Abe Jellinek
9829ea7009
Update utilities, move tests, add to CI (#2584) 2022-04-30 04:55:11 -04:00
Abe Jellinek
3bfc6740c4
Add tests for improved compareCallNumbers (#2579) 2022-04-28 04:43:30 -04:00
Abe Jellinek
89aaa10504
Sort LC call numbers better, sort integers as integers (#2569)
* Update utilities submodule after https://github.com/zotero/utilities/pull/8
* Extract and add tests
2022-04-26 04:11:29 -04:00
Martynas Bagdonas
b8d427790c Fix error when using a note template and checking if array is not empty 2022-04-23 14:52:24 +07:00
Abe Jellinek
f91ca9c18a Don't merge with a deleted master attachment 2022-04-20 11:04:24 -07:00
Abe Jellinek
e8ad2fab95
getSortTitle: Only strip initial punctuation clusters (#2537)
Specifically exclude @, #, and *
2022-04-15 02:08:14 -04:00
Dan Stillman
08d3880d88 Don't remove relations in annotation item JSON
This was causing UUIDs for annotations from Mendeley imports to be
removed after a sync, resulting in annotations being duplicated on a
reimport.
2022-04-14 06:37:30 -04:00
Abe Jellinek
892c1169c8 Attachment merge: Compare link mode type
Actually fixes #2527.
2022-04-11 09:30:16 -07:00
Martynas Bagdonas
2af7275968 Fix template condition evaluating to true for empty string from function
Fixes #2529
2022-04-11 12:22:20 +07:00
Abe Jellinek
47a2f3cad9 Attachment merge: Compare linkModes, improve logging
Using keys instead of IDs should make logs more useful.
Fixes #2527.
2022-04-09 20:39:37 -07:00
Abe Jellinek
745069c070 Don't strip punctuation before numbers
Fixes #2496
2022-03-30 11:58:55 -07:00
Tom Najdek
56321a7a6d
Fix regression: download() fails for non-http URLs (#2497)
This fixes compatiblity with some addons that use Zotero.File.download
to extract files from their XPI bundle.
2022-03-30 12:15:40 -04:00
Tom Najdek
776769f480
Citavi import: Tweak how page label is determined (#2494)
Instead of attempting to extract `PageRange` value we now let pdf worker
always determine page label.

Also improved citavi tests and fixtures.
2022-03-30 09:34:07 -04:00
Dan Stillman
1d1adbca70 Fix error merging items with missing attachment files
Fixes #2453
2022-03-24 06:39:47 -04:00
Dan Stillman
174f1aadde Fix error adding group item before syncing in Zotero 6
Fixes #2440
2022-03-21 22:50:43 -04:00
Abe Jellinek
bca76319ce
getSortTitle: Strip less punctuation, trim (#2442)
Now it:

1. Strips punctuation at the beginning, no matter what it is.
2. Strips non-dash punctuation in other positions.
3. Trims the result.

This should better prevent numerical ranges from being joined into a
single number that ends up incorrectly being sorted to the very bottom.
2022-03-21 20:06:27 -04:00
Dan Stillman
3ec883a7f6 Get attachment text on-demand if not cached in Item::attachmentText
Follow-up to 58f515058 with a better approach: if no full-text cache
file, just get text directly without indexing. In the one existing use
of `attachmentText`, attachment merging, this is better anyway, because
we might be deleting the file, so there's no point wasting time
inserting words into the database.
2022-03-12 20:22:29 -05:00
Dan Stillman
46ff3cf4fb Add pending test for merging items with unindexed attachments by content
Follow-up to 58f51505
2022-03-12 19:11:39 -05:00
Martynas Bagdonas
78e1e8593a Fix note template condition evaluating to true on empty array
Fixes #2386
2022-03-11 17:04:47 +02:00
Abe Jellinek
ef82becf00
Merge attachments and update notes (#2336)
We follow a different merge procedure for each attachment type:

- For PDF attachments, compare by MD5. If no match, get the top 50 words
  in the attachment's text and hash those, then check again for a match.
  Update references to item keys in notes and annotations.
- For web (snapshot / link) attachments, compare by title and URL.
  Prefer a title + URL match but accept a title-only match.
- For other attachment types, keep all attachments from all items being
  merged.

Also:

- Move most merge tests from Duplicates to Items#merge(). It just doesn't
  make sense to worry about the UI in these.
2022-03-09 17:26:26 -05:00
Tom Najdek
8e8b03e5ff
Fix Citavi import test (#2394) 2022-03-09 14:04:23 -05:00
Tom Najdek
1ad2056674
Add support for importing Citavi annotatons (#2351) 2022-03-09 04:06:44 -05:00
Dan Stillman
c7ece79f79 Fix missing creators not being removed in item.fromJSON()
Apparently there's been a bug for years where removing a creator
remotely hasn't caused it to be removed locally via sync...

https://forums.zotero.org/discussion/94910/desktop-app-not-correctly-syncing
2022-03-09 02:43:22 -05:00
Dan Stillman
8b7afcf24c Fix utilities_item tests after adding Preprint in 053d6a011
Attachments and notes are now mapped to CSL `document` (though it
shouldn't be possible to export attachments or notes to CSL JSON anyway)
2022-03-05 07:41:42 -05:00
Dan Stillman
1ce47bc404 Add Preprint item type to additional sample data for tests 2022-03-05 07:23:50 -05:00
Dan Stillman
32fc1cad9c Add Preprint item type to sample data for tests 2022-03-05 06:03:44 -05:00