Commit graph

414 commits

Author SHA1 Message Date
jenkins-bot b98e0a0017 Merge "Allow disabling of night mode on certain pages via config" 2024-03-29 08:03:00 +00:00
Steph Toyofuku feb8cc90dc Allow disabling of night mode on certain pages via config
* Using the new ConfigHelper, support disabling night mode on certain
pages via configuration options
* In addition, adds test coverage for this case and the query parameter
case (in a new integration test file as we now require accessing the
service container for request context)
* Finally, supply a default configuration in skin.json with all the
values set to null

For the easiest possible approach while we evaulate our general feature
management system, this logic is handled inside of getFeatureBodyClass
using the new shouldDisable general function.  In the future, it may
make sense to break this out into its own requirement class, but for now
that feels premature

Bug: T359606
Change-Id: I3e7a4720ec3cc2afd9777e36f59aa56b682258f0
2024-03-28 16:37:30 -07:00
Steph Toyofuku 3387ef3ee4 Add tests for ConfigHelper
This class is being used in both vector and minerva, and we are
currently depending on it working for our night mode rollout, so let's
add some test coverage!  Also fixed a small spacing issue in production
code that was bothering me lol

Note: these are not totally exhaustive - next steps would be to ensure
that the exclusions/inclusions work with arrays and not only single
elements, but hopefully this helps build some confidence ☺️

Change-Id: Iebea43eae6b1517fd778763db4f5db3b0fd9c30f
2024-03-27 16:49:39 -07:00
jenkins-bot e7a6fe9b12 Merge "Type hint UserIdentity in Requirements/Components" 2024-03-18 05:58:30 +00:00
Jon Robson a67a260451 Restore budget test with better guidance and special case FlaggedRevs
Restore the budget test with better guidance on the process to
handling this issue.

Bug: T360102
Change-Id: I1ca80945e2ef49604a85e1bec6004f30ad13924d
2024-03-14 11:47:54 -07:00
Muhammad Jaziraly be0e56bb73 Skip PerformanceBudgetTest::testTotalModulesSize
Unblocks CI for Wikibase extension.
CI failed in I824acad352c366a35a243dac2086e3c5e98bc6eb

Bug: T350338
Change-Id: Id9926ff9a60cb0cac56a612a792d5ffde55c4c63
2024-03-14 09:06:34 +00:00
Umherirrender 558359c06d Type hint UserIdentity in Requirements/Components
Only id or registered state is needed.

Change-Id: I184db486ed2763e0402fe75ed9afb0e71a0d57c6
2024-03-13 21:59:40 +01:00
jenkins-bot c38e0677c3 Merge "Migrate uses of codex-search in Vector to use CodexModule" 2024-03-13 16:27:55 +00:00
Moh'd Khier Abualruz 182bb7519b Migrate uses of codex-search in Vector to use CodexModule
- Loaded new skins.vector.search.codex.scripts module in skin.json, with only the CdxTypeaheadSearch component with codexScriptOnly flag set to true.
- Included skins.vector.search.codex.scripts in the script loading configuration for Vector22 within skin.json.
- Turned off the "interface-message-box" feature within Vector22's skins.vector.styles configuration in skin.json, as Codex now supplies these styles.
- Fix the style selector to add `.cdx-button` to `.vector-limited-width-toggle` in BottomDock.less since using the codex style
- Substituted "codex-search-styles" with "skins.vector.search.codex.styles" in the existing configuration.
- Ensured the availability of skins.vector.search.codex.scripts module for use, marking it in the list of modules in skin.js.
- Modified App.vue to utilize skins.vector.search.codex.scripts instead of @wikimedia/codex-search.
- Update App.test.js.snap to the latest output form
- Update bundlesize.config.json with newest values

Bug: T356677
Change-Id: I7fc223db01171efe6656792530d4b625be4c8edc
2024-03-13 15:58:26 +00:00
Umherirrender 7afaa93ab2 build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0
Change-Id: Ic8e1a7bc4bab091b0e959deae5258181fc54891b
2024-03-12 20:51:09 +01:00
jenkins-bot 06ed0b8e19 Merge "Create a FeatureManagerFactory" 2024-03-11 07:24:06 +00:00
Umherirrender ea4fd5d182 Create a FeatureManagerFactory
Some feature requirements needs access to the request user or title.
Currently the context is given in the ServiceWiring callback,
access to RequestContext::getMain() should be avoided during service
wiring (T218555).
Create a factory to hold the code from the service wiring and call the
factory with the request context from the skin to get a feature manager.

