Commit graph

773 commits

Author SHA1 Message Date
Ed Sanders 24973a2928 Update VE core submodule to master (15c1efdc2)
New changes:
cf7b2a9c4 Restore margin between wrapper paragraphs and document edge
629109b6b ve.ce.Surface tests: Sometimes assert originalDomElements in paste tests
3a5bd323c Use wrapper paragraphs in fixUpInsertion

Local changes:
* Update tests to ignore some internal properties

Bug: T299815
Bug: T299817
Change-Id: Ie52348f62320eb135c2f950ac78a77d9c665fef2
2022-03-09 01:05:15 +01:00
Ed Sanders 3b2dc7bbfb DesktopArticleTarget tests: Mock config using QUnit.newMwEnvironment
Also mock some additional config to prevent the page from trying
to reload on teardown.

Change-Id: Ib20c1f5277c5d5a99f5117c82b7cbdeab75d3279
2022-03-04 13:36:22 +00:00
Thiemo Kreuz 836d36bc16 Skip initial creation of unused parameter widget
In a test case with 200 templates where all but a few parameters are
unused the loading time is cut in half.

Bug: T300974
Change-Id: Ice850cb9e5e95b9e3a19ff511b3a4f32117c7199
2022-03-02 10:19:46 +00:00
jenkins-bot fe69e22761 Merge "tests: Mock wgVisualEditor instead of relying on SpecialPage value" 2022-02-21 13:32:51 +00:00
jenkins-bot 2a72f4e290 Merge "Remove not needed self = this indirections" 2022-02-21 12:57:41 +00:00
Thiemo Kreuz 3c042049bf Use .bind() syntax where it makes code more readable
This focuses on a few trivial cases where the syntax helps making
the code more readable. One level of indirection is gone with this.

Change-Id: Ibf25d7eaa06952e69b36bd5a78a48d04ac62890c
2022-02-21 10:34:03 +00:00
Thiemo Kreuz 58e27f56d6 Remove not needed self = this indirections
These are only needed when we need to access a specific `this` from
within another `function () {}` context. This is not the case in the
situations here.

This is split from Ibf25d7e to make it smaller and easier to argue
about.

Change-Id: Ide1476de91fc343aa992ad92a1321d3a38b06dd0
2022-02-21 10:52:24 +01:00
Timo Tijhof bdb7737a5a tests: Mock wgVisualEditor instead of relying on SpecialPage value
Found via Iaf989bc50363a (patch set 6):

> FAILED TESTS:
>   ve.init.mw.DesktopArticleTarget
>     ✖ init
>     Died on test #1
>     TypeError: Cannot set property 'pageLanguageCode' of null
>         at Object.<anonymous>

Bug: T89434
Change-Id: I8ad2cc4c115224eb276d1488091b9518fde739f9
2022-02-16 10:19:11 +00:00
Bartosz Dziewoński a2390efbf4 Re-apply "Re-duplicate deduplicated TemplateStyles"
Previous attempt in 005a8d24ef,
reverted in 3c1d167b33.

The deduplicateStyles() function lacked a check for fosterable
positions, which caused T299767. This is now fixed.

Also added tests.

Bug: T287675
Bug: T299251
Change-Id: I0d22be9b66d26d09373cee63dd6ce52c1659e62d
2022-01-28 02:08:09 +01:00
Bartosz Dziewoński 8c12259900 Update VE core submodule to f5c7f0f204
New changes:
e5963f084 DiffElement: Remove doc-child-change wrappers
90a359f79 Follow-up Ia593dad8: Use modifyData when sanitizing
f5c7f0f20 Localisation updates from https://translatewiki.net.

Local changes:
* Update tests for the removal of doc-child-change wrappers

