'',
];
$this->templates = new StringTemplate($templates);
}
/**
* Test render in a simple case.
*
* @return void
*/
public function testRenderSimple() {
$input = new Textarea($this->templates);
$result = $input->render(['name' => 'comment']);
$expected = [
'textarea' => ['name' => 'comment'],
'/textarea',
];
$this->assertTags($result, $expected);
}
/**
* Test render with a value
*
* @return void
*/
public function testRenderWithValue() {
$input = new Textarea($this->templates);
$data = ['name' => 'comment', 'data-foo' => '', 'val' => 'some '];
$result = $input->render($data);
$expected = [
'textarea' => ['name' => 'comment', 'data-foo' => '<val>'],
'some <html>',
'/textarea',
];
$this->assertTags($result, $expected);
$data['escape'] = false;
$result = $input->render($data);
$expected = [
'textarea' => ['name' => 'comment', 'data-foo' => ''],
'some ',
'/textarea',
];
$this->assertTags($result, $expected);
}
}