Commit graph

32 commits

Author SHA1 Message Date
MusikAnimal 361741ec86 CodeMirrorWikiEditor: sync with textarea when using CodeMirror toggle
This was working before somehow… but according to the CodeMirror docs,
it never syncs with the textarea automatically, so regardless this is
a necessary safeguard at least.

Repro steps:
1) Have CodeMirror turned on
2) Open a page for editing
3) Add content
4) Toggle CodeMirror off

With this patch, it should now always be synced.

Also add selenium test to ensure this doesn't break again.

Bug: T317243
Change-Id: Ie44e62fe5838bf32f40c6a3595ec3f541380cfe1
2023-10-21 00:42:22 +00:00
Fomafix 6a37fedf73 Use $this->getServiceContainer() in tests and update class names
Consistently use
	$this->getServiceContainer()
instead of
	MediaWikiServices::getInstance()
in tests.

Also use namespaced classes
* MediaWiki\Output\OutputPage instead of OutputPage and
* MediaWiki\User\User instead of User.

Change-Id: I0cc39ba6cc706bf01581687e440ef9fb4ad39d81
2023-10-11 20:11:49 +00:00
MusikAnimal c0b01008a4 Add $wgCodeMirrorConflictingGadgets instead of checking wikEd directly
Since wikEd and DotsSyntaxHighlighter are both popular gadgets in and
outside WMF wikis, they are included in this setting by default.

Change-Id: If6c953858f9cf73024959b5a3b71b33ab7b48b4c
2023-10-11 01:33:35 -04:00
MusikAnimal d1cb5a0d01 CodeMirror: fix scrollToCaretPosition $.textSelection implementation
Add selenium tests for textSelection API.

Bug: T317243
Change-Id: I0904a715698aa235fb0744cbc4ff0f9787387592
2023-10-11 01:25:10 -04:00
MusikAnimal 880c690a10 CodeMirror6: add new modules, feature flag, and URL query parameter
Add a new $wgCodeMirrorV6 temporary feature flag that when enabled,
will load the 'ext.CodeMirror.v6.WikiEditor' module that is built
against CodeMirror 6. You can also pass in the ?cm6enable=1 query
parameter to force use of CodeMirror 6. This is currently only
implemented for the 2010 editor.

Due to packaging constraints with CodeMirror 6, we now use Webpack to
bundle the files, which are then used by ResourceLoader. This is similar
to what is done for Extension:Popups, MobileFrontend, among other
extensions.

A new generic class CodeMirror can be used on other areas where syntax
highlighting is desirable, but not necessarily for editing (i.e. without
WikiEditor).

This commit merely lays the foundation for CodeMirror 6 and updates
WikiEditor to use it. The actual MediaWiki syntax highlighting will come
with a future commit.

With the new Webpack build, the Gruntfile was removed and the tasks
moved to npm commands.

Bug: T317243
Change-Id: I2239d2449b2db3b638551f847eb4eff1aafa6276
2023-10-09 19:51:24 -04:00
gerritbot e1fb56e38e Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: I4ac93c24d2c90d51532fc3c39e60efbb4f8f8bfb
2023-08-19 13:12:12 +00:00
WMDE-Fisch 7a49382bdf Add Database group to tests
Tests that create a user account actually use the database and
most be marked as such or they will thow an exception.

See Ic4a72fbfaee730b8417848ae0603443d4995fefc

Change-Id: I827b536006130c9813a2a079eab01be112e691be
2023-08-09 10:51:58 +02:00
WMDE-Fisch 4bb409887d selenium: run tests concurrently
Includes a bit untangling of the setup. Concurrent tests should not
overwrite each others user settings so one of the tests gets it's
own user.

Bug: T337862
Change-Id: Iae245063932d4c5d9e6b61c1fe102505d70c1039
2023-06-30 11:29:32 +02:00
James D. Forrester 9e9a38d6fc Refactor CodeMirror WebdriverIO tests from sync to async mode
Bug: T300205
Change-Id: Idfcfc984833ca6ca6c09500cd4715a4e5504f84e
2023-06-06 10:49:22 +02:00
Tim Starling 7a3f46b490 Migrate ResourceLoaderCodeMirrorModule to a virtual file callback
Bug: T47514
Depends-On: I97d61b5793159cea365740e0563f7b733e0f16de
Change-Id: I31b80fc1c7701fc1075d655270706e341942415d
2023-05-05 16:26:09 +10:00
Umherirrender 818245a30f build: Updating npm dependencies
* eslint-config-wikimedia: 0.22.1 → 0.24.0

Change-Id: I576c1693596280e56b05ea6f485c1a995167112c
2023-03-25 22:37:01 +01:00
jenkins-bot 46b930ff28 Merge "Use @coversDefaultClass in test case" 2023-01-18 19:05:50 +00:00
Fomafix 81eb401a75 Use HookHandlers and inject services
Change-Id: Ia72968e53373d136efb75e6f82fb7bd27665f83d
2023-01-02 22:12:20 +00:00
Fomafix b1fa1d3dd7 Use @coversDefaultClass in test case
https://phpunit.readthedocs.io/en/9.5/annotations.html#coversdefaultclass

