Index: trunk/phase3/tests/phpunit/includes/XmlSelectTest.php |
— | — | @@ -90,8 +90,6 @@ |
91 | 91 | * To handle this, we need to render the options in getHtml() |
92 | 92 | */ |
93 | 93 | public function testSetDefaultAfterAddingOptions() { |
94 | | - $this->markTestSkipped( 'XmlSelect::setDefault() need to apply to previously added options'); |
95 | | - |
96 | 94 | $this->select->addOption( 'foo1' ); |
97 | 95 | $this->select->addOption( 'bar1' ); |
98 | 96 | $this->select->addOption( 'foo2' ); |
Index: trunk/phase3/includes/Xml.php |
— | — | @@ -863,7 +863,7 @@ |
864 | 864 | public function addOption( $name, $value = false ) { |
865 | 865 | // Stab stab stab |
866 | 866 | $value = ($value !== false) ? $value : $name; |
867 | | - $this->options[] = Xml::option( $name, $value, $value === $this->default ); |
| 867 | + $this->options[] = array( $name => $value ); //Xml::option( $name, $value, $value === $this->default ); |
868 | 868 | } |
869 | 869 | |
870 | 870 | /** |
— | — | @@ -874,7 +874,7 @@ |
875 | 875 | * @param $options |
876 | 876 | */ |
877 | 877 | public function addOptions( $options ) { |
878 | | - $this->options[] = trim( self::formatOptions( $options, $this->default ) ); |
| 878 | + $this->options[] = $options; |
879 | 879 | } |
880 | 880 | |
881 | 881 | /** |
— | — | @@ -904,7 +904,11 @@ |
905 | 905 | * @return string |
906 | 906 | */ |
907 | 907 | public function getHTML() { |
908 | | - return Xml::tags( 'select', $this->attributes, implode( "\n", $this->options ) ); |
| 908 | + $contents = ''; |
| 909 | + foreach ( $this->options as $options ) { |
| 910 | + $contents .= self::formatOptions( $options, $this->default ); |
| 911 | + } |
| 912 | + return Xml::tags( 'select', $this->attributes, rtrim( $contents ) ); |
909 | 913 | } |
910 | 914 | |
911 | 915 | } |