コード例 #1
0
ファイル: FormHelperTest.php プロジェクト: UnionCMS/Core
 /**
  * Simple test for textarea html element.
  *
  * @return void
  */
 public function testTextArea()
 {
     $actual = $this->Form->input('test', ['type' => 'textarea']);
     $expected = ['div' => ['class' => 'un-input form-group field-test un-textarea'], 'label' => ['for' => 'test'], 'Test', '/label', 'textarea' => ['name' => 'test', 'rows' => 15, 'class' => 'form-control', 'id' => 'test'], '/textarea', '/div'];
     $this->assertHtml($expected, $actual);
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $actual = $this->Form->input('test', ['type' => 'textarea', 'class' => 'custom-class', 'id' => 'my-id']);
     $expected = ['div' => ['class' => 'un-input form-group field-test un-textarea'], 'label' => ['for' => 'my-id'], 'Test', '/label', 'textarea' => ['name' => 'test', 'rows' => 15, 'class' => 'custom-class form-control', 'id' => 'my-id'], '/textarea', '/div'];
     $this->assertHtml($expected, $actual);
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $actual = $this->Form->textarea('test');
     $expected = ['textarea' => ['name' => 'test', 'rows' => 15, 'class' => 'form-control'], '/textarea'];
     $this->assertHtml($expected, $actual);
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $actual = $this->Form->textarea('test', ['class' => 'custom-class', 'id' => 'my-id']);
     $expected = ['textarea' => ['name' => 'test', 'rows' => 15, 'class' => 'custom-class form-control', 'id' => 'my-id'], '/textarea'];
     $this->assertHtml($expected, $actual);
 }