Commit graph

876 commits

Author SHA1 Message Date
Ed Sanders d06e9dbc31 Update VE core submodule to master (0e82a6db8)
New changes:
db0f21d03 ve.ce.Surface: Check dataTransfer.files is non-empty
e1cd78933 [BREAKING CHANGE] Move selection handling code to SelectionManager
b4b63a463 Move drag/drop handling code to DragDropHandler
540272769 Use the onPaste handler for dropped content
d3f9d8485 ClipboardHandler tests: Run tests in series
1232c0420 Tests: Introduce ve.dm.example.annotateText to simplify runs of annotated text
69d7ca482 Apply an annotation to imported (pasted/dropped) text
0e82a6db8 ve.ce.ClipboardHandler: Fix async test running

Added files:
- src/ce/annotations/ve.ce.ImportedDataAnnotation.js
- src/ce/ve.ce.DragDropHandler.js
- src/ce/ve.ce.SelectionManager.js
- src/dm/annotations/ve.dm.ImportedDataAnnotation.js
- tests/ce/ve.ce.DragDropHandler.test.js

Local changes:
- Implement new selection manager architecture

Added files:
- src/ce/annotations/ve.ce.ImportedDataAnnotation.js
- src/ce/ve.ce.DragDropHandler.js
- src/ce/ve.ce.SelectionManager.js
- src/dm/annotations/ve.dm.ImportedDataAnnotation.js
- tests/ce/ve.ce.DragDropHandler.test.js

Bug: T371996
Bug: T377427
Bug: T78696
Change-Id: If8d38246badf919c32915beda7c9a14f16e62a8a
2024-10-30 17:52:56 +00:00
Ed Sanders 4bc814f1a0 Update VE core submodule to master (bae9101b7)
New changes:
7906a6b9e build: Updating npm dependencies
92e6a5338 TextStyleAnnotation: Don't register abstract base class
456ca9b2e Localisation updates from https://translatewiki.net.
a68ba80d2 Get all annotations by ranges
dc49d9592 Demos: Default to WMUI theme
222ac7d23 Add unit tests for ve.dm.BranchNode#getAnnotationRanges
ba73b9e91 Return annotation ranges in lexicographic order
6e40aa524 Localisation updates from https://translatewiki.net.
1a4640a4a ve.ce.Surface: Remove unused $deactivatedSelection and $findResults
9455e0f0a ve.ce.Surface: Replace text/xcustom clipboard storage with a custom key
ddd14aa9b [BREAKING CHANGE] Move paste handling code to ve.ce.ClipboardHandler
19f0e500b CollabProcessDialog: Replace mw.user.getName with platform method
ecd607353 Implement pasteSourceDetectors
bae9101b7 Localisation updates from https://translatewiki.net.

Added files:
- src/ce/ve.ce.ClipboardHandler.js
- tests/ce/ve.ce.ClipboardHandler.test.js

Local changes:
* Implement new paste handler architecture
* Use new clipboard key

Bug: T360624
Bug: T376306
Bug: T78696
Change-Id: Iea10d32b6132ae364d486cc6b96895bb937ac944
2024-10-22 15:31:24 +01:00
Bartosz Dziewoński 365cefa878 tests: Use real mw.Api in ve.ui.MWTemplateTitleInputWidget tests
Otherwise the changes to mw.widgets.TitleWidget in
Iec338e9f595b452c19ce8e74eb81339fbce11640 cause the test to fail.
To avoid making real API requests, use fake server instead.

Change-Id: I7ff705af79760e33200a2dfbfdd05138c18bb110
2024-10-07 19:24:43 +00:00
Timo Tijhof 07a132d310 tests: Force templateDataInstalled condition for MWTemplateTitleInputWidget
Change-Id: I730a0e53547d4e7510fcec09905ea98030490c0d
2024-08-22 00:29:16 +01:00
jenkins-bot b54f4ebb28 Merge "Fix getTemplateDataQueryTitle() when the title ends with a newline" 2024-08-16 15:30:57 +00:00
Sébastien Beyou 6ea7ab19fd Fix getTemplateDataQueryTitle() when the title ends with a newline
According to ECMAScript, .trim() and RegExp’s "\s" capture the same
characters, so I replace the initial "\s*" by .trim() to remove
whitespaces and line terminators at the beginning and at the end.

Bug: T371000
Change-Id: Id9188f97a3136b986b052b71cd4079c1109ea8ff
2024-07-26 16:18:29 +02:00
Adam Wight 67417c28b8 Reenable Cite-related test
Bug: T370512
Depends-On: Id8684ccee2e6725af2c861da20fc31af1067e614
Change-Id: I8453ce99daae2dbec58088186961a30ae9d1c3e7
2024-07-24 11:44:35 +02:00
Adam Wight b4da46585c Temporarily disable Cite-related test
This can be reenabled once Cite changes are merged.

