Add support for name attribute

This commit is contained in:
lkucharczyk 2019-02-02 23:34:48 +01:00
parent ad504e4c07
commit e84e5c1e6c
28 changed files with 495 additions and 209 deletions

View file

@ -66,10 +66,11 @@ class PortableInfoboxParserTagController {
$accentColor = $this->getColor( self::ACCENT_COLOR, $params, $frame );
$accentColorText = $this->getColor( self::ACCENT_COLOR_TEXT, $params, $frame );
$type = $this->getType( $params );
$itemName = $this->getItemName( $params );
$renderService = new PortableInfoboxRenderService();
return $renderService->renderInfobox(
$data, implode( ' ', $themeList ), $layout, $accentColor, $accentColorText, $type
$data, implode( ' ', $themeList ), $layout, $accentColor, $accentColorText, $type, $itemName
);
}
@ -243,6 +244,10 @@ class PortableInfoboxParserTagController {
) : '';
}
private function getItemName( $params ) {
return !empty( $params['name'] ) ? Sanitizer::encodeAttribute( $params['name'] ) : '';
}
private function sanitizeColor( $color ) {
return $this->getParamsValidator()->validateColorValue( $color );
}

View file

@ -10,7 +10,8 @@ class InfoboxParamsValidator {
'layout',
'theme',
'theme-source',
'type'
'type',
'name'
];
private static $supportedLayouts = [

View file

@ -7,6 +7,7 @@ use PortableInfobox\Parser\SimpleParser;
class Node {
const DATA_SRC_ATTR_NAME = 'source';
const NAME_ATTR_NAME = 'name';
const DEFAULT_TAG_NAME = 'default';
const FORMAT_TAG_NAME = 'format';
const LABEL_TAG_NAME = 'label';
@ -112,7 +113,8 @@ class Node {
if ( !isset( $this->data ) ) {
$this->data = [
'value' => (string)$this->xmlNode,
'source' => $this->getXmlAttribute( $this->xmlNode, self::DATA_SRC_ATTR_NAME )
'source' => $this->getPrimarySource(),
'item-name' => $this->getItemName()
];
}
@ -280,4 +282,12 @@ class Node {
return array_unique( array_merge( $source, $sources[1] ) );
}
protected function getPrimarySource() {
return $this->getXmlAttribute( $this->xmlNode, self::DATA_SRC_ATTR_NAME );
}
protected function getItemName() {
return $this->getXmlAttribute( $this->xmlNode, self::NAME_ATTR_NAME );
}
}

View file

@ -15,7 +15,8 @@ class NodeData extends Node {
'value' => $this->getValueWithDefault( $this->xmlNode ),
'span' => $this->getSpan(),
'layout' => $this->getLayout(),
'source' => $this->getXmlAttribute( $this->xmlNode, self::DATA_SRC_ATTR_NAME )
'source' => $this->getPrimarySource(),
'item-name' => $this->getItemName()
];
}

View file

@ -34,7 +34,8 @@ class NodeGroup extends Node {
'value' => $this->getDataForChildren(),
'layout' => $this->getLayout(),
'collapse' => $this->getCollapse(),
'row-items' => $this->getRowItems()
'row-items' => $this->getRowItems(),
'item-name' => $this->getItemName()
];
}
@ -57,7 +58,8 @@ class NodeGroup extends Node {
'value' => $value,
'layout' => $this->getLayout(),
'collapse' => $this->getCollapse(),
'row-items' => $this->getRowItems()
'row-items' => $this->getRowItems(),
'item-name' => $this->getItemName()
],
];
}

View file

