aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/diff/TextSlotDiffRendererTest.php
diff options
context:
space:
mode:
authorEd Sanders <esanders@wikimedia.org>2020-11-29 20:46:02 +0000
committerEsanders <esanders@wikimedia.org>2020-12-30 12:52:08 +0000
commit27319def63025634e42dcea0f10701c6248ff61d (patch)
treeec9f7a4b4d59216cccedfe0d8d24aaae9634fa0c /tests/phpunit/includes/diff/TextSlotDiffRendererTest.php
parent351077388f542ef176e93fe71a0468b873d373d7 (diff)
downloadmediawikicore-27319def63025634e42dcea0f10701c6248ff61d.tar.gz
mediawikicore-27319def63025634e42dcea0f10701c6248ff61d.zip
Create diff markers with CSS
Also put <br>s into empty lines so linebreaks are preserved when copying. Bug: T192526 Change-Id: I926bedf71562c74a0aa33fbeb11f8d1a4e4130c7
Diffstat (limited to 'tests/phpunit/includes/diff/TextSlotDiffRendererTest.php')
-rw-r--r--tests/phpunit/includes/diff/TextSlotDiffRendererTest.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/phpunit/includes/diff/TextSlotDiffRendererTest.php b/tests/phpunit/includes/diff/TextSlotDiffRendererTest.php
index 7201d9ecb332..c352ae693449 100644
--- a/tests/phpunit/includes/diff/TextSlotDiffRendererTest.php
+++ b/tests/phpunit/includes/diff/TextSlotDiffRendererTest.php
@@ -113,6 +113,10 @@ class TextSlotDiffRendererTest extends MediaWikiIntegrationTestCase {
html_entity_decode( '&nbsp;' ) => ' ',
html_entity_decode( '&minus;' ) => '-',
];
+ // Preserve markers when stripping tags
+ $diff = str_replace( '<td class="diff-marker"></td>', ' ', $diff );
+ $diff = str_replace( '<td colspan="2"></td>', ' ', $diff );
+ $diff = preg_replace( '/data-marker="([^"]*)">/', '>$1', $diff );
return str_replace( array_keys( $replacements ), array_values( $replacements ),
trim( strip_tags( $diff ), "\n" ) );
}