jenkins-bot has submitted this change and it was merged.

Change subject: Apply filterContentInSection to last section
......................................................................


Apply filterContentInSection to last section

Fixes images in last section not being lazy loaded.
Adds a test case for the same.

Bug: T130025
Change-Id: I324888faacd45dfb05d72772b43a3b626ea80063
---
M includes/MobileFormatter.php
M tests/phpunit/MobileFormatterTest.php
2 files changed, 22 insertions(+), 0 deletions(-)

Approvals:
  Jdlrobson: Looks good to me, approved
  Bmansurov: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/MobileFormatter.php b/includes/MobileFormatter.php
index d6579de..389ef03 100644
--- a/includes/MobileFormatter.php
+++ b/includes/MobileFormatter.php
@@ -404,6 +404,10 @@
                        $sectionBody->appendChild( $node );
                }
 
+               if ( $sectionBody->hasChildNodes() ) {
+                       // Apply transformations to the last section body
+                       $this->filterContentInSection( $sectionBody, $doc, 
$sectionNumber, $transformOptions );
+               }
                // Append the last section body.
                $body->appendChild( $sectionBody );
        }
diff --git a/tests/phpunit/MobileFormatterTest.php 
b/tests/phpunit/MobileFormatterTest.php
index 115c789..8e92bf2 100644
--- a/tests/phpunit/MobileFormatterTest.php
+++ b/tests/phpunit/MobileFormatterTest.php
@@ -83,6 +83,24 @@
                                $enableSections,
                                false, false, true,
                        ),
+                       // https://phabricator.wikimedia.org/T130025, last 
section filtered
+                       array(
+                               '<p>text</p><h2>heading 1</h2><p>text</p>' . 
$originalImage
+                               .'<h2>heading 2</h2>' . $originalImage,
+                               '<div class="mf-section-0"><p>text</p></div>'
+                                       . '<h2>heading 1</h2>'
+                                       . '<div 
class="mf-section-1"><p>text</p>'
+                                       . $noscript
+                                       . $placeholder
+                                       . '</div>'
+                                       . '<h2>heading 2</h2>'
+                                       . '<div class="mf-section-2">'
+                                       . $noscript
+                                       . $placeholder
+                                       . '</div>',
+                               $enableSections,
+                               false, false, true,
+                       ),
 
                        // # Removal of images
                        array(

-- 
To view, visit https://gerrit.wikimedia.org/r/277603
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I324888faacd45dfb05d72772b43a3b626ea80063
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Sumit <[email protected]>
Gerrit-Reviewer: Bmansurov <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Sumit <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to