public function testInlineHelp()
 {
     $exepcted = '<span class="foo help-inline" data-foo="bar">foobar</span>';
     $html = Form::inline_help('foobar', $this->testAttributes);
     $this->assertEquals($exepcted, $html);
 }
Example #2
0
    /**
     * @dataProvider displaytypes
     */
    public function testControlGroupFull($displaytype)
    {
        $class = $displaytype;

        if ($displaytype != '') {
            $class = ' ' . $displaytype;
        }

        // Had to match label and go up to the parent
        // than back down to get the other elements. Odd but can't
        // figure out how to find 3 different child elements
        $matcher = array(
            'tag' => 'label',
            'attributes' => array('for' => 'inputfoo'),
            'content' => 'foo',
            'parent' => array(
                'tag' => 'div',
                'attributes' => array('class' => 'form-group' . $class),
                'child' => array(
                    'tag' => 'input',
                    'attributes' => array(
                        'type' => 'text',
                        'name' => 'inputfoo',
                        'id' => 'inputfoo',
                        'class' => 'form-control'
                    ),
                ),
                'descendant' => array(
                    'tag' => 'span',
                    'attributes' => array('class' => 'help-block'),
                    'content' => 'You foobared that!',
                ),

            ),
        );

        $html = Form::control_group(
            Form::label('inputfoo', 'foo'),
            Form::text('inputfoo'),
            $displaytype,
            Form::inline_help('You foobared that!')
        );

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