Bug: T359665
Change-Id: I57515ec02ed454620f729a109d0ace43b447b6ce
2024-03-08 20:28:31 +01:00
Fomafix 9d1819f4ec Inject services in Hooks
Change-Id: Ice931a7596c73781f05265d96e0086729402ae63
2024-03-07 20:23:51 +00:00
Fomafix e423bf9a45 Use overrideConfigValue/overrideConfigValues instead of setMwGlobals
Change-Id: Ic5b008c3e75226946fe1c6ffd3580303072b38d2
2024-03-06 20:17:36 +00:00
Fomafix fe449821c8 Use $this->getServiceContainer() in tests
Use
	$this->getServiceContainer()
instead of
	MediaWikiServices::getInstance()
in tests.

Change-Id: Id614ed8948fff75991ecf2c805707bc7f16f36a6
2024-03-01 15:31:49 +00:00
bwang 230c837052 Remove language notice
Bug: T353619
Change-Id: I75430c8b1e66158f798fbe27eec4942a089f3931
2024-02-29 17:04:16 -06:00
jenkins-bot 450b84603e Merge "Add PHPUnit tests for VectorComponentMainMenu" 2024-02-27 00:50:27 +00:00
jenkins-bot 2470c2b332 Merge "Add PHPUnit tests for VectorComponentMainMenuAction" 2024-02-12 22:14:14 +00:00
jenkins-bot 533b83a863 Merge "test: Add PHPUnit tests for LanguageService" 2024-02-12 17:06:07 +00:00
Doğu Abaris 1b692aef4d test: Add PHPUnit tests for LanguageService
Adds tests for LanguageService in Vector skin.
Covered:
- `testConstruct`: Validates property initialization.
- `canWordsBeSplitSafely`: Tests that the language is splittable or not.

Change-Id: Icc1c269c56e0e53c624074516aee95ba242a55d7
2024-02-12 16:25:43 +00:00
Doğu Abaris 71f9552bb2 Add PHPUnit tests for VectorComponentMenu
Adds tests for VectorComponentMenu in Vector skin.
The test suite includes the following validations:
- Constructor initialization with expected parameters and behaviors.
- Validate counting logic for menu items.
- Validates `getTemplateData` method's output for correctness.

Change-Id: Ia52aa70e9213f6627d063d520fdbb2e353f0bfcb
2024-02-10 09:16:39 +00:00
Doğu Abaris fab1b342e0 Add PHPUnit tests for VectorComponentMainMenu
Adds tests for VectorComponentMainMenu in Vector skin.
The test suite includes the following validations:
- Constructor initialization with expected parameters and behaviors.
- Correct identification of 'is-pinned' state
- Inclusion of data for first portlet and rest portlets
- Handling of pin/unpin actions and language alert considerations
- Proper integration of menu elements based on user and feature flags

Change-Id: Ie408ff668893d1de2cf9dd1211a9c82c0b882f99
2024-02-10 01:38:59 +00:00
Doğu Abaris f1c6c828a9 Add PHPUnit tests for VectorComponentMainMenuAction
Adds tests for VectorComponentMainMenuAction in Vector skin.
The test suite includes the following validations:
- Constructor initialization with expected parameters and behaviors.
- Validates `getTemplateData` method's output for correctness.

Change-Id: I5deda64dc1bd3db85df69d0bb5a5a27f6fb8c1ff
2024-02-10 01:38:47 +00:00
Doğu Abaris 6212b8feac Add PHPUnit tests for VectorComponentLanguageDropdown
Adds tests for VectorComponentLanguageDropdown in Vector skin.
The test suite includes the following validations:
- Proper handling based on page type (subject/talk).
- Correct labeling and icon selection.
- Accurate class and aria label configuration.

Change-Id: I145cb250c513f3f81e780195485907897788f5c4
2024-02-10 00:20:12 +00:00
Doğu Abaris cd032f4c4c Add PHPUnit tests for VectorComponentDropdown
Adds tests for VectorComponentDropdown in Vector skin.
The test suite includes the following validations:
- Correct template data generation.
- Proper label, tooltip, and icon handling.
- Accurate CSS class construction for various states.

Change-Id: Iafd28cfe62eb4b8c6039f819b9d8f005b0b32d48
2024-02-07 10:40:26 +00:00
Doğu Abaris 4b1a4726a0 Add PHPUnit tests for VectorComponentClientPrefs
Adds tests for VectorComponentClientPrefs in Vector skin.
The test suite includes the following validations:
- Both pinned and unpinned states
- Correct structuring of 'data-pinnable-header'