@ -5,7 +5,10 @@ class NodeHeader extends Node {
public function getData() {
if ( !isset( $this->data ) ) {
$this->data = [ 'value' => $this->getInnerValue( $this->xmlNode ) ];
$this->data = [
'value' => $this->getInnerValue( $this->xmlNode ),
'item-name' => $this->getItemName()
];
}
return $this->data;

View file

@ -155,7 +155,8 @@ class NodeMedia extends Node {
'isImage' => in_array( $mediatype, [ MEDIATYPE_BITMAP, MEDIATYPE_DRAWING ] ),
'isVideo' => $mediatype === MEDIATYPE_VIDEO,
'isAudio' => $mediatype === MEDIATYPE_AUDIO,
'source' => $this->getXmlAttribute( $this->xmlNode, self::DATA_SRC_ATTR_NAME )
'source' => $this->getPrimarySource(),
'item-name' => $this->getItemName()
];
if ( $image['isImage'] ) {

View file

@ -5,7 +5,10 @@ class NodeNavigation extends Node {
public function getData() {
if ( !isset( $this->data ) ) {
$this->data = [ 'value' => $this->getInnerValue( $this->xmlNode ) ];
$this->data = [
'value' => $this->getInnerValue( $this->xmlNode ),
'item-name' => $this->getItemName()
];
}
return $this->data;

View file

@ -7,7 +7,8 @@ class NodeTitle extends Node {
$title = $this->getValueWithDefault( $this->xmlNode );
$this->data = [
'value' => $title,
'source' => $this->getXmlAttribute( $this->xmlNode, self::DATA_SRC_ATTR_NAME )
'source' => $this->getXmlAttribute( $this->xmlNode, self::DATA_SRC_ATTR_NAME ),
'item-name' => $this->getItemName()
];
}

View file

@ -24,10 +24,11 @@ class PortableInfoboxRenderService {
* @param string $accentColor
* @param string $accentColorText
* @param string $type
* @param string $itemName
* @return string - infobox HTML
*/
public function renderInfobox(
array $infoboxdata, $theme, $layout, $accentColor, $accentColorText, $type
array $infoboxdata, $theme, $layout, $accentColor, $accentColorText, $type, $itemName
) {
$this->inlineStyles = $this->getInlineStyles( $accentColor, $accentColorText );
@ -38,7 +39,8 @@ class PortableInfoboxRenderService {
'content' => $infoboxHtmlContent,
'theme' => $theme,
'layout' => $layout,
'type' => $type
'type' => $type,
'item-name' => $itemName
] );
} else {
$output = '';
@ -122,7 +124,8 @@ class PortableInfoboxRenderService {
return $this->render( 'group', [
'content' => $groupHTMLContent,
'cssClasses' => implode( ' ', $cssClasses )
'cssClasses' => implode( ' ', $cssClasses ),
'item-name' => $groupData['item-name']
] );
}
@ -193,7 +196,8 @@ class PortableInfoboxRenderService {
$horizontalGroupData['data'][] = [
'label' => $data['label'],
'value' => $data['value'],
'source' => $item['data']['source'] ?? ""
'source' => $item['data']['source'] ?? "",
'item-name' => $item['data']['item-name']
];
if ( !empty( $data['label'] ) ) {
@ -262,7 +266,8 @@ class PortableInfoboxRenderService {
'label' => $label,
'value' => $item['data']['value'],
'inlineStyles' => $styles,
'source' => $item['data']['source'] ?? ""
'source' => $item['data']['source'] ?? "",
'item-name' => $item['data']['item-name']
];
return $result;

View file

@ -1,10 +1,10 @@
<table class="pi-horizontal-group{{#unless renderLabels}} pi-horizontal-group-no-labels{{/unless}}">
<table class="pi-horizontal-group{{#unless renderLabels}} pi-horizontal-group-no-labels{{/unless}}"{{#if item-name}} data-item-name="{{item-name}}"{{/if}}>
{{#if header}}<caption class="pi-header pi-secondary-font pi-secondary-background pi-item-spacing"{{#if inlineStyles}} style="{{inlineStyles}}"{{/if}}>{{{header}}}</caption>{{/if}}
{{#if renderLabels}}
<thead>
<tr>
{{#each data}}
<th class="pi-horizontal-group-item pi-data-label pi-secondary-font pi-border-color pi-item-spacing"{{#if source}} data-source="{{source}}"{{/if}}>{{{label}}}</th>
<th class="pi-horizontal-group-item pi-data-label pi-secondary-font pi-border-color pi-item-spacing"{{#if source}} data-source="{{source}}"{{/if}}{{#if item-name}} data-item-name="{{item-name}}"{{/if}}>{{{label}}}</th>
{{/each}}
</tr>
</thead>
@ -12,7 +12,7 @@
<tbody>
<tr>
{{#each data}}
<td class="pi-horizontal-group-item pi-data-value pi-font pi-border-color pi-item-spacing"{{#if source}} data-source="{{source}}"{{/if}}>{{{value}}}</td>
<td class="pi-horizontal-group-item pi-data-value pi-font pi-border-color pi-item-spacing"{{#if source}} data-source="{{source}}"{{/if}}{{#if item-name}} data-item-name="{{item-name}}"{{/if}}>{{{value}}}</td>
{{/each}}
</tr>
</tbody>

View file

@ -1,4 +1,4 @@
<div class="pi-item pi-data pi-item-spacing pi-border-color{{#if cssClasses}} {{{cssClasses}}}{{/if}}"{{#if inlineStyles}} style="{{inlineStyles}}"{{/if}}{{#if source}} data-source="{{source}}"{{/if}}>
<div class="pi-item pi-data pi-item-spacing pi-border-color{{#if cssClasses}} {{{cssClasses}}}{{/if}}"{{#if inlineStyles}} style="{{inlineStyles}}"{{/if}}{{#if source}} data-source="{{source}}"{{/if}}{{#if item-name}} data-item-name="{{item-name}}"{{/if}}>
{{#if label}}
<{{#if useHeadings}}h3{{else}}div{{/if}} class="pi-data-label pi-secondary-font">{{{label}}}</{{#if useHeadings}}h3{{else}}div{{/if}}>
{{/if}}

View file

@ -1 +1 @@
<section class="pi-item pi-group pi-border-color{{#if cssClasses}} {{{cssClasses}}}{{/if}}">{{{content}}}</section>
<section class="pi-item pi-group pi-border-color{{#if cssClasses}} {{{cssClasses}}}{{/if}}"{{#if item-name}} data-item-name="{{item-name}}"{{/if}}>{{{content}}}</section>

View file

@ -1 +1 @@
<{{#if useHeadings}}h2{{else}}div{{/if}} class="pi-item pi-header pi-secondary-font pi-item-spacing pi-secondary-background"{{#if inlineStyles}} style="{{inlineStyles}}"{{/if}}>{{{value}}}</{{#if useHeadings}}h2{{else}}div{{/if}}>
<{{#if useHeadings}}h2{{else}}div{{/if}} class="pi-item pi-header pi-secondary-font pi-item-spacing pi-secondary-background"{{#if inlineStyles}} style="{{inlineStyles}}"{{/if}}{{#if item-name}} data-item-name="{{item-name}}"{{/if}}>{{{value}}}</{{#if useHeadings}}h2{{else}}div{{/if}}>

View file

@ -1,4 +1,4 @@
<figure class="pi-item pi-media{{#if isImage}} pi-image{{/if}}{{#if isVideo}} pi-video{{/if}}{{#if isAudio}} pi-audio{{/if}}"{{#if source}} data-source="{{source}}"{{/if}}>
<figure class="pi-item pi-media{{#if isImage}} pi-image{{/if}}{{#if isVideo}} pi-video{{/if}}{{#if isAudio}} pi-audio{{/if}}"{{#if source}} data-source="{{source}}"{{/if}}{{#if item-name}} data-item-name="{{item-name}}"{{/if}}>
<a href="{{url}}" class="{{#if isImage}}image image-thumbnail{{/if}}{{#if isVideo}}video{{/if}}{{#if isAudio}}audio{{/if}}" title="{{alt}}">
{{#if isImage}}<img src="{{thumbnail}}" srcset="{{thumbnail}} 1x, {{thumbnail2x}} 2x" class="pi-image-thumbnail" alt="{{alt}}" width="{{{width}}}" height="{{{height}}}"/>
{{else}}{{#if isVideo}}<video src="{{url}}" class="pi-video-player" controls="true" controlsList="nodownload" preload="metadata">{{alt}}</video>

View file

@ -1,10 +1,10 @@
<div class="pi-media-collection" {{#if source}} data-source="{{source}}"{{/if}}>
<div class="pi-media-collection" {{#if source}} data-source="{{source}}"{{/if}}{{#if item-name}} data-item-name="{{item-name}}"{{/if}}>
<ul class="pi-media-collection-tabs">
{{#each images}}<li class="pi-tab-link pi-item-spacing{{#if isFirst}} current{{/if}}" data-pi-tab="pi-tab-{{ref}}">{{{caption}}}</li>{{/each}}
</ul>
{{#each images}}
<div class="pi-media-collection-tab-content{{#if isFirst}} current{{/if}}" id="pi-tab-{{ref}}">
<figure class="pi-item pi-media{{#if isImage}} pi-image{{/if}}{{#if isVideo}} pi-video{{/if}}{{#if isAudio}} pi-audio{{/if}}"{{#if source}} data-source="{{source}}"{{/if}}>
<figure class="pi-item pi-media{{#if isImage}} pi-image{{/if}}{{#if isVideo}} pi-video{{/if}}{{#if isAudio}} pi-audio{{/if}}"{{#if source}} data-source="{{source}}"{{/if}}{{#if item-name}} data-item-name="{{item-name}}"{{/if}}>
<a href="{{url}}" class="{{#if isImage}}image image-thumbnail{{/if}}{{#if isVideo}}video{{/if}}{{#if isAudio}}audio{{/if}}" title="{{alt}}">
{{#if isImage}}<img src="{{thumbnail}}" srcset="{{thumbnail}} 1x, {{thumbnail2x}} 2x" class="pi-image-thumbnail" alt="{{alt}}" width="{{{width}}}" height="{{{height}}}"/>
{{else}}{{#if isVideo}}<video src="{{url}}" class="pi-video-player" controls="true" controlsList="nodownload" preload="metadata">{{alt}}</video>

View file

@ -1 +1 @@
<nav class="pi-navigation pi-item-spacing pi-secondary-background pi-secondary-font">{{{value}}}</nav>
<nav class="pi-navigation pi-item-spacing pi-secondary-background pi-secondary-font"{{#if item-name}} data-item-name="{{item-name}}"{{/if}}>{{{value}}}</nav>

View file

@ -2,13 +2,13 @@
{{#if renderLabels}}
<section class="pi-smart-group-head">
{{#each data}}
<{{#if ../useHeadings}}h3{{else}}div{{/if}} class="pi-smart-data-label pi-data-label pi-secondary-font pi-item-spacing" style="{{{inlineStyles}}}"{{#if source}} data-source="{{source}}"{{/if}}>{{{label}}}</{{#if ../useHeadings}}h3{{else}}div{{/if}}>
<{{#if ../useHeadings}}h3{{else}}div{{/if}} class="pi-smart-data-label pi-data-label pi-secondary-font pi-item-spacing" style="{{{inlineStyles}}}"{{#if source}} data-source="{{source}}"{{/if}}{{#if item-name}} data-item-name="{{item-name}}"{{/if}}>{{{label}}}</{{#if ../useHeadings}}h3{{else}}div{{/if}}>
{{/each}}
</section>
{{/if}}
<section class="pi-smart-group-body">
{{#each data}}
<div class="pi-smart-data-value pi-data-value pi-font pi-item-spacing" style="{{{inlineStyles}}}"{{#if source}} data-source="{{source}}"{{/if}}>{{{value}}}</div>
<div class="pi-smart-data-value pi-data-value pi-font pi-item-spacing" style="{{{inlineStyles}}}"{{#if source}} data-source="{{source}}"{{/if}}{{#if item-name}} data-item-name="{{item-name}}"{{/if}}>{{{value}}}</div>
{{/each}}
</section>
</section>

View file

@ -1 +1 @@
<{{#if useHeadings}}h2{{else}}div{{/if}} class="pi-item pi-item-spacing pi-title"{{#if inlineStyles}} style="{{inlineStyles}}"{{/if}}{{#if source}} data-source="{{source}}"{{/if}}>{{{value}}}</{{#if useHeadings}}h2{{else}}div{{/if}}>
<{{#if useHeadings}}h2{{else}}div{{/if}} class="pi-item pi-item-spacing pi-title"{{#if inlineStyles}} style="{{inlineStyles}}"{{/if}}{{#if source}} data-source="{{source}}"{{/if}}{{#if item-name}} data-item-name="{{item-name}}"{{/if}}>{{{value}}}</{{#if useHeadings}}h2{{else}}div{{/if}}>

View file

@ -1 +1 @@
<aside class="portable-infobox pi-background{{#if theme}} {{theme}}{{/if}}{{#if layout}} {{layout}}{{/if}}{{#if type}} {{type}}{{/if}}">{{{content}}}</aside>
<aside class="portable-infobox pi-background{{#if theme}} {{theme}}{{/if}}{{#if layout}} {{layout}}{{/if}}{{#if type}} {{type}}{{/if}}"{{#if item-name}} data-item-name="{{item-name}}"{{/if}}>{{{content}}}</aside>

View file

@ -66,7 +66,8 @@ class PortableInfoboxDataServiceTest extends MediaWikiTestCase {
'value' => 1,
'layout' => null,
'span' => 1,
'source' => 'test'
'source' => 'test',
'item-name' => null
]
]
],

View file

@ -38,7 +38,7 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
$infoboxRenderService = new PortableInfoboxRenderService();
$actualOutput = $infoboxRenderService->renderInfobox(
$input, '', '', $accentColor, $accentColorText, ''
$input, '', '', $accentColor, $accentColorText, '', ''
);
$expectedHtml = $this->normalizeHTML( $expectedOutput );
$actualHtml = $this->normalizeHTML( $actualOutput );
@ -61,7 +61,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
[
'type' => 'title',
'data' => [
'value' => 'Test Title'
'value' => 'Test Title',
'item-name' => null
]
]
],
@ -78,7 +79,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
[
'type' => 'title',
'data' => [
'value' => 'Test Title'
'value' => 'Test Title',
'item-name' => null
]
]
],
@ -103,7 +105,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'height' => '200',
'thumbnail' => 'http://thumbnail.jpg',
'thumbnail2x' => 'http://thumbnail2x.jpg',
'isImage' => true
'isImage' => true,
'item-name' => null
]
]
]
@ -131,7 +134,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'alt' => 'image alt',
'url' => 'http://image.jpg',
'caption' => 'Lorem ipsum dolor',
'isVideo' => true
'isVideo' => true,
'item-name' => null
]
]
]
@ -156,6 +160,7 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'type' => 'navigation',
'data' => [
'value' => 'navigation value',
'item-name' => null
]
]
],
@ -173,7 +178,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'type' => 'data',
'data' => [
'label' => 'test label',
'value' => 'test value'
'value' => 'test value',
'item-name' => null
]
]
],
@ -193,7 +199,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
[
'type' => 'title',
'data' => [
'value' => 'Test Title'
'value' => 'Test Title',
'item-name' => null
]
],
[
@ -206,7 +213,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'height' => '200',
'thumbnail' => 'http://thumbnail.jpg',
'thumbnail2x' => 'http://thumbnail2x.jpg',
'isImage' => true
'isImage' => true,
'item-name' => null
]
]
],
@ -214,7 +222,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'type' => 'data',
'data' => [
'label' => 'test label',
'value' => 'test value'
'value' => 'test value',
'item-name' => null
]
]
],
@ -241,7 +250,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
[
'type' => 'title',
'data' => [
'value' => 'Test Title'
'value' => 'Test Title',
'item-name' => null
]
],
[
@ -252,7 +262,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'type' => 'data',
'data' => [
'label' => 'test label',
'value' => 'test value'
'value' => 'test value',
'item-name' => null
]
]
],
@ -273,14 +284,16 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
[
'type' => 'title',
'data' => [
'value' => 'Test Title'
'value' => 'Test Title',
'item-name' => null
]
],
[
'type' => 'data',
'data' => [
'label' => 'test label',
'value' => 'test value'
'value' => 'test value',
'item-name' => null
]
]
],
@ -301,7 +314,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
[
'type' => 'title',
'data' => [
'value' => 'Test Title'
'value' => 'Test Title',
'item-name' => null
]
],
[
@ -311,27 +325,31 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
[
'type' => 'header',
'data' => [
'value' => 'Test Header'
'value' => 'Test Header',
'item-name' => null
]
],
[
'type' => 'data',
'data' => [
'label' => 'test label',
'value' => 'test value'
'value' => 'test value',
'item-name' => null
]
],
[
'type' => 'data',
'data' => [
'label' => 'test label',
'value' => 'test value'
'value' => 'test value',
'item-name' => null
]
]
],
'layout' => 'default',
'collapse' => null,
'row-items' => null
'row-items' => null,
'item-name' => null
]
]
],
@ -359,7 +377,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
[
'type' => 'title',
'data' => [
'value' => 'Test Title'
'value' => 'Test Title',
'item-name' => null
]
],
[
@ -369,27 +388,31 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
[
'type' => 'header',
'data' => [
'value' => 'Test Header'
'value' => 'Test Header',
'item-name' => null
]
],
[
'type' => 'data',
'data' => [
'label' => 'test label',
'value' => 'test value'
'value' => 'test value',
'item-name' => null
]
],
[
'type' => 'data',
'data' => [
'label' => 'test label',
'value' => 'test value'
'value' => 'test value',
'item-name' => null
]
]
],
'layout' => 'default',
'collapse' => null,
'row-items' => null
'row-items' => null,
'item-name' => null
]
]
],
@ -422,27 +445,31 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
[
'type' => 'header',
'data' => [
'value' => 'Test header'
'value' => 'Test header',
'item-name' => null
]
],
[
'type' => 'data',
'data' => [
'label' => 'test label',
'value' => 'test value'
'value' => 'test value',
'item-name' => null
]
],
[
'type' => 'data',
'data' => [
'label' => 'test label',
'value' => 'test value'
'value' => 'test value',
'item-name' => null
]
]
],
'layout' => 'horizontal',
'collapse' => null,
'row-items' => null
'row-items' => null,
'item-name' => null
]
]
],
@ -480,20 +507,23 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'type' => 'data',
'data' => [
'label' => '',
'value' => 'test value'
'value' => 'test value',
'item-name' => null
]
],
[
'type' => 'data',
'data' => [
'label' => '',
'value' => 'test value'
'value' => 'test value',
'item-name' => null
]
]
],
'layout' => 'horizontal',
'collapse' => null,
'row-items' => null
'row-items' => null,
'item-name' => null
]
]
],
@ -519,7 +549,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
[
'type' => 'navigation',
'data' => [
'value' => '<p>Links</p>'
'value' => '<p>Links</p>',
'item-name' => null
]
]
],
@ -544,20 +575,23 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'type' => 'data',
'data' => [
'label' => 'test label 1',
'value' => 'test value 1'
'value' => 'test value 1',
'item-name' => null
]
],
[
'type' => 'data',
'data' => [
'label' => 'test label 2',
'value' => 'test value 2'
'value' => 'test value 2',
'item-name' => null
]
]
],
'layout' => 'horizontal',
'collapse' => null,
'row-items' => null
'row-items' => null,
'item-name' => null
]
]
],
@ -593,27 +627,31 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
[
'type' => 'header',
'data' => [
'value' => 'test header'
'value' => 'test header',
'item-name' => null
]
],
[
'type' => 'data',
'data' => [
'label' => '',
'value' => 'test value 1'
'value' => 'test value 1',
'item-name' => null
]
],
[
'type' => 'data',
'data' => [
'label' => 'test label 2',
'value' => 'test value 2'
'value' => 'test value 2',
'item-name' => null
]
]
],
'layout' => 'horizontal',
'collapse' => null,
'row-items' => null
'row-items' => null,
'item-name' => null
]
]
],
@ -651,20 +689,23 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'type' => 'data',
'data' => [
'label' => '',
'value' => 'test value 1'
'value' => 'test value 1',
'item-name' => null
]
],
[
'type' => 'data',
'data' => [
'label' => '',
'value' => 'test value 2'
'value' => 'test value 2',
'item-name' => null
]
]
],
'layout' => 'horizontal',
'collapse' => null,
'row-items' => null
'row-items' => null,
'item-name' => null
]
]
],
@ -697,7 +738,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 1',
'value' => 'test value 1',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -706,7 +748,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 2',
'value' => 'test value 2',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -715,7 +758,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 3',
'value' => 'test value 3',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -724,7 +768,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 4',
'value' => 'test value 4',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -733,13 +778,15 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 5',
'value' => 'test value 5',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
]
],
'layout' => null,
'collapse' => null,
'row-items' => 3
'row-items' => 3,
'item-name' => null
]
]
],
@ -786,7 +833,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 1',
'value' => 'test value 1',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -795,7 +843,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 2',
'value' => 'test value 2',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -804,7 +853,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 3',
'value' => 'test value 3',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -813,13 +863,15 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 4',
'value' => 'test value 4',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
]
],
'layout' => null,
'collapse' => null,
'row-items' => 3
'row-items' => 3,
'item-name' => null
]
]
],
@ -864,13 +916,15 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 1',
'value' => 'test value 1',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
]
],
'layout' => null,
'collapse' => null,
'row-items' => 3
'row-items' => 3,
'item-name' => null
]
]
],
@ -903,7 +957,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 1',
'value' => 'test value 1',
'span' => 2,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -912,13 +967,15 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 2',
'value' => 'test value 2',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
]
],
'layout' => null,
'collapse' => null,
'row-items' => 3
'row-items' => 3,
'item-name' => null
]
]
],
@ -953,7 +1010,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 1',
'value' => 'test value 1',
'span' => 2,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -962,13 +1020,15 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 2',
'value' => 'test value 2',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
]
],
'layout' => null,
'collapse' => null,
'row-items' => 7
'row-items' => 7,
'item-name' => null
]
]
],
@ -1003,7 +1063,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 1',
'value' => 'test value 1',
'span' => 2,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -1012,7 +1073,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 2',
'value' => 'test value 2',
'span' => 2,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -1021,13 +1083,15 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 3',
'value' => 'test value 3',
'span' => 2,
'layout' => null
'layout' => null,
'item-name' => null
]
]
],
'layout' => null,
'collapse' => null,
'row-items' => 3
'row-items' => 3,
'item-name' => null
]
]
],
@ -1076,7 +1140,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 1',
'value' => 'test value 1',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -1085,7 +1150,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 2',
'value' => 'test value 2',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -1094,7 +1160,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 3',
'value' => 'test value 3',
'span' => null,
'layout' => 'default'
'layout' => 'default',
'item-name' => null
]
],
[
@ -1103,7 +1170,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 4',
'value' => 'test value 4',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -1112,7 +1180,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 5',
'value' => 'test value 5',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -1121,13 +1190,15 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 6',
'value' => 'test value 6',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
]
],
'layout' => null,
'collapse' => null,
'row-items' => 3
'row-items' => 3,
'item-name' => null
]
]
],
@ -1178,7 +1249,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 1',
'value' => 'test value 1',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -1187,7 +1259,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 2',
'value' => 'test value 2',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -1196,7 +1269,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 3',
'value' => 'test value 3',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -1205,7 +1279,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 4',
'value' => 'test value 4',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -1214,7 +1289,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 5',
'value' => 'test value 5',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -1223,13 +1299,15 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 6',
'value' => 'test value 6',
'span' => null,
'layout' => 'default'
'layout' => 'default',
'item-name' => null
]
]
],
'layout' => null,
'collapse' => null,
'row-items' => 3
'row-items' => 3,
'item-name' => null
]
]
],
@ -1280,7 +1358,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 1',
'value' => 'test value 1',
'span' => 40,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -1289,7 +1368,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 2',
'value' => 'test value 2',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -1298,13 +1378,15 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 3',
'value' => 'test value 3',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
]
],
'layout' => null,
'collapse' => null,
'row-items' => 3
'row-items' => 3,
'item-name' => null
]
]
],
@ -1347,7 +1429,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 1',
'value' => 'test value 1',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -1356,7 +1439,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 2',
'value' => 'test value 2',
'span' => 40,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -1365,13 +1449,15 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 3',
'value' => 'test value 3',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
]
],
'layout' => null,
'collapse' => null,
'row-items' => 3
'row-items' => 3,
'item-name' => null
]
]
],
@ -1420,7 +1506,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 1',
'value' => 'test value 1',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -1429,13 +1516,15 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 2',
'value' => 'test value 2',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
'type' => 'title',
'data' => [
'value' => 'title value'
'value' => 'title value',
'item-name' => null
]
],
[
@ -1444,13 +1533,15 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 3',
'value' => 'test value 3',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
]
],
'layout' => null,
'collapse' => null,
'row-items' => 3
'row-items' => 3,
'item-name' => null
]
]
],
@ -1494,7 +1585,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => null,
'value' => 'test value 1',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -1503,13 +1595,15 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => null,
'value' => 'test value 2',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
'type' => 'title',
'data' => [
'value' => 'title value'
'value' => 'title value',
'item-name' => null
]
],
[
@ -1518,7 +1612,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => null,
'value' => 'test value 3',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
],
[
@ -1527,13 +1622,15 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'label' => 'Test 4',
'value' => 'test value 4',
'span' => 1,
'layout' => null
'layout' => null,
'item-name' => null
]
]
],
'layout' => null,
'collapse' => null,
'row-items' => 3
'row-items' => 3,
'item-name' => null
]
]
],
@ -1568,7 +1665,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
[
'type' => 'title',
'data' => [
'value' => 'Test Title'
'value' => 'Test Title',
'item-name' => null
]
],
[
@ -1584,7 +1682,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'thumbnail' => 'http://thumbnail.jpg',
'thumbnail2x' => 'http://thumbnail2x.jpg',
'isImage' => true,
'isFirst' => true
'isFirst' => true,
'item-name' => null
],
[
'alt' => 'image alt',
@ -1595,7 +1694,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
'height' => '200',
'thumbnail' => 'http://thumbnail.jpg',
'thumbnail2x' => 'http://thumbnail2x.jpg',
'isImage' => true
'isImage' => true,
'item-name' => null
]
]
]
@ -1635,7 +1735,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
[
'type' => 'title',
'data' => [
'value' => 'Test Title'
'value' => 'Test Title',
'item-name' => null
]
],
[
@ -1645,27 +1746,31 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
[
'type' => 'header',
'data' => [
'value' => 'Test Header'
'value' => 'Test Header',
'item-name' => null
]
],
[
'type' => 'data',
'data' => [
'label' => 'test label',
'value' => 'test value'
'value' => 'test value',
'item-name' => null
]
],
[
'type' => 'data',
'data' => [
'label' => 'test label',
'value' => 'test value'
'value' => 'test value',
'item-name' => null
]
]
],
'layout' => 'default',
'collapse' => 'open',
'row-items' => null
'row-items' => null,
'item-name' => null
]
]
],
@ -1693,7 +1798,8 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
[
'type' => 'title',
'data' => [
'value' => 'Test Title'
'value' => 'Test Title',
'item-name' => null
]
],
[
@ -1703,27 +1809,31 @@ class PortableInfoboxRenderServiceTest extends MediaWikiTestCase {
[
'type' => 'header',
'data' => [
'value' => 'Test Header'
'value' => 'Test Header',
'item-name' => null
]
],
[
'type' => 'data',
'data' => [
'label' => 'test label',
'value' => 'test value'
'value' => 'test value',
'item-name' => null
]
],
[
'type' => 'data',
'data' => [
'label' => 'test label',
'value' => 'test value'
'value' => 'test value',
'item-name' => null
]
]
],
'layout' => 'default',
'collapse' => 'closed',
'row-items' => null
'row-items' => null,
'item-name' => null
]
]
],

