Commit graph

56 commits

Author SHA1 Message Date
jenkins-bot 657b81abd2 Merge "Add basic test coverage for all CiteHooks code" 2019-11-11 19:24:06 +00:00
jenkins-bot 15a84769b8 Merge "Test cleanup: drop equalTo" 2019-11-11 12:43:04 +00:00
jenkins-bot 62ca80536e Merge "Block all combinations of refines="…" and follows="…"" 2019-11-11 12:37:34 +00:00
jenkins-bot 6b7d6ebd10 Merge "Merge bookReferencingUnimplemented.txt into bookReferencing.txt" 2019-11-11 12:37:33 +00:00
Adam Wight bde9e175a8 Test cleanup: drop equalTo
Can use a shortcut where we pass the expected value directly.  Verified
that we're still asserting equality.

Change-Id: I63512488c50e599df23d5dae2a5064218e311e90
2019-11-11 12:57:09 +01:00
Thiemo Kreuz fe385ecc37 Block all combinations of refines="…" and follows="…"
Note it doesn't make a difference if this is behind the feature flag or
not. It should always be forbidden, and in fact is: Either the follows
attribute is unknown, or the combination is forbidden.

Bug: T236256
Change-Id: Iebbb2d1d5bab183ab0590b8a7a7f6e79d319b72c
2019-11-11 12:56:58 +01:00
Thiemo Kreuz d919615e28 Merge bookReferencingUnimplemented.txt into bookReferencing.txt
What we find critical is:
* That all tests relevant for book referencing are in a separate file.
* That unimplemented stuff is marked with TODOs.

Not having to move tests to another file allows for nice diffs.

I tried to order the tests as good as I could. E.g. have all tests with
a group="…" next to each other, followed by all with a follow="…".

Change-Id: Idc1d9e7843b341235ab3d8ebe398e01946eb1845
2019-11-11 12:50:51 +01:00
Adam Wight b7a7457ffd Add page property when parsing book reference
Any time the book referencing attribute is used in a page,
permanently tag that page with the `ref-extends` property, so
that it can be watched and cleaned up if necessary.

Bug: T237531
Change-Id: Ice5d9d8f7a305702cdc7c2a55d4147c4f79b5881
2019-11-11 11:06:31 +01:00
Thiemo Kreuz ae01d35bf2 Add basic test coverage for all CiteHooks code
This also updates an existing test to cover all trim() in the code.

Change-Id: I0f0b4f8154004f941f4eaa5a9b2c3be0598fb137
2019-11-08 15:59:01 +01:00
jenkins-bot f62acf7e89 Merge "refArg parses and returns the refines attribute" 2019-11-08 12:01:33 +00:00
jenkins-bot 1eaedd98c2 Merge "Split out BookReferencing parser tests" 2019-11-08 11:56:39 +00:00
Adam Wight 5ac57def59 refArg parses and returns the refines attribute
Incremental patch which extracts the refines attribute from the tag.
Doing this now to allow the calling function to have responsibility
for doing something with the attribute value.

Bug: T237531
Change-Id: I59bb409bedd8e6ed06268e705e02e8ffb45b1f0e
2019-11-08 12:30:12 +01:00
jenkins-bot e9383f3cf4 Merge "Add dedicated unit test for Cite::refArg()" 2019-11-08 09:44:30 +00:00
Adam Wight 0ebf86fdf3 Split out BookReferencing parser tests
Encapsulate the feature tests in dedicated files.  These are picked
up by the test runner for matching glob `tests/parser/*.txt`, as can
be shown by,

  phpunit.php --testsuite parsertests --filter=bookRef

Also adds TODO comments to some tests, documenting how the current output
will not match the fully implemented code's results.

Bug: T236256
Change-Id: Ie3e769c84856256180754aeff417da893a84b479
2019-11-08 10:02:38 +01:00
Andrew Kostka 1dcb096776 Add parser tests for refined references as rendered right now
These tests document the current status quo, and are meant to change
with every patch that makes the code for refined references more
feature complete.

Bug: T236256
Change-Id: I8c11b1decc36b86e7f7d1919cc39d0c16a200055
2019-11-08 09:38:08 +01:00
Thiemo Kreuz 7965659b82 Add dedicated unit test for Cite::refArg()
Again, this is intentionally testing a private method.

Change-Id: I559b88e38f7a7a4128ba0b16ff3de42f2fab2055
2019-11-07 13:14:05 +01:00
Thiemo Kreuz 64c94662f0 Add the first small PHPUnit test for Cite::normalizeKey()
Note this is intentionally testing a private method. As of now, the
code is so heavily entangled, it's not yet possible to test individual
aspects without calling private methods. The plan is to slowly increase
the overall test coverage, and the start restructuring the code as
necessary.

Change-Id: Ib3b01bddaffd0469fb66979c67c8114a5807df6d
2019-11-07 09:23:13 +00:00
Adam Wight 5e8d48b331 Minimal support for bookreferencing tag
Allows the "refines" attribute when the feature flag is set, but doesn't
render.  This is part of our rollback strategy, so that we aren't left
with invalid wikitext in case of undeployment.

