fix error after solving merge conflicts

This commit is contained in:
Rafal Leszczynski 2015-07-29 15:22:28 +02:00
parent 9ecc835603
commit a2680407f3
3 changed files with 71 additions and 12 deletions

View file

@ -81,6 +81,7 @@ class PortableInfoboxRenderServiceHelper {
$data[ 'width' ] = min( $thumbnail->getWidth(), $thumbnail->file->getWidth() ); $data[ 'width' ] = min( $thumbnail->getWidth(), $thumbnail->file->getWidth() );
$data[ 'thumbnail' ] = $thumbnail->getUrl(); $data[ 'thumbnail' ] = $thumbnail->getUrl();
$data[ 'key' ] = urlencode( $data[ 'key' ] ); $data[ 'key' ] = urlencode( $data[ 'key' ] );
$data[ 'media-type' ] = $data[ 'isVideo' ] ? 'video' : 'image';
return $data; return $data;
} }

View file

@ -154,10 +154,6 @@ class PortableInfoboxRenderService extends WikiaService {
if ( $helper->isWikiaMobile() ) { if ( $helper->isWikiaMobile() ) {
$data = $helper->sanitizeInfoboxTitle( $type, $data ); $data = $helper->sanitizeInfoboxTitle( $type, $data );
} }
if ( $type === 'hero-mobile' && !empty( $data['title']['value'] ) ) {
$data['title']['value'] = trim( strip_tags( $data['title']['value'] ) );
return $data;
}
return $this->templateEngine->clearData() return $this->templateEngine->clearData()
->setData( $data ) ->setData( $data )

View file

@ -109,7 +109,10 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest {
'data' => [ 'data' => [
'alt' => 'image alt', 'alt' => 'image alt',
'url' => 'http://image.jpg', 'url' => 'http://image.jpg',
'caption' => 'Lorem ipsum dolor' 'name' => 'image',
'key' => 'image',
'caption' => 'Lorem ipsum dolor',
'isVideo' => false
] ]
] ]
], ],
@ -133,7 +136,57 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest {
'key' => 'image', 'key' => 'image',
'width' => '400', 'width' => '400',
'height' => '200', 'height' => '200',
'thumbnail' => 'http://thumbnail.jpg' 'thumbnail' => 'http://thumbnail.jpg',
'media-type' => 'image',
'isVideo' => false
]
]
],
[
'input' => [
[
'type' => 'image',
'data' => [
'alt' => 'image alt',
'url' => 'http://image.jpg',
'caption' => 'Lorem ipsum dolor',
'isVideo' => true,
'duration' => '1:20',
'name' => 'test',
'key' => 'test'
]
]
],
'output' => '<aside class="portable-infobox">
<div class="portable-infobox-item item-type-image no-margins">
<figure class="portable-infobox-image-wrapper">
<a href="http://image.jpg"
class="image image-thumbnail video video-thumbnail small"
title="image alt">
<img src="http://thumbnail.jpg" class="portable-infobox-image"
alt="image alt" width="400" height="200" data-video-key="image"
data-video-name="image"/>
<span class="duration" itemprop="duration">1:20</span>
<span class="play-circle"></span>
</a>
<figcaption class="portable-infobox-item-margins portable-infobox-image-caption">Lorem ipsum dolor</figcaption>
</figure>
</div>
</aside>',
'description' => 'Only video',
'mockParams' => [
'extendImageData' => [
'alt' => 'image alt',
'url' => 'http://image.jpg',
'caption' => 'Lorem ipsum dolor',
'name' => 'image',
'key' => 'image',
'width' => '400',
'height' => '200',
'thumbnail' => 'http://thumbnail.jpg',
'media-type' => 'video',
'isVideo' => true,
'duration' => '1:20'
] ]
] ]
], ],
@ -183,7 +236,8 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest {
'alt' => 'image alt', 'alt' => 'image alt',
'url' => 'http://image.jpg', 'url' => 'http://image.jpg',
'name' => 'image', 'name' => 'image',
'key' => 'image' 'key' => 'image',
'isVideo' => false
] ]
], ],
[ [
@ -219,7 +273,9 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest {
'key' => 'image', 'key' => 'image',
'width' => '400', 'width' => '400',
'height' => '200', 'height' => '200',
'thumbnail' => 'http://thumbnail.jpg' 'thumbnail' => 'http://thumbnail.jpg',
'media-type' => 'image',
'isVideo' => false
] ]
] ]
], ],
@ -424,7 +480,8 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest {
'url' => 'http://image.jpg', 'url' => 'http://image.jpg',
'ref' => 1, 'ref' => 1,
'name' => 'test1', 'name' => 'test1',
'key' => 'test1' 'key' => 'test1',
'isVideo' => false
] ]
] ]
], ],
@ -445,7 +502,9 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest {
'ref' => 1, 'ref' => 1,
'width' => '400', 'width' => '400',
'height' => '200', 'height' => '200',
'thumbnail' => 'http://image.jpg' 'thumbnail' => 'http://image.jpg',
'media-type' => 'image',
'isVideo' => false
] ]
] ]
], ],
@ -463,7 +522,8 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest {
'url' => 'http://image.jpg', 'url' => 'http://image.jpg',
'name' => 'test1', 'name' => 'test1',
'key' => 'test1', 'key' => 'test1',
'ref' => 44 'ref' => 44,
'isVideo' => false
] ]
] ]
], ],
@ -486,7 +546,9 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest {
'ref' => 44, 'ref' => 44,
'width' => '400', 'width' => '400',
'height' => '200', 'height' => '200',
'thumbnail' => 'thumbnail.jpg' 'thumbnail' => 'thumbnail.jpg',
'isVideo' => false,
'media-type' => 'image'
] ]
] ]
] ]