The disabled test is also updated in this patch so that it will pass
with the new Cite code.

Bug: T370512
Change-Id: I56b52c399d2c76689fdcb0bc7fd50a8c0ced28fd
2024-07-24 11:43:33 +02:00
Timo Tijhof ba6f60032b tests: Fix DesktopArticleTarget dirtying location.href
Without this, wheneve VE is installed, test execution ends with the
address bar rewritten to Special:Badtitle, which affects reloads etc
and makes debugging anything else harder.

Bug: T250045
Change-Id: Ic453ae388c842369ff1cb1e84dcad4a8bbc7d54f
2024-07-20 04:05:42 +00:00
jenkins-bot 4a4bda78ab Merge "Reenable test after Cite-related fix" 2024-07-15 12:07:23 +00:00
Ed Sanders bc9c900b6a Use transitionend events instead of hard coding animation time
transitionend is supported by all our target browsers.

Also use requestAnimationFrame without a fallback as
this is also supported by all browsers.

Change-Id: I563cacdc8b2365ad4b69dfccb7e46a9f176dbd9b
2024-07-03 00:43:19 +01:00
Adam Wight a0ece81a44 Reenable test after Cite-related fix
Bug: T247921
Change-Id: Ic5ddcb2b861186f3defd10447b4d1b525bda3fbf
Depends-On: Ieff73769f8ebbc3724f6a9b498487c4e7d09aa2e
2024-07-02 10:39:41 +00:00
Adam Wight 4715dd444d Temporarily skip a Cite-related test
Needs to be skipped in order to merge a change in Cite.

Bug: T247921
Change-Id: I32276021713876b3dac2210c26bbd27500009c14
2024-07-02 12:31:43 +02:00
Ed Sanders 8cb070f4d7 Remove VE user-agent based browser compatibility checks
Bug: T367735
Change-Id: I07fb1bbbd2f907672400cb9bc74fd40dea973da9
2024-06-17 13:03:04 +01:00
Ed Sanders 0a23f31227 SurfaceFragment tests: Put isolateAndUnwrap tests in a loop
Change-Id: I8791da02a91f5ddc801290121031dde290883d6c
2024-06-05 17:50:29 +00:00
Bartosz Dziewoński cc096f1bb8 Fix "implicit-arrow-linebreak" ESLint violation
Change-Id: I61bbfb0762438927c0f7bd5b8e8bf1365861d909
2024-06-04 18:58:25 +02:00
jenkins-bot 81a1c990e0 Merge "build: Updating eslint-config-wikimedia to 0.28.0" 2024-06-04 13:53:03 +00:00
libraryupgrader 702677220d build: Updating eslint-config-wikimedia to 0.28.0
The following rules are failing and were disabled:
* modules/ve-mw/tests:
  * implicit-arrow-linebreak

Change-Id: If857233c0de24c8cf619dbb1347ebb375f3ab1ba
2024-06-04 03:40:00 +00:00
Timo Tijhof ad6e0e332e MWTemplateTitleInputWidget: Fix unstable sort affecting Firefox
I'm going to assume the order in production with Chrome, as asserted
by the unit test, is the preferred order whereby negative numbers are
intended to be prepended before the positive numbers.

This came up in I6ecbd5743f3e, where this was the only unit test across
MediaWiki core and WMF gated extensions, that fails in Firefox.

It is reproducible locally with plain MW core + VisualEditor as well.

Bug: T366299
Change-Id: I6f8546e6e604cbb41e11bd2b59f8b5f19350c676
2024-05-31 17:12:29 +01:00
Ed Sanders b9b966de6e Avoid Array.concat
See I9addf43b2857de7bcac.

Change-Id: Ic1998ab6f7dedf6946d7ae63a985a76031f8eecf
2024-05-29 21:16:25 +01:00
Ed Sanders 155549ab60 Tests: Use spread syntax on string literals
Because `...'Foo'` is more legible than `'F', 'o', 'o'`.

Change-Id: I09ac584ee79b8f89c48f135182e60d7fb1b54557
2024-05-24 22:23:42 +01:00
Timo Tijhof 6cbedbf9d2 tests: Adopt QUnit.test.each() and native async-await in a few places
* Remove need for manual hacking of sub groups via "msg" strings
  carefully prepended to every assertion.

* Improve CI details, by reporting the specific case that failed,
  and local dev via ability to re-run each case, and reporting names
  directly in the HTML Reporter and CLI summary.

