Commit graph

11 commits

Author SHA1 Message Date
Derick Alangi
b078f598f9 Move transformHtmlToWikitext() and getSelserData() to HTMLTransform
This patch moves remaining transformation logic to a renamed (from
HTMLTransformInput -> HTMLTransform) class. Also, the HTMLTransform
class is moved to the correct directory, hence namespace (including
tests).

Some data files have been copied over to it's own sub-directory in
the correct place since HTMLTransformTest needs it. ParsoidHandler
class is fine where it is because its operation is what happens in
the REST land.

NOTE: The 2 remaining methods moved into HTMLTransform are the last
ones we intended to move into this class to make the refactoring of
html2wt() method complete in this context.

Change-Id: I8929931e1b0acf247abe9d826eef57f3e0d4e132
2022-08-11 07:50:53 +01:00
jenkins-bot
e1ff495a45 Merge "ParsoidHandler: fix page bundle input with no orig HTML." 2022-08-02 19:55:25 +00:00
daniel
311f5450a1 ParsoidHandler: fix page bundle input with no orig HTML.
When refactoring, we were assuming that if the input is a page bundle,
it will always contain original HTML. That is not the case. We need to
make use of the supplied data-parsoid array even if there is no original
HTML given.

Change-Id: Ida8cbfcaac059af8902db9560a3ad6884e8b1790
2022-08-02 19:07:52 +02:00
daniel
6fd1561658 ParsoidHandler: add test for pagebundle input without original HTML
This is a regression test for an issue that broke parsoid's roundtrip
tests. The issue itself was already fixed on the master branch.

Change-Id: Ia7edb26a149231fbfc43f4edb8185304341b19ca
2022-08-02 14:46:39 +00:00
daniel
00c4f11ab6 Fix $validateXMLNames flag when parsing HTML
Change-Id: I6cbd2e8a7096b96814e9e0afe0193e1ca781af45
2022-08-01 17:23:03 +02:00
daniel
d50218c84f Move DOM transformations into HTMLTransformInput getters.
This moved the logic for applying page bundle data into the getters that
return DOM elements. It also makes the application of version
downgrades implicit.

NOTE: This patch changes the expected value of one of the phpunit tests
to a version that has no closing </div> tags. This appears to be the
original and expected behavior, per the corresponding test in the
parsoid extension's Parsoid.js test suite.

Change-Id: If2d7b06d8ba92fb63e6955ec7587ed4aea557251
2022-07-28 19:07:40 +02:00
jenkins-bot
5e82dca25f Merge "Fix ParsoidHandler html2wt unit tests" 2022-07-27 19:42:32 +00:00
Subramanya Sastry
d443dfa395 Fix ParsoidHandler html2wt unit tests
* Several unit tests had lost information about the input format
  being a pagebundle format.

* Fix the input format for a number of tests and a test expectation
  in one case.

  I removed a number of spurious comments which were misinterpreting
  why the pagebundle format was being used. If the input payload is
  in pagebundle format, the specified format should match that.

  In integration tests, the API endpoint implicitly provides this
  format information. But, in unit tests, this should be done explicitly
  which would also be the case for internal service object callers.

Change-Id: If3d3c0ad2ee1fe19f4c1590caa43bea4340cc08c
2022-07-27 11:43:49 -05:00
daniel
f1f5d470c9 Move dowgrade logic into HTMLTransformInput
Moving lazy initialization logic into HTMLTransformInput to clarify flow
of information.

DEPLOY: Mention that we've fixed $htmlSize and it will affect metrics
  graphs when this roles out.

Change-Id: If09afc4b933ec99561ac9e4d53383bd42a856eaa
2022-07-27 16:15:32 +01:00
daniel
eaa7e31b9d Add test for offset type check
We were only testing the offset type mismatch case with a non-standard
offset type in the 'original' data structure. This cause us to miss a
bug. This adds a test that has a non-standard offset type coming from
the request attributes.

Change-Id: Icac28b3f8c85bc594e1cae42a4ee407f0d54a19b
2022-07-26 16:51:47 +02:00
daniel
3f1cf31740 phpunit tests for ParsoidHandler::html2wt
The test cases were mostly ported from tests/api-testing/REST/Transform.js

Change-Id: Ie6b9f28b6e49e44c64f1fa73ca11e21c2b451474
2022-07-18 13:51:49 +02:00