Change-Id: Ib29f23625de9151d50e0f3b7796b15ca9ed89133
2022-01-24 20:13:21 +00:00
jenkins-bot d355ee1c88 Merge "Minor code cleanup in MWTransclusionOutlineTemplateWidget" 2022-01-24 08:11:43 +00:00
Thiemo Kreuz be5a752c8e Minor code cleanup in MWTransclusionOutlineTemplateWidget
Change-Id: I98904756e8ab9069634f644dc4d8631d1c0ee8fb
2022-01-23 17:09:46 +00:00
jenkins-bot 8e5de75d12 Merge "MWImage: Fix handling of error-image dimensions" 2022-01-22 01:07:39 +00:00
WMDE-Fisch 6cb0e7477e Hide parameter search when there are only 3 params
The search field is of not much use when there is not really anything
to search. It wastes more space than the actual list of parameters.

Approved by UX, see T298259#7626538.

Bug: T298259
Change-Id: I01784a1c463d8b0b504897b20179719f91597d19
2022-01-21 11:23:49 +01:00
Thiemo Kreuz 66f56f6c88 Defer creating template parameter search when it's not needed
From the user's perspective this is the same as before: When a
template doesn't have any parameters, there is no search field. The
moment the first (undocumented) parameter is added the search field
appears.

This is just delayed now. The widgets are only created the moment
they are actually needed.

This saves loading time and memory, especially in a multi-part
transclusion with many zero-parameter templates.

This also makes it a lot easier to change the minimal number of
parameters from 1 to e.g. 4.

Includes reverting the flexible header composition done in
Ib050e30a50ef965c1524e977d3a600c3ff836774

Bug: T298259
Change-Id: Ied7541d8d5c0b478a439dd31ce072e634287f181
2022-01-19 11:23:34 +01:00
Ed Sanders 63603e0cba MWImage: Fix handling of error-image dimensions
Change-Id: Ic808930bbd49bab779bd2ed174e6ec2408d51554
2022-01-19 00:51:39 +00:00
jenkins-bot 83d1211ef6 Merge "Give getUniquePartId method a better name" 2022-01-11 13:31:10 +00:00
Ed Sanders 9e4915d7c3 Tests: Fix unbalanced HTML
Change-Id: I997c68ce33263004b8ae9b686aae7295eec12ea7
2022-01-04 02:01:38 +00:00
Thiemo Kreuz 454dc53126 Give getUniquePartId method a better name
It's not a getter, but a generator. I found the name confusing.
Getters typically don't return something different every time you
call them.

Change-Id: I6eeab8b6a8644e430003f6e1ad77ab4b28e0d8c9
2021-12-22 13:03:01 +01:00
jenkins-bot 717b5cf534 Merge "Use no-jquery/no-html to warn against writing HTML strings to the DOM" 2021-12-17 16:42:53 +00:00
jenkins-bot c92ea76af8 Merge "eslint: Enable no-jquery/no-append-html" 2021-12-17 16:42:42 +00:00
jenkins-bot 6dc75d8283 Merge "Remove obsolete performance bottleneck from TransclusionModel" 2021-12-17 13:24:19 +00:00
Ed Sanders 2098292318 Use no-jquery/no-html to warn against writing HTML strings to the DOM
This forces us to comment when we are doing this deliberately.

Change-Id: Ide1bcb64f6c6076b48e88f1f27045bd93392f8a0
2021-12-16 01:28:42 +00:00
Ed Sanders 4d13a4f4ed eslint: Enable no-jquery/no-append-html
Prevents accidentally treating plain text or user input
as HTML, which could be an XSS vulnerability.

Change-Id: Id4af48447a0907962a57340cb60aca08df9cc505
2021-12-16 02:04:11 +01:00
Thiemo Kreuz 7cf10ea474 Delay initialization of all invisible "add parameter" components
The "Add parameter" page always starts collapsed. Even if a template
doesn't contain anything but this. But most of the content isn't
visible, unless the user presses the button. It's not only a lot of
content, it's also rather expensive, including .parseDom(),
LinkCache.styleElement(), and ve.targetLinksToNewWindow(). This adds
up in large multi-part transclusions. In an example with 200 parts
the total blocking time goes down from 2.9s to 2.4s. Which means this
is not a major bottleneck, but still worth it.

