Commit Graph

214 Commits

Author SHA1 Message Date
jenkins-bot 501bdab2aa Merge "Normalise PHP namespaces used in Vector" 2022-05-23 23:30:34 +00:00
Mo Abualruz e46eef19d0 Normalise PHP namespaces used in Vector
- `MediaWiki\Skins\Vector\Tests` is now the prefix for all tests in the skin
- we followed PSR conventions of following folder structure after the prefix
- Optimize imports/use order
- update namespace in skin.json

Bug: T303102
Change-Id: Ib76374d81d973c83adfd6c8e7863ff6d797e655d
2022-05-23 09:32:40 +02:00
libraryupgrader 7d5398bf3e build: Updating composer dependencies
* mediawiki/mediawiki-codesniffer: 38.0.0 → 39.0.0
* php-parallel-lint/php-console-highlighter: 0.5.0 → 1.0.0
* php-parallel-lint/php-parallel-lint: 1.3.1 → 1.3.2

Change-Id: I58dd3aad02958d7dc1c031fb159f2951d5d744dd
2022-05-21 19:16:03 +00:00
bwang dd8cc5dfe8 Add snapshot class to sticky header tests
Change-Id: Id1383f234bd0518786feebbbb2d92f7345aa6e70
2022-05-12 10:51:43 -05:00
bwang c9bda9195c Hide gadget in beta cluster, update reporter
Change-Id: I9ee8dcfdac1d73182abf7933d6383518ec16409c
2022-05-11 20:24:59 -05:00
bwang d06dabe897 Ensure main menu is open in a11y tests
Change-Id: Ib1077797a51af216c7fe014a8b1adfe93fefde7a
2022-05-06 14:04:29 -05:00
bwang 6b814da689 Update reporter to include screenshot, remove try statement to ensure CI fails when an error occurs
Change-Id: I685c8a74352b4172d7a086467a9b3cfc84d57cee
2022-05-05 12:35:29 -05:00
Željko Filipin 09fe15e939 a11y: create report in LOG_DIR or 'a11y/'
If LOG_DIR environment variable is set, create report there.
If it is not set, create the report in 'a11y/'.

Bug: T301184
Change-Id: I74fa6e8ee59d43e5a6e57083999107ac27446a62
2022-05-05 11:46:13 -05:00
Željko Filipin f601fe480e a11y: create report in log folder
The report was created in log/a11y folder until now. Looks like Jenkins
expects it to be in log folder.

Bug: T301184
Change-Id: I9926e7446e4fc86526dab963066511bf8da2271e
2022-05-04 16:36:57 +02:00
bwang 76c8435167 Fix a11y test runner setup issue
Change-Id: Ib6b41ba0410dacf6a13d9fe64bf60eb5b84b9e07
2022-04-28 14:54:14 -05:00
jenkins-bot ea5b4565fe Merge "Hooks: Migrate Vector skin hooks to the new MediaWiki hook system" 2022-04-27 19:29:04 +00:00
Jon Robson c269419af3 Disable animations when user prefers reduced motion
When browser preference for reduced motion is enabled:
* Disables bolding of table of contents
* Disables sticky header transition

Bug: T254399
Change-Id: I8ef9e59b258fed977ce370da352b1924832d842b
2022-04-26 23:31:38 +00:00
Derick A 80b60c153a
Hooks: Migrate Vector skin hooks to the new MediaWiki hook system
Per https://www.mediawiki.org/wiki/Manual:Hooks#Handling_hooks_in_MediaWiki_1.35_and_later,
MediaWiki provides a new hook system. Vector is able to utilize this new
hook system because it requires a MW version >= 1.35, hence the migration.

Bug: T271009
Change-Id: I6e01b151751485339a0d6a6dc6a843f7141d54bb
2022-04-26 23:58:13 +01:00
bwang 9473758efd Replace h2 in TOC with p and remove aria-hidden
Ideally the TOC has an h2 after the article title h1, but because of the TOC sticky positioning and its placement in the grid, we cant use an h2 without messing up the heading order.

