public function addOption( $name, $value = false ) {
// Stab stab stab
$value = ($value !== false) ? $value : $name;
- $this->options[] = Xml::option( $name, $value, $value === $this->default );
+ $this->options[] = array( $name => $value ); //Xml::option( $name, $value, $value === $this->default );
}
/**
* @param $options
*/
public function addOptions( $options ) {
- $this->options[] = trim( self::formatOptions( $options, $this->default ) );
+ $this->options[] = $options;
}
/**
* @return string
*/
public function getHTML() {
- return Xml::tags( 'select', $this->attributes, implode( "\n", $this->options ) );
+ $contents = '';
+ foreach ( $this->options as $options ) {
+ $contents .= self::formatOptions( $options, $this->default );
+ }
+ return Xml::tags( 'select', $this->attributes, rtrim( $contents ) );
}
}
* To handle this, we need to render the options in getHtml()
*/
public function testSetDefaultAfterAddingOptions() {
- $this->markTestSkipped( 'XmlSelect::setDefault() need to apply to previously added options');
-
$this->select->addOption( 'foo1' );
$this->select->addOption( 'bar1' );
$this->select->addOption( 'foo2' );