Bug: T236257
Change-Id: I936be0e62dccb46caeb84162d2c5166956fd9916
2019-10-24 12:24:36 +00:00
WMDE-Fisch 2f12ae1de4 Use waitForModuleState from Util class
Change-Id: I661aaa08cd48ab48435208323b50108be418815c
2019-10-24 10:48:32 +02:00
Ed Sanders f6950bcdc1 build: Update linters
Change-Id: I016f880e4e44a4550b9236d7c1701615203f4486
2019-10-07 16:24:49 +01:00
Fomafix 70b6a48db7 Remove parser test with mw-editsection
This change allows to change the editsection HTML by
I305e3313ca2f931a2ea9cee34194b8cb93b90b0e without failing in Jenkins.
The parser test gets restored in the new format by the follow-up change
Ibb4341b405f0d6fa6883c992c5dd3a9e594c9efc.

Change-Id: I337d7f7c0cd134a3766343565e2c30edf1d70f7e
2019-05-08 19:21:03 +02:00
Adam Wight 9347dfeb6d Test rendering of high-ascii reference names
Bug: T220196
Change-Id: I2423e0908154a9eb3ecd687945d934269255a939
2019-04-19 17:10:53 -07:00
WMDE-Fisch 7e8cf11648 Increase stability of backlink browser tests
Adding a step to wait for loaded modules. This was manily taken from
the Popups-extension browser test, but with a fixed chain for the
results.

Let's hope we do not need to pause with this.

See as well I274bdee0b3c39c418a2b61881d56f89889c53485

Bug: T220318
Change-Id: I5bdc1951a23a51e9a4deea69af2bfc96843f5a1d
2019-04-08 17:42:48 +00:00
WMDE-Fisch b6075be8ec Removing Special:Version test
This is not really testing anything from the Cite extension.

Change-Id: Iea8244527bfdbd21053a4f67295edc924c9ae725
2019-04-08 14:58:27 +02:00
WMDE-Fisch 3c855ea4cd Add test for broken up-arrow back links
Bug: T217767
Change-Id: Ib8c8e7d6cc286aaabd73f3e2b6fb02cb5f62eff2
2019-03-26 13:35:19 +00:00
Arlo Breault c735c9021f Sync up with Parsoid citeParserTests.txt
This now aligns with Parsoid commit 94b8b491098f882582f372218df07f5b68f4eba1

Change-Id: Ic357d36d3643fbead6f7e1c0a03aaefb5b7e005c
2019-03-19 11:40:14 -04:00
jenkins-bot aa2bf473de Merge "Update tests to match parser changes" 2019-03-19 14:18:40 +00:00
Kunal Mehta 45c01a6b78 Upgrade to newer phan
Bug: T216911
Change-Id: Ib228ac26a9a87c51a107407b6162110681b5e75c
2019-03-17 16:46:06 -07:00
Arlo Breault 2528762640 Update tests to match parser changes
Bug: T208070
Depends-On: I3da235cb83efa424f0cf1cf4fc7233240fcdf6b2
Change-Id: I6119b4af9632496dbda81c3a3951c55217e7c2d5
2019-03-15 18:23:43 +00:00
Subramanya Sastry c23cd59a53 Sync up with Parsoid citeParserTests.txt
This now aligns with Parsoid commit 2c0770eb3b441800b74651cf415de1edf29a5a5e

Change-Id: I0a28bbe9db3a7b8d09c14a2e6c1ad0d94c1591f6
2019-01-02 11:31:42 -06:00
Gilles Dubuc ad559d4add Fix test for img decoding="async"
Bug: T212124
Depends-On: I79de6f3b0ec5529881525d32925519b47fed5311
Change-Id: I9bd9e24453838130eeb221c2f09961e1c4c15938
2018-12-20 13:42:30 +01:00
Thiemo Kreuz 3f22189998 Fix <ref> ignoring all parameters when there are more than two
We can resolve this bug by either replacing the bogus "return false"
with the intended "return [ false, … ]". Or rely on the code a few
lines below that also bails out with a "return [ false, … ]" when to
many parameters ($cnt is not 0 then) are present. The tests prove both
solutions are equally valid.

Bug: T211576
Change-Id: Iadd55c134dede7042cfd152c69bc8f27b59d8912
2018-12-11 20:49:40 +01:00
jenkins-bot 9e981d28b6 Merge "Sanitize underscores as core does, to not create broken links" 2018-12-11 00:01:57 +00:00
Thiemo Kreuz 9a8c718c2a Add missing test cases for code in Cite::refArg
This is split from I642d38e and does nothing but adding test cases
that document the current (broken) behavior.