Bug: T301051
Change-Id: I462ddfb618ddd422c9f71293280d1790c4846f50
2022-04-19 17:51:36 +00:00
Mortal303 8b51041003 Move Vector menu class logic into Menu mustache template
Replaced “vector-menu-heading” with ‘’(empty string) in “$portletData['heading-class'] = '';”
in includes/SkinVector.php and updated accordingly the includes/templates/Menu.mustache file.
Updated “vector-menu-heading” with ‘’(empty string) in stories/LanguageButton.stories.data.js,
stories/UserLinks.stories.data.js, and tests/phpunit/integration/SkinVectorTest.php respectively
SkinVector and Storybook are cleaned up.

Bug: T290281
Change-Id: I4ca16953799b3dc52e45674bb398c78f14cfc842
2022-04-18 15:18:53 -05:00
bwang a77fed0a55 Update a11y tests to output files in log/
This makes built assets available in jenkins,
Also addresses miscellaneous feedback relating to configuration
variable name and track topic name.

Change-Id: Ic70d517eba96aab6512a96ea19d6be56b3664871
2022-04-15 19:43:53 +00:00
Clare Ming 28a3c06cdf Replace TOC arrow icon
Bug: T304166
Change-Id: I182c9e5399d95ecea58dcdabb563a98b4e34e47e
2022-04-11 14:56:42 -06:00
jenkins-bot a961f3fb28 Merge "Remove env option from a11y test to enable tests to run in docs env" 2022-04-07 21:12:33 +00:00
bwang 18c65141f9 Remove env option from a11y test to enable tests to run in docs env
Change-Id: Ieef80011996b8e7c5ff11239f2c9ae53da9b3e99
2022-04-07 15:13:17 -05:00
jenkins-bot 1e75d6f373 Merge "Clean up unused constants and outdated comments" 2022-04-07 18:19:28 +00:00
jenkins-bot 72e842e1f7 Merge "Update puppeteer chrome config for a11y tests" 2022-04-07 16:55:52 +00:00
jenkins-bot 6fc95b72ba Merge "Drop the Vector.Config service" 2022-04-07 16:54:01 +00:00
bwang b51aa00a03 Update puppeteer chrome config for a11y tests
Change-Id: I9e7940445f18c8a9d01273208545cd60c260279a
2022-04-07 11:20:44 -05:00
Func 12c7d6a0ca Clean up unused constants and outdated comments
Change-Id: If6462e3a67726234abe62fd4d02a5d19ff4f02e0
2022-04-07 16:10:52 +00:00
Func b61a92f052 Drop the Vector.Config service
It didn't vary by the skin version as documented in the Constants class,
and merely another instance of GlobalVarConfig.

Change-Id: I0acd0366a241e04bb79f6aae5dc52284dfa578df
2022-04-07 04:30:20 +00:00
bwang f1c70e99b7 Update sticky header to use ARIA attributes for section collapsing and add accessible label to toggle buttons
Bug: T303766
Change-Id: Idda4f286a42152af1d233588a1839ada5491ce95
2022-04-06 17:24:34 -05:00
jenkins-bot 94d9445ba3 Merge "Add automated a11y tests with pa11y" 2022-04-06 19:48:39 +00:00
bwang dd9b6e1dbc Add automated a11y tests with pa11y
Bug: T301184
Change-Id: If3d5aa74b9b1f5bf0f7aa2ea6950853c9a5f5ada
2022-04-06 19:29:58 +00:00
bwang aa8ec1a878 Revert unnecessary TOC section id change
Change-Id: I62736b47557b79929b8ad984d6709e762b3db549
2022-04-05 15:38:00 -05:00
Nicholas Ray 6fbf08a198 Build A/B test bucketing infrastructure for the table of contents.
* Bucket and sample on server by using the
  `WikimediaEvents.WebABTestArticleIdFactory` service from
  WikimediaEvents (soft dependency)
* Add linkHijack.js so that users bucketed in one group have the
  possibility of remaining in that group if they click a link to another
  page.