* Reduce need for assert.async() and tracking of callbacks, especially
  to improve failure details in case of Promise rejection.
  Current logic was likely to cause a confusing timeout instead of a
  clear failure if the promise ends up rejected.

  QUnit propagates these as part of awaiting and asserting the test
  closure's promise value (as async fn) automatically.

  This approach also avoids the pitfal of a falsely passing test
  when an assertion inside a done() handler was never reached.

* Use modern for-of where possible to remove need for closures and
  arrow functions. Thus reducing complexity of test code, where
  complexity should be kept lowest to avoid false confidence.

* Use plain for-in instead of overly complex Object.keys().forEach().

Change-Id: I934a266e75e64371081f104cfb867fb2c282c84a
2024-05-01 19:01:19 +01:00
jenkins-bot a85e1f44e4 Merge "Use forEach loops for cases" 2024-05-01 15:22:39 +00:00
Ed Sanders 4db99d7a27 Use more arrow functions
Change-Id: Ifdb15ea9e5ca606e02ddaf822bfd6397c3ce639e
2024-05-01 14:11:55 +01:00
Ed Sanders e3659d4846 Prefer arrow callbacks
Change-Id: Ia05b27f7c71c33580ffd0718e3bbc673dd8b3d63
2024-05-01 14:11:54 +01:00
Ed Sanders e382d3af0a Use forEach loops for cases
Change-Id: Ica8773f54572bd90d4ee1ecde43254331fd2e313
2024-05-01 14:02:29 +01:00
Ed Sanders 3ca82f8d57 Tests: Use CE HTML helpers
Depends-On: I2ac2ecd6937e936f877fc3fb17feaa4d3610ee50
Change-Id: If3790fc7449ea2f7bbf56783f590fcb8d9126cb8
2024-02-01 15:30:22 +00:00
Ed Sanders d42a0772bb Move verbose copyright message to AUTHORS.txt
Avoids having to update the date in every file every year,
which we stopped doing.

Change-Id: I7bf7aa0937eef911e00772470091753a7b06fd3d
2023-12-01 16:07:39 +00:00
Ed Sanders 3966573f02 build: Update ESLint to 0.26.0 and autofix
Change-Id: Ia5e15684c1c3dcd69985445a09fc4e4910368b5b
2023-11-28 11:18:09 +00:00
Nardog 9b9f2c50b0 Recognize DEFAULTSORT again
Since Parsoid now treats DEFAULTSORT like any other template, we have to
scan mw:Transclusion spans.

Bug: T337398
Change-Id: Icba92fc14c1c56ec4711ba49407e8be368d57842
2023-11-09 21:26:20 +00:00
jenkins-bot bfb4f04635 Merge "Make GalleryImageNode dm match (Inline|Block)ImageNode imgWrapper" 2023-11-02 21:40:44 +00:00
jenkins-bot 979cc39472 Merge "Set alt in data-mw for non-img media" 2023-11-02 21:39:02 +00:00
Arlo Breault 76960385db Make GalleryImageNode dm match (Inline|Block)ImageNode imgWrapper
The observation that the href for wrappers with mw-file-description
class will be the same as the resource still holds.  However, on the
other end, if the href is null, setting it to resource doesn't work.

Timed media and when the "|link=|" media option is used, result in an
imgWrapper that's just a span and wouldn't have an href.

This patch fixes a dirtying of timed media in galleries that was
preventing selser from being used.  Note, that <source>s in <audio> and
<video> tags are still dropped, so selser won't work yet.

Change-Id: Iefc520b8513e833665dae9d5c3a9dca2762264a6
2023-10-26 15:21:27 -04:00
Ed Sanders 1fcf167028 Template dialog: Use wrapping/expanding input for "line" inputs
Bug: T348482
Change-Id: I5cbbd84723c042dee176be8d77a7beec7d86e226
2023-10-26 09:16:24 -05:00
Arlo Breault 2497a5254e Set alt in data-mw for non-img media
Follow up to I02ea8421e468635ba6297bb5cda488a5a79c9a1d the depends on
I7a5c24f6ffc15ff0455adf5b025b695ee71501b6 in Parsoid.

Note that the mediaTag isn't currently being passed around for gallery
image nodes so, for example, a <video> becomes an <img> as is.  But,
that's independent of this patch, and a follow up will fix it.
Noted in T348703#9278332