View file

@ -532,67 +532,158 @@ class NodeDataTest extends MediaWikiTestCase {
[
'<data source="test"></data>',
[ 'test' => 'test' ],
[ 'value' => 'test', 'label' => '', 'span' => 1, 'layout' => null, 'source' => 'test' ]
[
'value' => 'test',
'label' => '',
'span' => 1,
'layout' => null,
'source' => 'test',
'item-name' => null
]
],
[
'<data source="test" span="2"></data>',
[ 'test' => 'test' ],
[ 'value' => 'test', 'label' => '', 'span' => '2', 'layout' => null, 'source' => 'test' ]
[
'value' => 'test',
'label' => '',
'span' => '2',
'layout' => null,
'source' => 'test',
'item-name' => null
]
],
[
'<data source="test" span="2.2"></data>',
[ 'test' => 'test' ],
[ 'value' => 'test', 'label' => '', 'span' => 1, 'layout' => null, 'source' => 'test' ]
[
'value' => 'test',
'label' => '',
'span' => 1,
'layout' => null,
'source' => 'test',
'item-name' => null
]
],
[
'<data source="test" span="non_numeric_span"></data>',
[ 'test' => 'test' ],
[ 'value' => 'test', 'label' => '', 'span' => 1, 'layout' => null, 'source' => 'test' ]
[
'value' => 'test',
'label' => '',
'span' => 1,
'layout' => null,
'source' => 'test',
'item-name' => null
]
],
[
'<data source="test" layout="wrong layout"></data>',
[ 'test' => 'test' ],
[ 'value' => 'test', 'label' => '', 'span' => 1, 'layout' => null, 'source' => 'test' ]
[
'value' => 'test',
'label' => '',
'span' => 1,
'layout' => null,
'source' => 'test',
'item-name' => null
]
],
[
'<data source="test" layout="default"></data>',
[ 'test' => 'test' ],
[ 'value' => 'test', 'label' => '', 'span' => 1, 'layout' => 'default', 'source' => 'test' ]
[
'value' => 'test',
'label' => '',
'span' => 1,
'layout' => 'default',
'source' => 'test',
'item-name' => null
]
],
[
'<data source="test"><default>def</default></data>',
[],
[ 'value' => 'def', 'label' => '', 'span' => 1, 'layout' => null, 'source' => 'test' ]
[
'value' => 'def',
'label' => '',
'span' => 1,
'layout' => null,
'source' => 'test',
'item-name' => null
]
],
[
'<data source="test"><label>l</label><default>def</default></data>',
[],
[ 'value' => 'def', 'label' => 'l', 'span' => 1, 'layout' => null, 'source' => 'test' ]
[
'value' => 'def',
'label' => 'l',
'span' => 1,
'layout' => null,
'source' => 'test',
'item-name' => null
]
],
[
'<data source="test"><label source="l">jjj</label><default>def</default></data>',
[ 'l' => 1 ],
[ 'value' => 'def', 'label' => 'jjj', 'span' => 1, 'layout' => null, 'source' => 'test' ]
[
'value' => 'def',
'label' => 'jjj',
'span' => 1,
'layout' => null,
'source' => 'test',
'item-name' => null
]
],
[
'<data source="test"><label source="l" /><default>def</default></data>',
[ 'l' => 1 ],
[ 'value' => 'def', 'label' => '', 'span' => 1, 'layout' => null, 'source' => 'test' ]
[
'value' => 'def',
'label' => '',
'span' => 1,
'layout' => null,
'source' => 'test',
'item-name' => null
]
],
[
'<data source="test"><label>l</label><default>def</default></data>',
[ 'test' => 1 ],
[ 'value' => 1, 'label' => 'l', 'span' => 1, 'layout' => null , 'source' => 'test' ]
[
'value' => 1,
'label' => 'l',
'span' => 1,
'layout' => null,
'source' => 'test',
'item-name' => null
]
],
[
'<data></data>',
[],
[ 'label' => '', 'value' => null, 'span' => 1, 'layout' => null, 'source' => null ]
[
'label' => '',
'value' => null,
'span' => 1,
'layout' => null,
'source' => null,
'item-name' => null
]
],
[
'<data source="test"><label>l</label><format>{{{test}}}%</format><default>def</default></data>',
[ 'test' => 1 ],
[ 'value' => '{{{test}}}%', 'label' => 'l', 'span' => 1, 'layout' => null, 'source' => 'test' ]
[
'value' => '{{{test}}}%',
'label' => 'l',
'span' => 1,
'layout' => null,
'source' => 'test',
'item-name' => null
]
],
[
'<data source="test">' .
@ -604,18 +695,33 @@ class NodeDataTest extends MediaWikiTestCase {
'label' => 'l',
'span' => 1,
'layout' => null,
'source' => 'test'
'source' => 'test',
'item-name' => null
]
],
[
'<data source="test"><label>l</label><format>{{{test}}}%</format><default>def</default></data>',
[],
[ 'value' => 'def', 'label' => 'l', 'span' => 1, 'layout' => null, 'source' => 'test' ]
[
'value' => 'def',
'label' => 'l',
'span' => 1,
'layout' => null,
'source' => 'test',
'item-name' => null
]
],
[
'<data source="test"><format>{{{test}}}%</format></data>',
[ 'test' => 0 ],
[ 'value' => '{{{test}}}%', 'label' => '', 'span' => 1, 'layout' => null, 'source' => 'test' ]
[
'value' => '{{{test}}}%',
'label' => '',
'span' => 1,
'layout' => null,
'source' => 'test',
'item-name' => null
]
],
];
}
@ -648,7 +754,8 @@ class NodeDataTest extends MediaWikiTestCase {
'label' => '',
'span' => 1,
'layout' => null,
'source' => 'test'
'source' => 'test',
'item-name' => null
]
]
],
@ -662,7 +769,8 @@ class NodeDataTest extends MediaWikiTestCase {
'label' => '',
'span' => 1,
'layout' => 'default',
'source' => 'test'
'source' => 'test',
'item-name' => null
]
]
],
@ -676,7 +784,8 @@ class NodeDataTest extends MediaWikiTestCase {
'label' => '',
'span' => 1,
'layout' => null,
'source' => 'test'
'source' => 'test',
'item-name' => null
]
]
],
@ -690,7 +799,8 @@ class NodeDataTest extends MediaWikiTestCase {
'label' => '',
'span' => '2',
'layout' => null,
'source' => 'test'
'source' => 'test',
'item-name' => null
]
]
],
@ -704,7 +814,8 @@ class NodeDataTest extends MediaWikiTestCase {
'label' => '',
'span' => 1,
'layout' => null,
'source' => 'test'
'source' => 'test',
'item-name' => null
]
]
],
@ -718,7 +829,8 @@ class NodeDataTest extends MediaWikiTestCase {
'label' => '',
'span' => 1,
'layout' => null,
'source' => 'test'
'source' => 'test',
'item-name' => null
]
]
],