Bug: T211576
Change-Id: Iee313d26e7bed6deb34101e37736a1c697947905
2018-12-10 12:54:58 +01:00
jenkins-bot c6e13db74f Merge "Simplify weirdly complex [\n\t ] regex" 2018-11-30 23:50:55 +00:00
Ed Sanders fdde5b71af Update eslint-config-wikimedia to 0.9.0
Change-Id: I7883af1f56c7f2f3eeff1f7a51b640a303bcab78
2018-11-27 22:23:57 +00:00
Thiemo Kreuz (WMDE) 7c06347fc7 Simplify weirdly complex [\n\t ] regex
This change does have two consequences:

1. A few more whitespace characters act as separators. This should not
have any consequence in real life situations, and is mainly done to
make the code easier to read and less surprising.

2. Sequences of two or more whitespace characters previously resulted
in partly *empty* results. This was a potential source of errors. The
additional + fixes this.

Change-Id: Ib58326109c740dd0cbd05d8fddb4af2145f232fe
2018-11-21 17:33:25 +00:00
WMDE-Fisch 89deb7ca4c Add browser tests for linking the main backlink
This also includes putting the backling tests in their
own file due to the common setup needed.

Bug: T205271
Change-Id: Ica98c31bf0fddde9eb80f9c53b3dc089cb60e30c
2018-11-20 13:21:30 +01:00
Thiemo Kreuz (WMDE) 2b34dede6c Sanitize underscores as core does, to not create broken links
Core sanitizes link targets and removes double spaces and underscores.
But the corresponding id="…" attributes are not sanitized the same
way. This results in broken links. This patch is not perfect (two
references with name="a_b" and name="a__b" will conflict), but the
best solution I can think of at the moment.

Bug: T184912
Change-Id: I9dbc916ad99269517d84c8ffb8581628d44a9f4e
2018-11-20 13:07:35 +01:00
WMDE-Fisch 9c4620966f Add browser test for highlighting of jump mark symbols
Bug: T205270
Change-Id: Ieccf2c507dafac70d287eb0fa0fff051442205da
2018-11-19 16:08:49 +00:00
Andrew Kostka 626d9d4188 Add first browser test
This adds a test which checks if the extension appears on the
Special:Version page.

This is an initial step for adding more browser tests to check
changes done in I26fe41c328157233cc5b06d38d2ba0f7b036a853

Change-Id: I9a9d1cd2a25277f2c430f4e80b51b72c1621f91b
2018-11-19 16:08:42 +00:00
Arlo Breault 1d687e23f3 Use the dir parameter only from the full definition of a named ref tag
Bug: T196827
Change-Id: Iaf84966e37cea730c9eca07c19a555971ffeadf3
2018-08-22 19:31:23 -04:00
Arlo Breault 97f346438c Sync up with Parsoid citeParserTests.txt
This now aligns with Parsoid commit 129d71f5d6eab8c87a0e6591fcad4ad5e55b8da2

Change-Id: If2f540f0adf317eaa3cac7d0413c6bde8adc58e7
2018-08-17 15:45:23 -04:00
Eranroz 1ca27aa0d8 Support directionality for reference
Adding option for dir attribute in ref tags. The value must be a valid
direction ('ltr' or 'rtl', case insensitive) or the direction will be
stripped out.

The directionality of the li element is set using a css class accordingly.

Bug: T15673
Change-Id: Iff480bc8cc4f81403b310e8efecd43e29d1d4449
2018-05-02 17:27:32 +02:00
C. Scott Ananian 5433d46bb8 Sync up with Parsoid citeParserTests.txt
This now aligns with Parsoid commit 7d2a92f81ebbc0941e8fba2a136f5929406ea5e6

Change-Id: Ie7354c9c36f8532dfa36e5ab5a2a4c01fae65b69
2018-03-07 02:23:38 -05:00
Kunal Mehta a068a3a379 Migrate to mediawiki-phan-config
Change-Id: I463500bf14e15a9127d02d5d7104ea4571dc9a30
2018-02-15 12:38:56 -08:00
Kunal Mehta 1e6ff5c2fc Address PhanUndeclaredClassMethod warning
Don't use the \Database alias, use the namespaced version when calling
Database::getCacheSetOptions.

And document why the remaining issue is suppressed.

Change-Id: I80a102f2e82efedcfa999d8e714bfe049263ffeb
2018-01-03 16:34:01 +00:00
Phantom42 67ed343ecc Add phan configuration for static analysis
Bug: T179554
Change-Id: I2bfd52c08aac1aa8f34e0664e6314835f79a0324
2017-12-29 11:50:01 -08:00
C. Scott Ananian 0e8f1c961f Sync up with Parsoid citeParserTests.txt
This now aligns with Parsoid commit 0723e5c47845ff4361b9635b591e7d386c975fdf

Change-Id: Ic5b30a88189e5a8809d0f330d8b399bdb1994c60
2017-11-21 17:25:33 -05:00
Max Semenik 351a08d1b7 Don't break when reference names contain []
Bug: T29694
Bug: T179544
Depends-On: I189bdefbc9034cf8d221a89d7158195de1c0fa6c
Change-Id: Iec3439f76ecc2a3543b30b35f8735c92b0cfb711
2017-11-15 23:23:45 +00:00