Bug: T296335
Change-Id: Ieab9fd35d145142b04d2267d8e5a2e10a4c02784
2021-12-15 08:28:16 +00:00
Ed Sanders 5c0344aeda Use new select[First|Last]SelectableContentOffset methods
* Make ve.ce.MWBlockImageNode autofocus=false, remove
  unused transition property
* Remove ignoreChildren from ve.dm.MWBlockImageNode
  based on new definition
* Remove tests which assert that deleting in a list next
  to a block image always de-indents. If this is desired
  behaviour it should be fixed without reference to
  ignoreChildren.

Bug: T295905
Depends-On: Idc0cccbe73d1b49d07b60c14a192a40f47d64608
Change-Id: Ib79a070f5d36dbe7742fa0760f8cdf55fe3046ed
2021-12-08 15:53:35 +00:00
Thiemo Kreuz fd669a4d16 Remove obsolete performance bottleneck from TransclusionModel
This sorting algorithm was introduced via Ic6bc348 (T274544). Note
there is no index parameter in the .onReplacePart() handler at this
point. When a part was moved, it was removed and simply appended
to the end. The additional sorting was needed to move it back to the
correct position.

This changed a few days later via Iafe29f1. There is now an index
parameter. The .onReplacePart() handler does the same as before, but
puts the part at the correct position right away. The additional
sorting is pointless since then.

The removed code alone is responsible for 1/3 of the total blocking
time when the template dialog opens.

Bug: T296335
Change-Id: I6c3fa70b532d34cd29d59c3b48ab81ebf608d548
2021-12-06 17:36:53 +00:00
Ed Sanders 33840e88ee build: Update eslint-config-wikimedia to 0.21.0
Change-Id: I19465a5ab3bf71cd97967fd1fac41c645f05a419
2021-11-10 14:52:56 -05:00
Ed Sanders 36eacb1095 assert.ok -> assert.true
Change-Id: I9987ae0cbe275bf492dcdef405454537119765ea
2021-11-09 00:30:20 +00:00
WMDE-Fisch dab5b5daae Add ARIA descriptions to sidebar widgets
When changing the source in the described-by attributes the screen
reader will read the text of the new source when the status changes.

Just changing the text within the elements holding the descriptions
does not work.

Bug: T291284
Change-Id: I31cc3061cf6c1f699babe41e99e0711f0eb03646
2021-10-29 12:07:53 +02:00
jenkins-bot c9222cf111 Merge "Fix strange dialog title when using subst:" 2021-10-25 09:12:13 +00:00
Ed Sanders e1fb20d8be Replace IIFE with block scope in ES6 code
Change-Id: I635f72a62ae44943a7705d28e92c9a0d265800b6
2021-10-14 15:11:45 +01:00
Thiemo Kreuz 74e3dd3f4b Fix strange dialog title when using subst:
When I type e.g. "subst:example" as the template name, we made this
work as the user would expect: the template named "Example" is found
and it's TemplateData documentation used. But the dialog title shows
"Subst:example". Note the uppercase "S". It means this string is
parsed as a title, including the "subst:". This is confusing. Just
show the template name.

Change-Id: I9817786991a8379cf48b0a664aef1413abddee2d
2021-10-08 16:00:29 +02:00
jenkins-bot 8e025e4af0 Merge "Skip flaky test for now" 2021-10-07 17:57:14 +00:00
Adam Wight 1142ca3ce0 Skip flaky test for now
Bug: T292318
Change-Id: I03437d33f26c48208b84a578ff185bff6f9034a7
2021-10-07 15:00:14 +02:00
Andrew Kostka 7e9d50ff05 Use .localeCompare() when sorting undocumented parameters
Bug: T292643
Change-Id: I5d89d64bcce656fa0881f69b5d0d0fef65871c0c
2021-10-07 11:57:18 +02:00
Thiemo Kreuz 1731f3cc14 Better name for .selectPartByPageName() method
This method does not only select a "part", i.e. a top-level item like
a template. It also selects sub-items like template parameters. The
new name reflects this better.