Bug: T348703
Bug: T214603
Change-Id: I5f7d3dfe0a41fac1568c97dccc41209c14e741d0
2023-10-25 13:23:47 -04:00
Bartosz Dziewoński 0dddd98b5f Reload page or redirect when saving an edit creates a temp account
Depends-On: I6cdc014fb39d35ce1f091b53dc3a9c4a3c95f9e9
Bug: T338002
Change-Id: I01e13ce1ebab462eeb0ba3847d4205a88965a127
2023-07-10 19:33:16 +02:00
jenkins-bot b5e3d70f47 Merge "MWImage: Use mw-file-element class in converter methods" 2023-06-09 20:39:57 +00:00
Ed Sanders f1ddd483da Update CE nodes with mw-file-element/mw-file-description classes
Change-Id: I5846e370b2b1897c63fe9728d081b7a406c138ba
2023-06-09 16:52:08 +01:00
Ed Sanders 1c592ae93d MWImage: Use mw-file-element class in converter methods
Change-Id: I7415a61a9d19242a8aec87fb719e0f4990aeedfb
2023-06-01 15:53:46 +01:00
Ed Sanders d5b11247c3 Convert more test data to template literals
Change-Id: I6e5565714148a637ed83a8571b2034e4e7cbbe63
2023-06-01 15:53:46 +01:00
Ed Sanders b3673a1042 Converter tests: Use template literals to make HTML more legible
Depends-On: Iee8184dd6524b6dc12d19ac79761f6bd15990297
Change-Id: Idf0dde21e2ca0b01393ddda9e4d722fe50f0314f
2023-05-30 18:22:23 +01:00
Ed Sanders be5f04b779 MWImage: Update test data
Add mw-file-element and mw-file-description classes by default.

Change-Id: I8b3a9c39582e1400b628e102c254021772513939
2023-05-30 15:07:19 +01:00
Bartosz Dziewoński a88084509d Use edit intro messages and preloaded content from MediaWiki core
Use MediaWiki core helpers to provide intro messages (including edit
notices), initial page content, and CSS classes for the edit area.

The following intro messages were previously unimplemented,
and will be shown now:
* 'sharedupload-desc-create'
* 'sharedupload-desc-edit'

The following intro messages were previously unimplemented,
but they only apply to pages where VE should never be available,
and will be shown now when editing those pages with 2017WTE:
* 'code-editing-intro'
* 'talkpagetext'

The following intro messages were previously unimplemented,
and are now explicitly skipped:
* 'editpage-head-copy-warn'

The following intro messages were previously unimplemented,
but they only apply to pages where neither VE nor 2017WTE should
ever be available:
* 'userinvalidconfigtitle'
* 'usercssyoucanpreview'
* 'userjsonyoucanpreview'
* 'userjsyoucanpreview'

Depends-On: If0b05710cb52a977bf4e85947d72d68683a0a29e
Bug: T201613
Change-Id: If26e39e383b983f7ee834ed6dd73b80e0545b068
2023-05-16 02:34:35 +02:00
Arlo Breault 780639f8c5 Preserve classes on all file elements, not just broken images
This also adds mw-file-element to new image nodes.

Bug: T270150
Bug: T314097
Change-Id: I545ed75ed3c87e88b5e776696754e23c05645f81
2023-05-12 10:12:15 +00:00
Bartosz Dziewoński 37ab4c2a80 Expose automatic temporary user info in the API
Depends-On: I62b4bb630decac92cbb8c7ddf00307df0dadb516
Bug: T332435
Change-Id: I84ce108b4d46b4e19fad032382f8b69a1b0065d5
2023-05-04 00:44:10 +02:00
Bartosz Dziewoński 51a8541255 Replace references to actionsToolbar
Target#actionsToolbar and Target#toolbar refer to the same object
since change dfaed62d3632d381db9682c603b3ddbeed182292 in VE/VE
(barring bugs like T335469). Once we no longer use the old name,
we'll be able to remove this backwards-compatibility alias.

Bug: T335469
Change-Id: I577e8ae6a857519eb0e8181543ca0a96b515e019
2023-04-27 15:51:35 +02:00
thiemowmde 1a09676159 Add test for MWTemplateSpecModel.getDocumentedParameterOrder
It appears like this was never tested.

Now that it is covered it's much easier to play around with the
implementation and compact it a bit.

Change-Id: Ie9cc14082f69e7240380d352fb362d0a3fa4d341
2023-04-26 01:29:23 +00:00
Ed Sanders 860d9ae926 Render category diff
Bug: T161290
Depends-On: I118e85d7fa8202717db3a323e3e3dd9bc8a25be5
Change-Id: Iaa401b130bd81b8960f799dc9de6f172d9ba86a3
2023-03-15 13:10:23 +00:00
Ed Sanders 950fc45cf0 MWGalleryImageNode: Handle own children
This means that DOM attributes are deep-restored and so
selser runs properly.

Change-Id: I2fdfc04aee5e8b3524214e25afd8443b5f6b240d
2023-03-13 16:14:06 +00:00
Ed Sanders d4db90f970 Gallery tests: Remove data-mw.body attribute
This is not output by Parsoid except in legacy mode.

Change-Id: Ide894a3c5dfbbd1b7a4c0f29bbea65245192f1ef
2023-03-13 16:13:47 +00:00