mediawiki-extensions-Discus.../tests/data
Bartosz Dziewoński 4613ae78e7 Change CommentParser into a service
Goal:
-----
To have a method like CommentParser::parse(), which just takes a node
to parse and a title and returns plain data, so that we don't need to
keep track of the config to construct a CommentParser object (the
required config like content language is provided by services) and
we don't need to keep that object around after parsing.

Changes:
--------
CommentParser.php:
* …is now a service. Constructor only takes services as arguments.
  The node and title are passed to a new parse() method.
* parse() should return plain data, but I split this part to a separate
  patch for ease of review: I49bfe019aa460651447fd383f73eafa9d7180a92.
* CommentParser still cheats and accesses global state in a few places,
  e.g. calling Title::makeTitleSafe or CommentUtils::getTitleFromUrl,
  so we can't turn its tests into true unit tests. This work is left
  for future commits.

LanguageData.php:
* …is now a service, instead of a static class.

Parser.js:
* …is not a real service, but it's changed to behave in a similar way.
  Constructor takes only the required config as argument,
  and node and title are instead passed to a new parse() method.

CommentParserTest.php:
parser.test.js:
* Can be simplified, now that we don't need a useless node and title
  to test internal methods that don't use them.

testUtils.js:
* Can be simplified, now that we don't need to override internal
  ResourceLoader stuff just to change the parser config.

Change-Id: Iadb7757debe000025e52770ca51ebcf24ca8ee66
2022-02-19 19:51:57 +01:00
..
arwiki-config.json Use tabs for indentation in JSON test files 2021-01-27 00:25:15 +00:00
arwiki-data.json Use tabs for indentation in JSON test files 2021-01-27 00:25:15 +00:00
ckbwiki-config.json Use tabs for indentation in JSON test files 2021-01-27 00:25:15 +00:00
ckbwiki-data.json Use tabs for indentation in JSON test files 2021-01-27 00:25:15 +00:00
commonswiki-config.json Add another test case for transclusions overlapping comments 2022-01-17 23:52:02 +01:00
commonswiki-data.json Add another test case for transclusions overlapping comments 2022-01-17 23:52:02 +01:00
enwiki-config.json Use tabs for indentation in JSON test files 2021-01-27 00:25:15 +00:00
enwiki-data.json Use tabs for indentation in JSON test files 2021-01-27 00:25:15 +00:00
frwiki-config.json Use tabs for indentation in JSON test files 2021-01-27 00:25:15 +00:00
frwiki-data.json Use tabs for indentation in JSON test files 2021-01-27 00:25:15 +00:00
huwiki-config.json Use tabs for indentation in JSON test files 2021-01-27 00:25:15 +00:00
huwiki-data.json Use tabs for indentation in JSON test files 2021-01-27 00:25:15 +00:00
itwiki-config.json Use tabs for indentation in JSON test files 2021-01-27 00:25:15 +00:00
itwiki-data.json Use tabs for indentation in JSON test files 2021-01-27 00:25:15 +00:00
nlwiki-config.json Use tabs for indentation in JSON test files 2021-01-27 00:25:15 +00:00
nlwiki-data.json Use tabs for indentation in JSON test files 2021-01-27 00:25:15 +00:00
plwiki-config.json Use tabs for indentation in JSON test files 2021-01-27 00:25:15 +00:00
plwiki-data.json Use tabs for indentation in JSON test files 2021-01-27 00:25:15 +00:00
README.txt Change CommentParser into a service 2022-02-19 19:51:57 +01:00
srwiki-config.json Use tabs for indentation in JSON test files 2021-01-27 00:25:15 +00:00
srwiki-data.json Use tabs for indentation in JSON test files 2021-01-27 00:25:15 +00:00

Minimal overrides for LanguageData::getLocalData() and mw.config
required for us to be able to parse HTML generated by the given wiki.

To make one of these files, run the following in browser console:

config.json:
  JSON.stringify( mw.config.get( [ 'wgContentLanguage', 'wgArticlePath', 'wgNamespaceIds', 'wgFormattedNamespaces' ] ), null, '\t' )

data.json:
  JSON.stringify( mw.loader.require( 'ext.discussionTools.init' ).parserData )