View file

@ -83,7 +83,8 @@ class NodeGroupTest extends MediaWikiTestCase {
'value' => 1,
'span' => 1,
'layout' => null,
'source' => 'elem1'
'source' => 'elem1',
'item-name' => null
],
'source' => [ 'elem1' ]
],
@ -95,7 +96,8 @@ class NodeGroupTest extends MediaWikiTestCase {
'value' => 2,
'span' => 1,
'layout' => null,
'source' => 'elem2'
'source' => 'elem2',
'item-name' => null
],
'source' => [ 'elem2' ]
],
@ -107,14 +109,16 @@ class NodeGroupTest extends MediaWikiTestCase {
'value' => null,
'span' => 1,
'layout' => null,
'source' => 'elem3'
'source' => 'elem3',
'item-name' => null
],
'source' => [ 'elem3' ]
]
],
'layout' => 'default',
'collapse' => null,
'row-items' => null
'row-items' => null,
'item-name' => null
]
],
[
@ -134,7 +138,8 @@ class NodeGroupTest extends MediaWikiTestCase {
'value' => 1,
'span' => 1,
'layout' => null,
'source' => 'elem1'
'source' => 'elem1',
'item-name' => null
],
'source' => [ 'elem1' ]
],
@ -146,7 +151,8 @@ class NodeGroupTest extends MediaWikiTestCase {
'value' => 2,
'span' => 1,
'layout' => null,
'source' => 'elem2'
'source' => 'elem2',
'item-name' => null
],
'source' => [ 'elem2' ]
],
@ -158,14 +164,16 @@ class NodeGroupTest extends MediaWikiTestCase {
'value' => null,
'span' => 1,
'layout' => null,
'source' => 'elem3'
'source' => 'elem3',
'item-name' => null
],
'source' => [ 'elem3' ]
],
],
'layout' => 'horizontal',
'collapse' => null,
'row-items' => null
'row-items' => null,
'item-name' => null
]
],
[
@ -185,7 +193,8 @@ class NodeGroupTest extends MediaWikiTestCase {
'value' => 1,
'span' => 1,
'layout' => null,
'source' => 'elem1'
'source' => 'elem1',
'item-name' => null
],
'source' => [ 'elem1' ]
],
@ -197,7 +206,8 @@ class NodeGroupTest extends MediaWikiTestCase {
'value' => 2,
'span' => 1,
'layout' => null,
'source' => 'elem2'
'source' => 'elem2',
'item-name' => null
],
'source' => [ 'elem2' ]
],
@ -209,14 +219,16 @@ class NodeGroupTest extends MediaWikiTestCase {
'value' => null,
'span' => 1,
'layout' => null,
'source' => 'elem3'
'source' => 'elem3',
'item-name' => null
],
'source' => [ 'elem3' ]
]
],
'layout' => 'default',
'collapse' => null,
'row-items' => null
'row-items' => null,
'item-name' => null
]
],
[
@ -227,7 +239,8 @@ class NodeGroupTest extends MediaWikiTestCase {
[
'type' => 'header',
'data' => [
'value' => 'h'
'value' => 'h',
'item-name' => null
],
'isEmpty' => false,
'source' => []
@ -239,7 +252,8 @@ class NodeGroupTest extends MediaWikiTestCase {
'label' => '',
'span' => 1,
'layout' => null,
'source' => '1'
'source' => '1',
'item-name' => null
],
'isEmpty' => false,
'source' => [ '1' ]
@ -251,7 +265,8 @@ class NodeGroupTest extends MediaWikiTestCase {
'label' => '',
'span' => 1,
'layout' => null,
'source' => '2'
'source' => '2',
'item-name' => null
],
'isEmpty' => false,
'source' => [ '2' ]
@ -259,7 +274,8 @@ class NodeGroupTest extends MediaWikiTestCase {
],
'layout' => 'default',
'collapse' => null,
'row-items' => null
'row-items' => null,
'item-name' => null
]
],
[
@ -269,7 +285,7 @@ class NodeGroupTest extends MediaWikiTestCase {
'value' => [
[
'type' => 'header',
'data' => [ 'value' => 'h' ],
'data' => [ 'value' => 'h', 'item-name' => null ],
'isEmpty' => false,
'source' => []
],
@ -280,7 +296,8 @@ class NodeGroupTest extends MediaWikiTestCase {
'label' => '',
'span' => 1,
'layout' => null,
'source' => '1'
'source' => '1',
'item-name' => null
],
'isEmpty' => false,
'source' => [ '1' ]
@ -292,7 +309,8 @@ class NodeGroupTest extends MediaWikiTestCase {
'label' => '',
'span' => 1,
'layout' => null,
'source' => '2'
'source' => '2',
'item-name' => null
],
'isEmpty' => true,
'source' => [ '2' ]
@ -300,7 +318,8 @@ class NodeGroupTest extends MediaWikiTestCase {
],
'layout' => 'default',
'collapse' => null,
'row-items' => null
'row-items' => null,
'item-name' => null
]
],
[
@ -310,7 +329,10 @@ class NodeGroupTest extends MediaWikiTestCase {
'value' => [
[
'type' => 'header',
'data' => [ 'value' => 'h' ],
'data' => [
'value' => 'h',
'item-name' => null
],
'isEmpty' => false,
'source' => []
],
@ -321,7 +343,8 @@ class NodeGroupTest extends MediaWikiTestCase {
'label' => '',
'span' => 1,
'layout' => null,
'source' => '1'
'source' => '1',
'item-name' => null
],
'isEmpty' => true,
'source' => [ '1' ]
@ -333,7 +356,8 @@ class NodeGroupTest extends MediaWikiTestCase {
'label' => '',
'span' => 1,
'layout' => null,
'source' => '2'
'source' => '2',
'item-name' => null
],
'isEmpty' => true,
'source' => [ '2' ]
@ -341,7 +365,8 @@ class NodeGroupTest extends MediaWikiTestCase {
],
'layout' => 'default',
'collapse' => null,
'row-items' => null
'row-items' => null,
'item-name' => null
]
]
];

View file

@ -23,15 +23,15 @@ class NodeHeaderTest extends MediaWikiTestCase {
return [
[
'<header></header>',
[ 'value' => '' ]
[ 'value' => '', 'item-name' => null ]
],
[
'<header>kjdflkja dafkjlsdkfj</header>',
[ 'value' => 'kjdflkja dafkjlsdkfj' ]
[ 'value' => 'kjdflkja dafkjlsdkfj', 'item-name' => null ]
],
[
'<header>kjdflkja<ref>dafkjlsdkfj</ref></header>',
[ 'value' => 'kjdflkja<ref>dafkjlsdkfj</ref>' ]
[ 'value' => 'kjdflkja<ref>dafkjlsdkfj</ref>', 'item-name' => null ]
]
];
}

View file

@ -180,7 +180,8 @@ class NodeMediaTest extends MediaWikiTestCase {
'isImage' => true,
'isVideo' => false,
'isAudio' => false,
'source' => 'img'
'source' => 'img',
'item-name' => null
] ]
],
[
@ -195,7 +196,8 @@ class NodeMediaTest extends MediaWikiTestCase {
'isImage' => true,
'isVideo' => false,
'isAudio' => false,
'source' => 'img'
'source' => 'img',
'item-name' => null
] ]
],
[
@ -210,7 +212,8 @@ class NodeMediaTest extends MediaWikiTestCase {
'isImage' => true,
'isVideo' => false,
'isAudio' => false,
'source' => 'img'
'source' => 'img',
'item-name' => null
] ]
],
[
@ -225,7 +228,8 @@ class NodeMediaTest extends MediaWikiTestCase {
'isImage' => true,
'isVideo' => false,
'isAudio' => false,
'source' => 'img'
'source' => 'img',
'item-name' => null
] ]
],
[
@ -240,7 +244,8 @@ class NodeMediaTest extends MediaWikiTestCase {
'isImage' => false,
'isVideo' => true,
'isAudio' => false,
'source' => 'media'
'source' => 'media',
'item-name' => null
] ]
],
[
@ -261,7 +266,8 @@ class NodeMediaTest extends MediaWikiTestCase {
'isImage' => false,
'isVideo' => false,
'isAudio' => true,
'source' => 'media'
'source' => 'media',
'item-name' => null
] ]
],
[

View file

@ -23,15 +23,15 @@ class NodeNavigationTest extends MediaWikiTestCase {
return [
[
'<navigation></navigation>',
[ 'value' => '' ]
[ 'value' => '', 'item-name' => null ]
],
[
'<navigation>kjdflkja dafkjlsdkfj</navigation>',
[ 'value' => 'kjdflkja dafkjlsdkfj' ]
[ 'value' => 'kjdflkja dafkjlsdkfj', 'item-name' => null ]
],
[
'<navigation>kjdflkja<ref>dafkjlsdkfj</ref></navigation>',
[ 'value' => 'kjdflkja<ref>dafkjlsdkfj</ref>' ]
[ 'value' => 'kjdflkja<ref>dafkjlsdkfj</ref>', 'item-name' => null ]
]
];
}

View file

@ -24,57 +24,57 @@ class NodeTitleTest extends MediaWikiTestCase {
[
'<title source="test"/>',
[ 'test' => 'test' ],
[ 'value' => 'test', 'source' => 'test' ]
[ 'value' => 'test', 'source' => 'test', 'item-name' => null ]
],
[
'<title source="test"><default>def</default></title>',
[],
[ 'value' => 'def', 'source' => 'test' ]
[ 'value' => 'def', 'source' => 'test', 'item-name' => null ]
],
[
'<title source="test"><default>def</default></title>',
[],
[ 'value' => 'def', 'source' => 'test' ]
[ 'value' => 'def', 'source' => 'test', 'item-name' => null ]
],
[
'<title source="test"><default>def</default></title>',
[ 'l' => 1 ],
[ 'value' => 'def', 'source' => 'test' ]
[ 'value' => 'def', 'source' => 'test', 'item-name' => null ]
],
[
'<title source="test"><default>def</default></title>',
[ 'l' => 1 ],
[ 'value' => 'def', 'source' => 'test' ]
[ 'value' => 'def', 'source' => 'test', 'item-name' => null ]
],
[
'<title source="test"><default>def</default></title>',
[ 'test' => 1 ],
[ 'value' => 1, 'source' => 'test' ]
[ 'value' => 1, 'source' => 'test', 'item-name' => null ]
],
[
'<title></title>',
[],
[ 'value' => null, 'source' => null ]
[ 'value' => null, 'source' => null, 'item-name' => null ]
],
[
'<title source="test"><format>{{{test}}}%</format><default>def</default></title>',
[ 'test' => 1 ],
[ 'value' => '{{{test}}}%', 'source' => 'test' ]
[ 'value' => '{{{test}}}%', 'source' => 'test', 'item-name' => null ]
],
[
'<title source="test"><format>{{{not_defined_var}}}%</format><default>def</default></title>',
[ 'test' => 1 ],
[ 'value' => '{{{not_defined_var}}}%', 'source' => 'test' ]
[ 'value' => '{{{not_defined_var}}}%', 'source' => 'test', 'item-name' => null ]
],
[
'<title source="test"><format>{{{test}}}%</format><default>def</default></title>',
[],
[ 'value' => 'def', 'source' => 'test' ]
[ 'value' => 'def', 'source' => 'test', 'item-name' => null ]
],
[
'<title source="test"><format>{{{test}}}%</format></title>',
[ 'test' => 0 ],
[ 'value' => '{{{test}}}%', 'source' => 'test' ]
[ 'value' => '{{{test}}}%', 'source' => 'test', 'item-name' => null ]
]
];
}