mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
3b3b515571
BUGFIX Remove legacy code and template which is never picked-up so that TextareaField becomes 'readonly' when it is transfered to readonly field. Change TextareaFieldTest test cases to address a 'readonly' textarea field displaying the special html characters correctly.
38 lines
1.3 KiB
PHP
38 lines
1.3 KiB
PHP
<?php
|
|
|
|
class TextareaFieldTest extends SapphireTest {
|
|
|
|
/**
|
|
* Quick smoke test to ensure that text is being encoded properly.
|
|
*/
|
|
function testTextEncoding() {
|
|
$inputText = "These are some unicodes: äöü";
|
|
$field = new TextareaField("Test", "Test");
|
|
$field->setValue($inputText);
|
|
$this->assertContains('These are some unicodes: äöü', $field->Field());
|
|
}
|
|
|
|
/**
|
|
* Quick smoke test to ensure that text with unicodes is being displayed properly in readonly fields.
|
|
*/
|
|
function testReadonlyDisplayUnicodes() {
|
|
$inputText = "These are some unicodes: äöü";
|
|
$field = new TextareaField("Test", "Test");
|
|
$field->setValue($inputText);
|
|
$field = $field->performReadonlyTransformation();
|
|
$this->assertContains('These are some unicodes: äöü', $field->Field());
|
|
}
|
|
|
|
/**
|
|
* Quick smoke test to ensure that text with special html chars is being displayed properly in readonly fields.
|
|
*/
|
|
function testReadonlyDisplaySepcialHTML() {
|
|
$inputText = "These are some special <html> chars including 'single' & \"double\" quotations";
|
|
$field = new TextareaField("Test", "Test");
|
|
$field = $field->performReadonlyTransformation();
|
|
$field->setValue($inputText);
|
|
$this->assertContains('These are some special <html> chars including 'single' & "double" quotations', $field->Field());
|
|
}
|
|
|
|
}
|