Change-Id: I745559b2f738b4bed0f152fc8de3af1653b96ecd
2024-02-07 10:18:11 +00:00
Doğu Abaris 880ae42fde Add PHPUnit tests for VectorComponentButton
Adds tests for VectorComponentButton in Vector skin.
The test suite includes the following validations:
- Various button configurations and expected CSS classes.
- Accurate template data for label, icon, href, and custom attributes.
- CSS classes according to weight, action, and iconOnly.

Change-Id: I228c197e5adee59a79ab6e2aad74ff0f18ef6b38
2024-02-07 00:21:14 +00:00
Doğu Abaris 4775215a5c Add PHPUnit tests for VectorComponentPinnableHeader
Adds tests for VectorComponentPinnableHeader in Vector skin.
The test suite includes the following validations:
- Correct template data generation based on constructor parameters.
- Accurate label generation from MessageLocalizer.
- Conditional logic for 'moveElement' affecting container ID attributes.

Change-Id: I2412c86e08dfca088ca57330b4dd078c212513f9
2024-02-07 00:11:15 +00:00
Doğu Abaris be11774875 Add PHPUnit tests for VectorComponentPinnableContainer
Adds tests for VectorComponentPinnableContainer in Vector skin, ensuring:
- Proper initialization with ID and pin status.
- Correct template data based on init params.
- Consistent template data for pinned/unpinned states.

Change-Id: Iec33c11b0afbe2bea5b6708b83b9ea618f7e809b
2024-02-06 23:41:35 +01:00
Doğu Abaris 8353c535c6 Add PHPUnit tests for VectorComponentPinnableElement
Adds tests for VectorComponentPinnableElement in Vector skin, ensuring:
- Proper instantiation with an ID parameter.
- Correct return of template data containing the ID.
- Reliability in handling element ID for use in templates and UI.

Change-Id: I3758f042ad43b90ee94a3b5aa14537fa1b0657d1
2024-02-06 23:41:35 +01:00
Doğu Abaris 2414a69730 Add PHPUnit tests for VectorComponentLink
Adds tests for VectorComponentLink in Vector skin, ensuring:
- Initialization with parameters.
- Generation of html-attributes string with title and aria-label.
- Consistency in link attributes for accessibility and UX.

Change-Id: I80b8a84d1d10bc7274ba5267910206d7f6e68534
2024-02-06 23:41:35 +01:00
Doğu Abaris b4064a5aa5 Add PHPUnit test for LoggedInRequirement
Change-Id: I9724513399bc3d2c1b62365fdad13d51ce68623b
2024-02-06 04:09:04 +01:00
Doğu Abaris 348e6f6cc8 Refactor and clean up FeatureManagement classes
This commit introduces several changes to improve the structure and
readability of the FeatureManagement code in the Vector skin. Key
changes include:

- In ABRequirementTest.php, improved test method names for clarity.
- In ABRequirement.php, simplified property declarations and cleaned up
  code structure.
- In DynamicConfigRequirement.php, cleaned up property declarations.
- In LimitedWidthContentRequirement.php, cleaned up property
  declarations and added type hints.
- In LoggedInRequirement.php, cleaned up property declarations.
- In OverridableConfigRequirement.php, cleaned up property declarations.
- In OverrideableRequirementHelper.php, cleaned up property declarations.
- In SimpleRequirement.php, cleaned up property declarations.
- In UserPreferenceRequirement.php, cleaned up property declarations.

Each change aims to enhance the codebase's maintainability and
understandability. No functional changes were introduced.

Change-Id: I23283c5a6799b1f03a6a9b5832c34c7dbbcca527
2024-02-06 00:37:14 +00:00
bwang c893934ee7 Fix linter warnings
Change-Id: I24c3ecb7858142dc1b90cf1e34456691660157f1
2024-01-29 17:06:53 +00:00
Jon Robson 8c49b1eb49 Client preferences supports toggle switches
Bug: T350418
Change-Id: I359924874e7232eaee73b7dc3678b9e8e26794ac
2024-01-19 12:56:27 -08:00
Jon Robson 7d5caf3f66 Generalize skins.vector.clientPreferences library for use in MobileFrontend
Bug: T354224
Change-Id: I6949c4f49ec34b8e47036da4222a5f3ff491af32
2024-01-17 14:51:29 -08:00
jenkins-bot 23d1927e92 Merge "build: Upgrade eslint-config-wikimedia from 0.25.1 to 0.26.0" 2024-01-12 01:47:30 +00:00
Umherirrender 829fb38450 VectorComponentPageTools: Remove unused User
Usage was removed in 448a9066

