*/
public function testExpandAttributesSkipsNullAndFalse() {
- ### EMPTY ########
+ # ## EMPTY ########
$this->assertEmpty(
Html::expandAttributes( array( 'foo' => null ) ),
'skip keys with null value'
* @covers Html::expandAttributes
*/
public function testExpandAttributesVariousExpansions() {
- ### NOT EMPTY ####
+ # ## NOT EMPTY ####
$this->assertEquals(
' empty_string=""',
Html::expandAttributes( array( 'empty_string' => '' ) ),
* @covers Html::expandAttributes
*/
public function testExpandAttributesListValueAttributes() {
- ### STRING VALUES
+ # ## STRING VALUES
$this->assertEquals(
' class="redundant spaces here"',
Html::expandAttributes( array( 'class' => ' redundant spaces here ' ) ),
Html::expandAttributes( array( 'class' => 'foo bar foo bar bar' ) ),
'Normalization should remove duplicates in string-lists'
);
- ### "EMPTY" ARRAY VALUES
+ # ## "EMPTY" ARRAY VALUES
$this->assertEquals(
' class=""',
Html::expandAttributes( array( 'class' => array() ) ),
Html::expandAttributes( array( 'class' => array( null, '', ' ', ' ' ) ) ),
'Array with null, empty string and spaces'
);
- ### NON-EMPTY ARRAY VALUES
+ # ## NON-EMPTY ARRAY VALUES
$this->assertEquals(
' class="foo bar"',
Html::expandAttributes( array( 'class' => array(
# Will be mapped to Html::element()
$cases = array();
- ### Generic cases, match $attribDefault static array
+ # ## Generic cases, match $attribDefault static array
$cases[] = array( '<area>',
'area', array( 'shape' => 'rect' )
);
'textarea', array( 'wrap' => 'soft' )
);
- ### SPECIFIC CASES
+ # ## SPECIFIC CASES
# <link type="text/css">
$cases[] = array( '<link>',
'Label wrapper'
);
}
+
+ public static function provideSrcSetImages() {
+ return array(
+ array( array(), '', 'when there are no images, return empty string' ),
+ array(
+ array( '1x' => '1x.png', '1.5x' => '1_5x.png', '2x' => '2x.png' ),
+ '1x.png 1x, 1_5x.png 1.5x, 2x.png 2x',
+ 'pixel depth keys may include a trailing "x"'
+ ),
+ array(
+ array( '1' => '1x.png', '1.5' => '1_5x.png', '2' => '2x.png' ),
+ '1x.png 1x, 1_5x.png 1.5x, 2x.png 2x',
+ 'pixel depth keys may omit a trailing "x"'
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider provideSrcSetImages
+ * @covers Html::srcSet
+ */
+ public function testSrcSet( $images, $expected, $message ) {
+ $this->assertEquals( Html::srcSet( $images ), $expected, $message );
+ }
}
class HtmlTestValue {