XW-2444: fixing tests

This commit is contained in:
Mateusz Rybarski 2016-12-28 12:10:57 +01:00
parent 3ad591cec6
commit 0db0229550
4 changed files with 8 additions and 17 deletions

View file

@ -21,7 +21,7 @@ class PortableInfoboxRenderService extends WikiaService {
* @param $layout
* @return string - infobox HTML
*/
public function renderInfobox( array $infoboxdata, $theme, $layout, $accentColor, $accentColorText ) {
public function renderInfobox( array $infoboxdata, $theme, $layout ) {
wfProfileIn( __METHOD__ );
$helper = new PortableInfoboxRenderServiceHelper();
@ -31,13 +31,6 @@ class PortableInfoboxRenderService extends WikiaService {
$this->imagesWidth = $helper->isEuropaTheme() ? PortableInfoboxRenderServiceHelper::EUROPA_THUMBNAIL_WIDTH :
PortableInfoboxRenderServiceHelper::DEFAULT_DESKTOP_THUMBNAIL_WIDTH;
$colors = [
'hasAccentColor' => !empty( $accentColor ),
'hasAccentColorText' => !empty( $accentColorText),
'accentColor' => $accentColor,
'accentColorText' => $accentColorText,
];
foreach ( $infoboxdata as $item ) {
$type = $item[ 'type' ];

View file

@ -1,2 +1 @@
<h2 class="pi-item pi-header pi-secondary-font pi-item-spacing pi-secondary-background"
style={{# hasAccentColor}}"background-color: {{accentColor}};{{/hasAccentColor}}{{# hasAccentColorText}}color: {{accentColorText}};{{/hasAccentColorText}}">{{{value}}}</h2>
<h2 class="pi-item pi-header pi-secondary-font pi-item-spacing pi-secondary-background" {{inlineStyles}}>{{{value}}}</h2>

View file

@ -2,5 +2,4 @@
This template is linked with of mercury/front/templates/main/components/infobox-builder-item-title.hbs
Changing this template requires modifying the other in mercury repo.
}}
<h2 class="pi-item pi-item-spacing pi-title"
style="{{# hasAccentColor }}background-color: {{accentColor}};{{/hasAccentColor}}{{#hasAccentColorText}}color: {{accentColorText}}{{/hasAccentColorText}}">{{{value}}}</h2>
<h2 class="pi-item pi-item-spacing pi-title" {{inlineStyles}}>{{{value}}}</h2>

View file

@ -66,7 +66,7 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest {
} );
$expected = $this->normalizeHTML( '<aside class="portable-infobox pi-background pi-europa">
<h2 class="pi-item pi-item-spacing pi-title" style="">Test</h2>
<h2 class="pi-item pi-item-spacing pi-title">Test</h2>
</aside>' );
$result = $this->normalizeHTML( $output );
$this->assertEquals( $expected, $result );
@ -107,7 +107,7 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest {
]
],
'output' => '<aside class="portable-infobox pi-background">
<h2 class="pi-item pi-item-spacing pi-title" style="">Test Title</h2>
<h2 class="pi-item pi-item-spacing pi-title">Test Title</h2>
</aside>',
'description' => 'Only title'
],
@ -263,7 +263,7 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest {
]
],
'output' => '<aside class="portable-infobox pi-background">
<h2 class="pi-item pi-item-spacing pi-title" style="">Test Title</h2>
<h2 class="pi-item pi-item-spacing pi-title">Test Title</h2>
<figure class="pi-item pi-image">
<a href="http://image.jpg" class="image image-thumbnail" title="image alt">
<img src="http://thumbnail.jpg" srcset="http://thumbnail.jpg 1x, http://thumbnail2x.jpg 2x" class="pi-image-thumbnail" alt="image alt"
@ -312,7 +312,7 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest {
]
],
'output' => '<aside class="portable-infobox pi-background">
<h2 class="pi-item pi-item-spacing pi-title" style="">Test Title</h2>
<h2 class="pi-item pi-item-spacing pi-title">Test Title</h2>
<div class="pi-item pi-data pi-item-spacing pi-border-color">
<h3 class="pi-data-label pi-secondary-font">test label</h3>
<div class="pi-data-value pi-font">test value</div>
@ -337,7 +337,7 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest {
]
],
'output' => '<aside class="portable-infobox pi-background">
<h2 class="pi-item pi-item-spacing pi-title" style="">Test Title</h2>
<h2 class="pi-item pi-item-spacing pi-title">Test Title</h2>
<div class="pi-item pi-data pi-item-spacing pi-border-color">
<h3 class="pi-data-label pi-secondary-font">test label</h3>
<div class="pi-data-value pi-font">test value</div>