Change-Id: Ic2a1ddcd133b8d5ec653348ea56208a80568580a
2022-11-14 21:28:48 +00:00
Adam Wight 9f34c4d220 Remove $wgCodeMirrorEnableBracketMatching feature flag
Bug: T307188
Change-Id: Ibb21dea29c87d8fac898506c19f329273348c190
2022-06-13 10:34:41 +02:00
jenkins-bot 8fe0c1649a Merge "Use new ResourceLoader namespace" 2022-05-24 23:46:15 +00:00
Tim Starling 3a0c4b1f3e Use new ResourceLoader namespace
Extensions using Phan need to be updated simultaneously with core due
to T308443.

Bug: T308718
Depends-On: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659
Change-Id: I47dad71df97f38c55550f71baf6dae67dbe0a2ba
2022-05-20 12:34:29 +10:00
Umherirrender 0ce9a922dd Replace Action::getActionName by IContextSource::getActionName
Change-Id: Ica106d108f8930b93c9bbd4851d2915b40d7b343
2022-04-15 23:17:08 +02:00
Reedy 386bb03b01 Namespace extension
Change-Id: I83913927e86d44726d3a1c3a682cc1f6e2372f07
2022-02-06 15:16:42 +00:00
Thiemo Kreuz be08e04309 Reduce noise in syntax highlighting tests
* What we care about is the <pre>. The class="CodeMirror-line" is
  added to every <pre>. We don't really learn anything new when we
  include it in our tests.
* Testing the ARIA role is testing a CodeMirror feature, not a
  feature of the mediawiki mode under test.

Change-Id: I33bfedb304228240c4e835cc983117668c398c61
2021-12-16 06:53:47 +00:00
vladshapik 60b14d1aa0 Avoid using User::getOption() method
Replace User::getOption() with UserOptionsLookup::getOption() since this method will be hard-deprecated.

Bug: T296083
Change-Id: I405251092fd94fa70a33319d313c5140c8cebc21
2021-11-30 09:12:09 +00:00
Alexander Vorwerk 7550ec896b MediaWikiTestCase -> MediaWikiIntegrationTestCase
MediaWikiTestCase has been renamed to MediaWikiIntegrationTestCase in 1.34.

Bug: T293043
Change-Id: I0c1dcff1e637743828793b30ca2c4a5113e0fa31
2021-10-12 21:29:45 +02:00
sahil daeaae012c selenium: Update wdio-mediawiki
wdio-mediawiki v1.1.1:
- Includes wdio-defaults.conf.js file that vastly simplifies wdio.conf.js.
- Replaces @wdio/spec-reporter with @wdio/dot-reporter.
- Introduces video recording.

Bug: T283597
Change-Id: I88096682276de901e9a9f0d406b7b2e5ca2d8875
2021-06-21 19:36:43 +05:30
sahil 1b35a907d9 selenium: Update README.md file
Bug: T282237
Change-Id: I790cb97f0c6b274ff881c87b48a5693538538e14
2021-05-24 18:10:43 +00:00
Alexander Vorwerk 6bf535cffc Avoid using User::getOptionKinds()
User::getOptionKinds() is deprecated and should be replaced with UserOptionsManager::getOptionKinds()

Bug: T277600
Change-Id: Ie30ae74839f91aa48c53a5ebf680adb21eb9b047
2021-05-03 11:39:48 +00:00
WMDE-Fisch 9bea2a7905 Refine bracket matching styling
Adds a custom class for matched brackets to allow better integration
with custom bracket styles. The brackets won't be bold in the 2017WTE.
Bold font might lead to misalignment there. See ticket.

Note: box-shadow seems to be supported for quite some time by all
relevant browsers

Bug: T270926
Change-Id: Ica1e301f63a106a96db3bfaba4b2f322af64b009
2021-03-08 09:26:07 +01:00
libraryupgrader 37b851824d build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 34.0.0 → 35.0.0
* mediawiki/minus-x: 1.1.0 → 1.1.1

npm:
* eslint-config-wikimedia: 0.17.0 → 0.18.1

Change-Id: I9e4ed7d632072b303d0dcb4135a5ecaaf4b68685
2021-01-29 06:50:49 +00:00
Thiemo Kreuz 26f41000a8 Fix failing new WikiPage() call
Apparently this started to fail when the first character is not
capitalized.

Change-Id: Id9233984095652560cd473a33721f9835497b13b
2021-01-27 08:42:19 +01:00
Adam Wight 27f964e240 Browser tests for CodeMirror (wikitext 2017 editor)
Bug: T270240
Change-Id: If1a2530e428122713277fbe87cd015cb729ab550
Depends-On: I2ba889e1a5dd03549d8d7cb00678a30882ff03fe
2021-01-11 12:47:49 +01:00
Adam Wight d6c6dbd73a Browser tests for CodeMirror (wikitext 2010 editor)
Basic tests to show that the highlighting classes have been attached
to the expected elements.

TODO in later patches:
* tests for the wikitext 2017 editor

Bug: T270240
Change-Id: I01ebd9881d38dd877f19ee3bb4fdcbb74d43afaf
2021-01-08 11:01:13 +01:00
Thiemo Kreuz ff1c26e877 Add missing PHPUnit tests for better coverage
Change-Id: I242aa52a24a11de3db106e5e2c73bd6f2a95d80c
2020-10-08 10:18:45 +02:00
Max Semenik c8f75d5ac5 Restore GetPreferences hook handler registration
Accidentally removed in I1ad451acfd1

Bug: T198537
Change-Id: I71788de31a23373f4e0528211ce3ec89fc5f9d3b
2018-07-03 14:25:01 -07:00