Follow-Up: Idca2ccfe4aeef0a2ac0970f7baf54849a64a4070
Change-Id: I001805e955711c8343097f72370719310f63ed94
2024-01-11 23:00:37 +01:00
James D. Forrester 1c93d0514b build: Upgrade eslint-config-wikimedia from 0.25.1 to 0.26.0
Bug: T345100
Change-Id: I51fdef33d517ce4f2f50930bc46dddb2f497677c
2024-01-11 14:19:57 -05:00
Umherirrender f8ffcd20d2 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statements done manually

Change-Id: I9b8f447ea4d715bc815cc782184bca288ee001a0
2024-01-02 20:54:08 +01:00
Fomafix 981555e528 Use MediaWiki\ResourceLoader\Context instead of ResourceLoaderContext
ResourceLoaderContext is deprecated since 1.39.

Change-Id: I466cd4d0c9dcd17fe7de95959a64db5459e288e1
2024-01-02 10:44:10 +00:00
gerritbot 51a0275250 Update UserOptionsManager's FQN
User-options related classes are being moved to
the MediaWiki\User\Options namespace in MediaWiki Core;
reflect that change here.

Bug: T352284
Depends-On: I9822eb1553870b876d0b8a927e4e86c27d83bd52
Change-Id: Ie1ab46338a660686394c79f49f21e6c1e0fa4a0a
2023-11-29 14:39:54 +00:00
gerritbot febf3e635e Update UserOptionsLookup's FQN
User-options related classes are being moved to the MediaWiki\User\Options namespace in MediaWiki Core; reflect that change here.

Bug: T352284
Depends-On: I9822eb1553870b876d0b8a927e4e86c27d83bd52
Change-Id: I084e01a29884f338fae22d7239d068823a2657c3
2023-11-29 12:42:02 +00:00
Moh'd Khier Abualruz e480bfa2b5 Update theme icon for client preferences in user links
- Add appearance.svg file and classes
- Update the icon name in php
- Update icon name in test data and Snapshot

To test: change return value of
  isClientPreferencesPinned() from SkinVector22
  PHP Class to false

Bug: T351142
Change-Id: If61f3019430be3cb9c926b09bc397e27d8e636f2
2023-11-24 15:01:35 +00:00
bwang d2b413a721 Make client prefs fully pinnable
Bug: T351141
Change-Id: Ic4a166fb3234b27dbf3d37891abfdf15781c8867
2023-11-22 14:39:28 -06:00
Jon Robson 845a0ab71d Make the limited width and font size controls work for logged in users
For time being manage classes inside Vector. Document with FIXME and a
test.

Bug: T351447
Change-Id: Icc084a59a0141ec2b7c772cf92e8cc58c11f15b1
2023-11-21 02:16:52 +00:00
Jon Robson 9d054339db PerformanceBudget: Remove FlaggedRevisions workaround
With I1e45d0dacf58b2e03886d3b986309e13e754e324 this should no
longer be needed as the styles are now restricted to reviewers and
the default user is not a reviewer

After merging this change, please confirm that any open
FlaggedRevisions patches pass Jenkins CI.

Change-Id: I53e3f2c15ad6797f39747e5bc00039582edb8f61
2023-11-14 17:25:56 +00:00
Jon Robson 07a26a9448 Refactor VectorComponentUserLinks to not use hooks
Bug: T350195
Change-Id: I6cbf45587475f0477657a7ce9309b2cd42da33c1
2023-11-09 17:32:10 -08:00
Moh'd Khier Abualruz 9f35fd8d56 Vector PerformanceBudgetTest::testTotalModulesSize CI break
- Account for 10 Kbs in the case wikibase is enabled for scripts budget
- Message generation centralised function
- Added bundlesize.config.json file path to message.
- Update the message to show in Kbs

Bug: T350338
Change-Id: I8490cd7aa4468b54bab05960c8c594093167cb72
2023-11-07 17:15:59 +00:00
Leszek Manicki 72ec5037cf Skip PerformanceBudgetTest::testTotalModulesSize
The tests breaks CI for multiple extensions.

Bug: T350338
Change-Id: Id4879c3a8f53f7e59b9c04bfae3af11fe42a307c
2023-11-07 10:12:44 +01:00