Permalink
Browse files

add testInputWithValue

  • Loading branch information...
1 parent 35e16a0 commit cad20378c83e4abe5bcc05f936a058ca93b307ad @scribu committed Feb 21, 2013
Showing with 20 additions and 0 deletions.
  1. +20 −0 tests/test-forms.php
View
@@ -17,6 +17,26 @@ function testTextInput() {
$this->assertEquals( '<em>foobar</em>', $el->attr('value') );
}
+ function testInputWithValue() {
+ $data = array(
+ 'foo' => array(
+ 'bar' => 42
+ ),
+ 'bar' => 'wrong'
+ );
+
+ $output = scbForms::input( array(
+ 'name' => array( 'foo', 'bar' ),
+ 'type' => 'text',
+ 'value' => '<em>foobar</em>'
+ ), $data );
+
+ $el = self::domify( $output )->find('//input');
+
+ $this->assertEquals( 'foo[bar]', $el->attr('name') );
+ $this->assertEquals( 42, $el->attr('value') );
+ }
+
function testTextarea() {
$fd = self::domify( scbForms::input( array(
'name' => __FUNCTION__,

0 comments on commit cad2037

Please sign in to comment.