Bug: T302046
Depends-On: Ie6627de98effb3d37a3bedda5023d08af319837f
Change-Id: Iff231a976c473217b0fa4da1aa9a8d1c2a1a19f2
2022-04-04 17:06:29 -06:00
jenkins-bot 19f114281a Merge "Drop the LatestSkinVersionRequirement" 2022-04-04 20:18:35 +00:00
Jon Robson eca9fcbf79 Drop the LatestSkinVersionRequirement
The LatestSkinVersionRequirement is problematic for various reasons:

1) It uses the "useskin" query string
parameter which may or may not refer to the correct
skin (in the case of a non-existent skin it will always come to the conclusion that
it is not modern Vector and thus must be legacy).

2) It uses the User object which may or may not be safeToLoad
depending on when called.

The feature seems redundant at this point, as we are separating code
into separate classes Vector and Vector22 and all the features only apply
to modern Vector. I suggest we remove it and use the features explicitly in the skin
intended.

Bug: T305232
Bug: T305262
Bug: T302627
Change-Id: I92fa33547bd601e05ddc8c1468e681892e47c16b
2022-04-04 19:22:38 +00:00
bwang 733990f881 Small clean up and TOC update
Change-Id: Ic093888cb2b06d8eef95a1317d791e7e1627d0f6
2022-04-01 13:14:02 -05:00
jenkins-bot 056b242682 Merge "Make beginning bold on scroll" 2022-03-29 16:05:39 +00:00
Clare Ming 1d574b86f1 Add fade to indicate scrollability in TOC
Bug: T302076
Change-Id: Ib803239602333e2a8232a26a10477a0f9933b819
2022-03-28 15:58:26 -06:00
jenkins-bot 9eb243714d Merge "Improve UserLinks test to mocks registered user" 2022-03-25 21:58:10 +00:00
Jon Robson a2c7c024df Make beginning bold on scroll
Bug: T301254
Change-Id: I4469575ea8590ae22023b98c3dbd31bc672d5766
2022-03-25 01:13:42 +00:00
jenkins-bot cd04b72058 Merge "Table of contents links to beginning of article" 2022-03-24 23:51:52 +00:00
Jon Robson dfdf72140c Table of contents links to beginning of article
Bug: T301254
Change-Id: Icb0b0646f81c1070c8f47dd3297225a074f74773
2022-03-24 20:46:35 +00:00
bwang fea5740f57 Improve UserLinks test to mocks registered user
Change-Id: I9d90cea74f9d39550c91c9f761414a7e5e4f2b70
2022-03-24 15:34:02 -05:00
jenkins-bot 1b8ee10357 Merge "Add data-event-name attributes to legacy and sidebar TOC" 2022-03-23 22:00:45 +00:00
jenkins-bot 24b5d5840e Merge "End migration mode" 2022-03-23 17:03:38 +00:00
Jon Robson b109e10cf3 End migration mode
Can be merged when database rows have been updated to
no longer use skin version.

* Drop migration code
* Drop skin version preference
* Drop default skin version and existing accounts skin version
* Move skin definitions into skin.json
* Repurpose SkinVector as an abstract class
* Update READMEs

Bug: T301930
Bug: T294995
Bug: T302627
Change-Id: I7454d8f1cfdef81e7f3df476d8ce86736b46fff2
2022-03-23 16:46:42 +00:00
jenkins-bot b3f19854b6 Merge "Revise AB.js to handle other features + server sampling/bucketing" 2022-03-22 22:53:30 +00:00
Nicholas Ray d01dead5a7 Revise AB.js to handle other features + server sampling/bucketing
* Eliminates AB.js dependency on sticky header
* Code coverage has been raised to 100%
* Instead of importing ABTestConfig, these props are now passed into the
  function along with a token.
* WikimediaEvents hook is now fired when experiment is initialized. The
  experiment should not be initialized if it is not enabled.
* Removes several methods (e.g. initAB, getEnabledExperiment) due to the
  preceeding changes.
* Adds `isInSample` and `isInTreatmentBucket` methods so that the client
  has less work.

Treatment buckets now follow a naming convention so that the client can
do less work querying if the subject is part of the treatment:

* Treatment buckets should have the case-insensitive `treatment`
  substring somewhere in their name (e.g. 'treatment',
  'stickyHeaderTreatment', 'sticky-header-treatment' )

Bug: T302046
Change-Id: I4febec42b4c471b2f2ef02be2e334bd6d2c31eec
2022-03-22 11:58:48 -06:00
Jon Robson 4b50b4bbd3 Drop setId call
A user with an ID is a registered user and this test requires
an anonymous user.

Follow up to a1afa7ccb3

Not sure why this was working before, but I'm guessing
setId doesn't modify the User associated with the skin

Change-Id: I32bd74bd5aec1b14fb8b725fca2f8cef5f9d2ba1
2022-03-21 16:49:36 -07:00
bwang ac54984d75 Add data-event-name attributes to legacy and sidebar TOC
Bug: T302934
Depends-on: I5ef98d5f5713d3d99bc5f7f8112ba2d1e0f62e22
Change-Id: I5806c346abf0375c85248659c636ae3b2d73f661
2022-03-21 22:32:56 +00:00
jenkins-bot 9c6d3f7b7b Merge "Update Hooks tests to cover updateUserLinksItems" 2022-03-21 20:08:16 +00:00
bwang fec6bf15f5 Update Hooks tests to cover updateUserLinksItems
Change-Id: Ia719f34f060e02acb81c7d48ba5885283df0045f
2022-03-21 13:03:44 -05:00
jenkins-bot 08efa139be Merge "Remove custom handling of aria-expanded in Vector checkbox hack buttons" 2022-03-21 18:03:14 +00:00
Mortal303 ae50914d4e Remove custom handling of aria-expanded in Vector checkbox hack buttons
Removed class "vector-menu-checkbox-expanded" and "vector-menu-checkbox-collapsed" in
includes/templates/Menu.mustache and deleted the necessary lines in
resources/common/components/MenuDropdown.less, tests/jest/stickyHeader.test.js,
includes/templates/skin.mustache, skin.json, i18n/en.json and i18n/qqq.json.

Bug: T299173
Change-Id: Ibf8a08e6e5d1a6c607abf170c030a0285e84ad74
2022-03-21 23:14:51 +05:30
jenkins-bot 822d1957f1 Merge "Revert "build: Update eslint-config-wikimedia to 0.22.1"" 2022-03-17 00:18:36 +00:00
Jdlrobson f7a859bac5 Revert "build: Update eslint-config-wikimedia to 0.22.1"
This reverts commit b72c648d21.

