Merge branch '3.5' into 3.5.1

This commit is contained in:
Daniel Hensby 2016-12-19 16:16:26 +00:00
commit 2d8ac831ad
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E
3 changed files with 30 additions and 1 deletions

View File

@ -293,6 +293,7 @@ class PaginatedList extends SS_ListDecorator {
}
$left = max($current - $offset, 1);
$right = min($current + $offset, $total);
$range = range($current - $offset, $current + $offset);
if ($left + $context > $total) {
@ -304,7 +305,7 @@ class PaginatedList extends SS_ListDecorator {
$num = $i + 1;
$emptyRange = $num != 1 && $num != $total && (
$num == $left - 1 || $num == $left + $context + 1
$num == $left - 1 || $num == $right + 1
);
if ($emptyRange) {

View File

@ -15,6 +15,20 @@ class HtmlEditorFieldTest extends FunctionalTest {
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() {
$obj = new HtmlEditorFieldTest_Object();
$editor = new HtmlEditorField('Content');

View File

@ -2,6 +2,20 @@
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.
*/