Permalink
Browse files

test description for <select> elements

  • Loading branch information...
scribu committed Feb 21, 2013
1 parent c1d6c45 commit 986e48fe35519e2623f9ae62b8555029787cb463
Showing with 9 additions and 10 deletions.
  1. +9 −10 tests/test-forms.php
View
@@ -138,15 +138,11 @@ function testCheckboxWithValues() {
$selected = array( 'a', 'c' );
$choices = array( 'a', 'b', 'c', 'd' );
- $data = array(
- __FUNCTION__ => $selected
- );
-
- $output = scbForms::input( array(
+ $output = scbForms::input_with_value( array(
'name' => __FUNCTION__,
'type' => 'checkbox',
'choices' => $choices
- ), $data );
+ ), $selected );
$labels = self::domify( $output )->find('//label');
@@ -183,12 +179,15 @@ function testSelect() {
'name' => __FUNCTION__,
'type' => 'select',
'choices' => $choices,
+ 'desc' => 'Some extra text'
);
// no pre-selected value
- $fd = self::domify( scbForms::input( $args ) );
+ $label = self::domify( scbForms::input( $args ) )->find('//label');
+
+ $this->assertStringEndsWith( 'Some extra text', $label->text() );
- $options = $fd->find('//select/option');
+ $options = $label->find('.//select/option');
$this->assertCount( count( $choices ), $options );
@@ -203,9 +202,9 @@ function testSelect() {
}
// pre-select a value
- $fd = self::domify( scbForms::input( array_merge( $args, array( 'selected' => '1 1/3' ) ) ) );
+ $label = self::domify( scbForms::input( array_merge( $args, array( 'selected' => '1 1/3' ) ) ) )->find('//label');
- $selected = $fd->find('//select/option[@selected]');
+ $selected = $label->find('.//select/option[@selected]');
$this->assertCount( 1, $selected );

0 comments on commit 986e48f

Please sign in to comment.