mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
parent
1ea4f29dbe
commit
c007e85d1b
@ -26,14 +26,6 @@ class HtmlEditorField extends TextareaField {
|
|||||||
*/
|
*/
|
||||||
private static $sanitise_server_side = false;
|
private static $sanitise_server_side = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* @config
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private static $casting = array(
|
|
||||||
'Value' => 'HTMLText',
|
|
||||||
);
|
|
||||||
|
|
||||||
protected $rows = 30;
|
protected $rows = 30;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
class TextareaField extends FormField {
|
class TextareaField extends FormField {
|
||||||
|
|
||||||
private static $casting = array(
|
private static $casting = array(
|
||||||
'Value' => 'HTMLText',
|
'Value' => 'HTMLText(array("shortcodes" => 0))',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,6 +15,20 @@ class HtmlEditorFieldTest extends FunctionalTest {
|
|||||||
|
|
||||||
protected $extraDataObjects = array('HtmlEditorFieldTest_Object');
|
protected $extraDataObjects = array('HtmlEditorFieldTest_Object');
|
||||||
|
|
||||||
|
public function testCasting() {
|
||||||
|
// Test special characters
|
||||||
|
$inputText = "These are some unicodes: ä, ö, & ü";
|
||||||
|
$field = new HTMLEditorField("Test", "Test");
|
||||||
|
$field->setValue($inputText);
|
||||||
|
$this->assertContains('These are some unicodes: ä, ö, & ü', $field->Field());
|
||||||
|
|
||||||
|
// Test shortcodes
|
||||||
|
$inputText = "Shortcode: [file_link id=4]";
|
||||||
|
$field = new HTMLEditorField("Test", "Test");
|
||||||
|
$field->setValue($inputText);
|
||||||
|
$this->assertContains('Shortcode: [file_link id=4]', $field->Field());
|
||||||
|
}
|
||||||
|
|
||||||
public function testBasicSaving() {
|
public function testBasicSaving() {
|
||||||
$obj = new HtmlEditorFieldTest_Object();
|
$obj = new HtmlEditorFieldTest_Object();
|
||||||
$editor = new HtmlEditorField('Content');
|
$editor = new HtmlEditorField('Content');
|
||||||
|
@ -2,6 +2,20 @@
|
|||||||
|
|
||||||
class TextareaFieldTest extends SapphireTest {
|
class TextareaFieldTest extends SapphireTest {
|
||||||
|
|
||||||
|
public function testCasting() {
|
||||||
|
// Test special characters
|
||||||
|
$inputText = "These are some unicodes: ä, ö, & ü";
|
||||||
|
$field = new TextareaField("Test", "Test");
|
||||||
|
$field->setValue($inputText);
|
||||||
|
$this->assertContains('These are some unicodes: ä, ö, & ü', $field->Field());
|
||||||
|
|
||||||
|
// Test shortcodes
|
||||||
|
$inputText = "Shortcode: [file_link id=4]";
|
||||||
|
$field = new TextareaField("Test", "Test");
|
||||||
|
$field->setValue($inputText);
|
||||||
|
$this->assertContains('Shortcode: [file_link id=4]', $field->Field());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Quick smoke test to ensure that text with unicodes is being displayed properly in readonly fields.
|
* Quick smoke test to ensure that text with unicodes is being displayed properly in readonly fields.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user