Example #1
0
    public function testPrependButtons()
    {
        $html = Form::prepend_buttons(
            Form::text('appendedInputButton'),
            array(Form::button('Search'), Form::button('Options'))
        );


        $matcher = array(
            'tag' => 'button',
            'attributes' => array(
                'class' => 'btn-default btn',
                'type' => 'button'
            ),
            'content' => 'Search',
            'parent' => array(
                'tag' => 'span',
                'attributes' => array(
                    'class' => 'input-group-btn'
                ),
                'parent' => array(
                    'tag' => 'div',
                    'attributes' => array(
                        'class' => 'input-group'
                    ),
                    'child' => array(
                        'tag' => 'input',
                        'attributes' => array(
                            'class' => 'form-control',
                            'type' => 'text',
                            'name' => 'appendedInputButton'
                        ),
                    ),
                    'descendant' => array(
                        'tag' => 'span',
                        'attributes' => array(
                            'class' => 'input-group-btn'
                        ),
                        'child' => array(
                            'tag' => 'button',
                            'attributes' => array(
                                'class' => 'btn-default btn',
                                'type' => 'button'
                            ),
                            'content' => 'Options',
                        ),
                    ),
                ),
            ),
        );

        $this->assertHTML($matcher, $html);
    }