Reason for revert: Causes an issue with the search
(See https://phabricator.wikimedia.org/F35009362)

Change-Id: I09f7e5c9eab677bfd5a92cf2d8389d20a2d6e87a
2022-03-16 23:40:42 +00:00
Jon Robson 6855979a92 [i18n] Table of contents heading
Should be translateable

Change-Id: I3c4515f16b5300a44f89ebdcd426a9d8ac6ad138
2022-03-16 17:18:51 +00:00
Ed Sanders b72c648d21 build: Update eslint-config-wikimedia to 0.22.1
Change-Id: If632697f7c3bb3fad6668d791d9408f7b7a3590b
2022-03-16 15:42:07 +00:00
bwang 2511e35837 Refactor user links functions in Hooks.php to increase test coverage
Change-Id: I8fbf5cdf111dbb1ec06e5e74056ffdef77f77f22
2022-03-11 21:53:06 +00:00
bwang a1afa7ccb3 Ensure watchlist in user menu dropdown has the collapsible class
Bug: T302084
Change-Id: I27d7c0e46ee809185133fd787fc0c6fa5fcdac2e
2022-03-07 23:12:49 +00:00
Reedy fc11a4dc46 Namespace Vector integration tests
Rest of phpunit tests are namespaced...

But under two different namespaces

Change-Id: I875ba8225d97674b4150b594d0f80527d0988ee3
2022-03-04 13:35:05 +00:00
Reedy 1dcfe80ac3 Namespace SkinVector* PHP classes
Namespaceless class aliases are left behind for migration purposes.

They can be removed at a later date when dependant extensions
and skins are fully updated.

Bug: T301204
Change-Id: I2b37c1889ff862ec8bb41325fc9f654c673cd115
2022-03-04 13:30:21 +00:00
Clare Ming 338e0e72ac Fix language alert regression
- Add test for SkinVector::shouldLanguageAlertBeInSidebar() method.
- Change some methods to protected status -- acknowledging this is not
an optimal change. Until we can pull out some of the language checks
into its own class with injected dependencies (title, feature manager,
languages), this is an interim solution to try to catch regressions
since the conditional states for showing the alert are complex and
ultimately temporary. Extracting the language checks into their own
class can be done in a follow up ticket to help optimize testing
language checks in isolation.

Bug: T302018
Change-Id: I99b7df3029e0af86e4d67b3f446d4ce99260d33e
2022-03-01 15:37:43 -07:00
bwang 5f0c0cb294 Use TOC template data for showing collapsible section arrows
Bug: T299361
Depends-on: I8ab5c0543b898d1df9399a1cb39672c45daf2acd
Change-Id: Ib68de8cd97cc1111a5a33e100e688d6832fc7e6e
2022-02-22 15:47:23 -06:00
Nicholas Ray 6e9506dcad Dynamically expand/collapse sub-sections in ToC based on # of headings
Server render the table of contents in a collapsed state when the total
number of headings is equal or greater than the value of
`$wgVectorTableOfContentsCollapseAtCount`. Otherwise, the table of
contents will be server rendered in its "expanded" state.

In addition:

* Revise table of contents tests to call one `assertion` per element so
  that it is easier to see the exact element that may fail an assertion.
* Revise table of contents tests to call a mount function that can merge
  props to allow for a more flexible set of tests.
* Revise table of contents tests by wrapping a `describe` around tests
  that expect the same prop state.
* Adds typedef for table of sections props

Bug: T300973
Depends-On: Ifaee451e1903f2accd0ada2f2ed6dfa3f83037b6
Change-Id: I382200bc603b6abf757a91f14a8a55a6581969bd
2022-02-21 14:58:51 -07:00
Jon Robson 2dcd99ed21 Sticky header dropdown should not contain gadgets in personal menu
Bug: T302087
Change-Id: Iae1f42c3c526398d7dea038786ae9001e118307b
2022-02-18 21:30:29 +00:00
jenkins-bot 9b7d5ad473 Merge "Toggle ToC sections when clicking toggle button" 2022-02-16 22:30:25 +00:00
jenkins-bot 914e3d55e6 Merge "Add fetch tests from WVUI" 2022-02-16 22:07:18 +00:00
bwang 301e09916d Toggle ToC sections when clicking toggle button
Bug: T300167
Change-Id: If1150a9e018b232da900187383aaee9c9cf331a1
2022-02-16 15:48:28 -06:00
bwang a560fb814a Add fetch tests from WVUI
Bug: T288686
Change-Id: Ifeb2e355482d3d5920c2535c89193cc4f36a13c9
2022-02-15 14:00:40 -06:00
Jan Drewniak 7d32ec80d3 Collapse ToC by default & expand sections when clicking section headings
Collapses sub-sections in the new table of contents by default
(except for non-js and reduced-motion users) and expands the
sections when the top-level section link has been clicked.

Refactors the `activateSection` TableOfContents methods into separate
`activateSection` and `deactivateSection` functions.
Adds `expandSection` and `collapseSection` methods.

Adds triangle icon as a visual expand/collapsed indicator
next to all ToC section headings and are hidden via CSS based on
whether or not the section contains subsections.

Adds test for tableOfContents.

Bug: T299361
Change-Id: I36b3ae7f9f633877683bc17a9444c970d7fa7293
2022-02-15 00:09:50 -05:00
bwang 3e92800bd6 Move REST search client out of WVUI into Vector
Bug: T288686
Depends-on: I4afc8c38dc9c51d55b46b766a1417b1266963482
Change-Id: Iac6023bb6edca5c8dddc3bfd362db727b2534946
2022-02-10 10:17:10 -06:00
jenkins-bot c621e0e91d Merge "HTMLLegacySkinVersionFieldTest: Adjust tests to closer to real situation" 2022-02-08 23:48:21 +00:00
Nicholas Ray 80a111d0e4 Fix TOC section activation on link click bug
We want the link that the user has clicked inside the TOC to be "active"
(e.g. bolded) regardless of whether the browser's scroll position
corresponds to that section. Therefore, we need to temporarily ignore
section observer until the browser has finished scrolling to the section
(if needed).

However, because the scroll event happens asyncronously after the user
clicks on a link and may not even happen at all (e.g. the user has
scrolled all the way to the bottom and clicks a section that is already
in the viewport), determining when we should resume section observer is
a bit tricky.

Because a scroll event may not even be triggered after clicking the
link, we instead allow the browser to perform a maximum number of
repaints before resuming sectionObserver. Per T297614#7687656, Firefox
wasn't consistently activating the table of contents section that the
user clicked even after waiting 2 frames. After further investigation,
it sometimes waits up to 3 frames before painting the new scroll
position so we have that as the limit.

Bug: T297614
Change-Id: If3632529f58c15348a7200258f4f5999ea0dadc4
2022-02-08 14:45:16 -07:00
Func 1d67da02f8 HTMLLegacySkinVersionFieldTest: Adjust tests to closer to real situation
The behavior of data loading can differ between submitting and display,
so use FauxRequest to customize the method.
Also fix the order of parameters passing to assertSame(), the first one
should be the expected one.

Change-Id: Icfa062eada75c50cd2c8bc5db2930602d80e9ae7
2022-02-08 09:34:49 +00:00
Jon Robson 29498112ed Migration mode is now the default
- Reflect production.
- Update SkinVector migration notes.

Depends-On: Ia527e60901de59f9e094ca0f1ba62a67a2f808a2
Change-Id: I8efa56fa0644b2ceb33fdab16da5df1d44ee621f
2022-02-07 22:20:16 +00:00
jenkins-bot 63b1bdbb2b Merge "Drop search related feature flags" 2022-01-31 22:05:45 +00:00
jdlrobson d8382ec96b Drop search related feature flags
Given Wikidata is the only project using modern Vector,
and the only project where the search API is not applicable,
this will result in a loss of autocomplete on Wikidata.org
which will fall back to the non-JS mode.

Bug: T290688
Change-Id: Iece5a4efd43e09cd90c842c9c134ca115b35f2b2
2022-01-31 21:00:22 +00:00
bwang 66359e8fa5 Setup jest unit tests and add basic test cases for AB.js and App.vue
Bug: T300561
Change-Id: Ib7c314b094bd823ae233374f63c9094724d6c06f
2022-01-31 20:50:33 +00:00
Jon Robson c87f6a8b2e Tests: Limit testGetTemplateData to current values to allow expansion
In I0cd49e6d621cd437e440ac7f7627eaa064ab870c a new field will be
added. Our tests in Vector shouldn't fail every time this happens

Change-Id: Ieb4923e9f58f950ee02ce3eb1446b982d1f5724a
2022-01-31 08:05:33 -08:00
Jon Robson 435c903523 Fix bug in SkinVersionLookup
Bug: T299971
Change-Id: Icd8874315bf3c5846b00e8c34eb1a739c4a0feba
2022-01-24 13:34:06 -08:00
Jon Robson 94bab9f45f Respect useskin when operating in MigrationMode
Bug: T299171
Change-Id: I7c183949c358a5eb07c273044f63ac6474a62ad2
2022-01-19 22:33:28 +00:00
Func 0bd3a30343 Use field name for the hide-if statement
Field name without 'wp' prefix (which is used as the key in html descriptor) is required.
After I58f9df384df8ecc5ebae8cac68ec2251351bc984, values of fields that are supposed to be disabled would be loaded from default, use a miss-matched field name would be treated as disabled.
It works in UI now, but it's not a good idea to strip the 'wp' prefix on the server-side.

Bug: T298819
Change-Id: If98368ad400986afaef3187867f201044ebf0efb
2022-01-17 03:24:10 +00:00
jdlrobson 7d2d50873f Vector is split into 2 skins
A new vector-2022 skin is added. This will be the eventual home
of the new Vector skin when we are ready to migrate.

Please see SkinVector class for the migration plan to simulate this
as part of testing.

Bug: T291098
Change-Id: Ibaddf94a5bfb5e21bbbaf1e0aa1b343a3f566d2d
2022-01-06 15:52:10 -08:00
jdlrobson 64ee622c73 Validate the value of VectorWebABTestEnrollment
The generation of JavaScript will throw a RuntimeException
making it obvious when an invalid A/B test has been setup.

Bug: T297662
Change-Id: I75b0e923463bf52f8fc5b5c6b7f9baf586053154
2021-12-14 22:22:26 +00:00
jenkins-bot 1ceb673578 Merge "Move bundlesize test to MediaWikiIntegration test" 2021-12-10 19:55:16 +00:00
Kosta Harlan 6270246d44 Move bundlesize test to MediaWikiIntegration test
The main motivation is to reduce runtime by not invoking an unneeded
Selenium test phase in Quibble, which currently needs about 1 minute to
install npm dependencies.

Depends-On: Ieb7591f3c0ac843677a2a61b4ad47f920fc2ca2d
Bug: T255149
Change-Id: I0563421b3a3d3e6e81abec987c266ade275b47a1
2021-12-10 08:48:59 +01:00
vladshapik 262a520a2c Avoid using User::getOption
Remove using of User:getOption since this method
will be hard-deprecated. Now it is soft-deprecated.

Bug: T296083
Change-Id: I3194a9c1c5c70592f88bc4dbedc78846d1141768
2021-11-29 23:46:05 +00:00
jenkins-bot ed4ec0079a Merge "HTMLLegacySkinVersionField: accept string 'default' value" 2021-11-23 11:27:41 +00:00
MusikAnimal 5207a15b91 HTMLLegacySkinVersionField: accept string 'default' value
After I628435a4a, we were asserting a boolean was given because we're
extending HTMLFormField which requires a boolean value. This was safe
because GlobalPrefs would provide a boolean, but that changed with
I594f6297.

We could rework GlobalPrefs once again to ensure only a boolean is
passed in, but since HTMLLegacySkinVersionField already has special
handling around the data types, it seems to make sense to contain the
type transformation in this class.

Simply removing the Assertion is enough to prevent T296068, however
depending on when the global preference was saved (such as since MW
1.38.0-wmf.9 but before wmf.10), it's possible either a bool or a string
was saved, hence we check for both to ensure correct display.

Bug: T296068
Change-Id: If10b948617d2bb8346475f207fe425fb768cb987
2021-11-23 00:57:25 -05:00
Umherirrender 0c154bba36 build: Updating mediawiki/mediawiki-codesniffer to 38.0.0
Change-Id: Ic16a1f89fc5ccae3eddd31b1d566128e60592b90
2021-11-13 19:01:31 +01:00
Alexander Vorwerk e924b9b01c MediaWikiTestCase -> MediaWikiIntegrationTestCase
MediaWikiTestCase has been renamed to MediaWikiIntegrationTestCase in 1.34.

Bug: T293043
Change-Id: I9f8c1e134e9de9e7142ea18e2a9b903e6583cfdb
2021-10-12 01:10:33 +02:00
jdlrobson b88f2970f7 Simplify how we generate icons and button classes in Vector
- Separate icon classes from button classes in user links/language
- Upgrades the personal tools language button preference to
a mw-ui-button with icon
- Adds a generic selector for dropdown menus without an icon
- Cleans up user links CSS now mw-list-item class is available
- Removes icon hack CSS

Bug: T289630
Bug: T283757
Change-Id: Ib518858e06549f252d73d57fd4768f446cc561b9
2021-09-03 19:25:31 +00:00
Clare Ming 1efe0a4203 Remove user links feature flag
Update/remove config, constants, hooks, templates, styles, logic, tests, stories to check legacy vs modern Vector where applicable instead of the decommissioned user links feature flag.

Bug: T288852
Change-Id: I5c5831091a10711838a8a2877c782df4996d4596
2021-08-26 10:07:15 -06:00
jdlrobson c000fa9a2a Tests should use Universal hook
The existing hook does not allow modification of variants which
will soon change.

Bug: T287533
Change-Id: I8969296c64875d58e3c7ea95f6b567916f82d8a7
2021-07-28 11:07:42 -07:00
ZabeMath e7fbb01aca Avoid using User::setOption()
User::setOption() is deprecated and should be replaced with UserOptionsManager::setOption()

Bug: T277818
Change-Id: If867b4f97918db581d337a32b33cbca2315a71f6
2021-07-18 13:48:44 +02:00
Clare Ming cb3d5742da Add querystring parameter override for user links, language in header.
- Add new OverridableConfigRequirement class.
- Add query parameter constant for user links.
- Update Feature Manager with new requirements.
- Use new class for LanguageInHeader requirement.
- Remove LanguageInHeaderTreatmentRequirement class and test.
- Add unit test to cover user links and language in header.

Bug: T285855
Change-Id: I56b729a9e245ed2ddc85625c0be39f5c26320ac4
2021-07-15 16:51:48 +00:00
jdlrobson 3dffee277c Refactor the way we add classes to list items
Append mw-ui-icon classes to list item not list link
This allows us to apply a custom padding separate from the icon.

Note due to a bug in how core handles personal user items,
this will result in the icons temporarily disappearing for several
items until If399dfff9bbdd3b03b2ca702face3ec5164bef11 is resolved.
This is okay given the user menu is currently feature flagged.

Bug: T191021
Change-Id: I766aeb4d1bb36cebd0d80ad43ced940dbea96477
2021-07-01 14:25:46 -07:00
Jdlrobson 604e24f6be Partial Revert "Update tests for default Menu template value"
This partially reverts commit 0fc7be61c1.

Reason for revert: was temporary change

Change-Id: Iad87da825e44a7d3a64b85dc314d8eb27d95b7a6
2021-06-21 20:20:34 +00:00
bwang 0fc7be61c1 Update tests for default Menu template value
Change-Id: I32586a379cbacaad5cfb361facf79c01e982818a
2021-06-15 17:02:53 -05:00
Thiemo Kreuz 9213c514e6 Remove not needed $this->equalTo() from tests
This is the default anyway. I believe the tests are much more
readable without this.

Change-Id: I9f6c0d777ae5cd184acf40b1ef5b7b171dc3e675
2021-05-17 10:05:10 +02:00
jdlrobson 6998c536d4 Both UserMenu stylesheets should be shipped in modern
Since we have feature flagged the new user menu feature, it is
imperative we load both sets of styles until the feature has
shipped. This allows us to switch seamlessly between the two
without worrying about cached HTML being served with updated CSS.

To do this, we add a new class to both user menu's distinguishing
the legacy version from the modern version. The styles are then
scoped to these new selectors.

This also fixes some regressions with the legacy user menu in
modern Vector when wgVectorConsolidateUserLinks is disabled.

Notes:
* No caching selector is needed for #pt-userpage given it can only
ever be output for logged in users.
* ID selectors in general are bad, so scoping to mw-portlet-personal-user-menu-legacy
isolates the legacy component allowing it to be rendered alongside the modern UserMenu

Bug: T276561
Change-Id: I068c5233bb25a7b141e66a6726b5761841f83eb2
2021-05-14 10:13:09 -07:00
Nicholas Ray de5a640c0b Allow `languageinheader` query param to fully control treatment of languages
Before this commit the `languageinheader` query param would only take
effect if the A/B test was enabled AND the query param was set. Per
T282543, we want the query param to take effect regardless of the state
of the language/AB test config.

To see new treatment, set `languageinheader=1`.
To see old treatment, set `languageinheader=0`.

Bug: T282543
Change-Id: I6a06e90b6e46a6fd7506a5ddeaf071b893ebfe8e
2021-05-13 12:04:12 -06:00