Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395051 )

Change subject: Hygiene: Fix fixVideoAnchor test
......................................................................

Hygiene: Fix fixVideoAnchor test

This test wasn't doing much; a video-like HTML snippet was tested but the
isVideo check was failing (probably unintentionally). This updates the
test to do what it appears intended to do.

Change-Id: Ie16de3bfccf2d19db7e98a66b825d9484a4532f7
---
M lib/transformations/anchorPopUpMediaTransforms.js
M test/lib/transforms/app-transforms-test.js
2 files changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps 
refs/changes/51/395051/1

diff --git a/lib/transformations/anchorPopUpMediaTransforms.js 
b/lib/transformations/anchorPopUpMediaTransforms.js
index 06a02d2..89d3771 100644
--- a/lib/transformations/anchorPopUpMediaTransforms.js
+++ b/lib/transformations/anchorPopUpMediaTransforms.js
@@ -38,7 +38,7 @@
                         // longer acceptable.
                         node.nodeName === 'SPAN')) {
             const typeOf = node.getAttribute('typeof');
-            if (typeOf === 'mw:Video/Thumb' || typeOf === 'mw:Video') {
+            if (typeOf && typeOf.includes('mw:Video')) {
                 return true;
             }
         }
diff --git a/test/lib/transforms/app-transforms-test.js 
b/test/lib/transforms/app-transforms-test.js
index 5b3ed53..6ca012d 100644
--- a/test/lib/transforms/app-transforms-test.js
+++ b/test/lib/transforms/app-transforms-test.js
@@ -26,14 +26,14 @@
     it('fixVideoAnchor should transform actual videos', () => {
         const doc = domino.createDocument(`
 <figure typeof="mw:Video/Thumb mw:Placeholder" id="mwBw"><span id="mwCA">
-    <video controls="">
+    <video 
resource="https://upload.wikimedia.org/wikipedia/commons/9/96/Curiosity%27s_Seven_Minutes_of_Terror.ogv";>
         <source 
src="https://upload.wikimedia.org/wikipedia/commons/9/96/Curiosity%27s_Seven_Minutes_of_Terror.ogv";
         type='video/ogg; codecs="theora, vorbis"' />
     </video>
 </span></figure>`);
         a.fixVideoAnchor(doc);
         const videoThumbImgElements = doc.querySelectorAll('a.app_media');
-        assert.equal(videoThumbImgElements.length, 0, 'Should have marked the 
video file');
+        assert.equal(videoThumbImgElements.length, 1, 'Should have marked the 
video file');
     });
 
     it('fixVideoAnchor should apply app_media class to video anchors', () => {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie16de3bfccf2d19db7e98a66b825d9484a4532f7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway <[email protected]>

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

Reply via email to