Change-Id: I51a8ddbd05b283248afba5a623cc52da7b2434f5
2021-10-01 07:00:40 +00:00
jenkins-bot abd115c054 Merge "First QUnit test for dialog classes" 2021-09-29 11:57:30 +00:00
Adam Wight d70941593d First QUnit test for dialog classes
Wrote a first test, that checks the parameter checkboxes showing up.

Bug: T291155
Change-Id: Ie79272442a0d0532607fe93e9ea538635812e671
2021-09-29 10:00:34 +02:00
jenkins-bot 8b539794a7 Merge "Cover suggestedvalues feature in MWParameterPage class" 2021-09-28 16:29:08 +00:00
Thiemo Kreuz 66d5f13dfb Remove obsolete …OutlineWikitextWidget test
The feature set is (almost) fully covered by other tests, notably
the tests for the …OutlinePartWidget base class and the other two
subclasses.

The only bit that's not covered any more is the
"visualeditor-dialog-transclusion-wikitext" message. But that's
super minor and not worth a separate QUnit test.

Bug: T291157
Change-Id: I574f9cff0baf3dff885094769c124a9e05a1d1c8
2021-09-28 08:37:47 +00:00
Thiemo Kreuz 33b4d0dfc6 Cover suggestedvalues feature in MWParameterPage class
… as well as improve the coverage of MWAddParameterPage a bit.

Bug: T291156
Change-Id: Ibacb602298e5200b00a23092e5b9b211c43d6719
2021-09-27 18:22:10 +02:00
jenkins-bot 37c5e5978e Merge "Move data model tests to correct directory" 2021-09-24 11:52:36 +00:00
Thiemo Kreuz 63d9969861 Rename outline "container" widget
I can't really tell what insight we get from the word "container".
Every widget is a "container" in some sense, isn't it?

This widget is just _the_ outline, I would argue.

Other suggestions?

Change-Id: I1fb27ee58c1a3dd790022504e978198dadf7ea02
2021-09-24 12:32:29 +02:00
Thiemo Kreuz 8125644ac2 Move data model tests to correct directory
Bug: T291062
Change-Id: I7425f047d07eceeae29b54106f7f7806fc929aa2
2021-09-22 14:09:33 +02:00
Thiemo Kreuz e037f99930 Merge custom "focusin" with "set" event handler
This code was introduced in I8fafee6. I can't tell any more what
the "bug" mentioned in the commit message was. Let's get rid of the
duplicate code path, see if we run into regressions and deal with
them one by one. That's much easier to handle than keeping this
confusing code path around.

Note this "focusin" event handler was actually re-implementing
parts of the upstream BookletLayout, namely
OO.ui.BookletLayout.onStackLayoutFocus().

Bug: T289043
Bug: T291381
Change-Id: Ib386ae6efec08465122f0e8ee81cd6dc9a2d337a
2021-09-21 10:14:57 +00:00
jenkins-bot e88c445920 Merge "Add tests for MWTemplateSpecModel.getTitle()" 2021-09-20 14:41:30 +00:00
Thiemo Kreuz 696d066829 Add tests for MWTemplateSpecModel.getTitle()
I was (again) wondering why the try-catch is there. But it's actually
needed. Now covered by a test.

Bug: T290140
Bug: T291062
Change-Id: Iccc7274ed9e7b81b8491dbca7d3d771706b0ed09
2021-09-20 16:04:22 +02:00
Andrew Kostka 65e3ce0787 Drop substitution prefixes before querying for TemplateData
Bug: T290140
Change-Id: I57924df9b6d4d6e24c54b85f044072e216478e68
2021-09-20 10:17:39 +02:00
jenkins-bot fe6c46bbdc Merge "Merge "templateParameterClick" and "choose" events" 2021-09-15 10:11:12 +00:00