Space is now properly added inbetween when 'asc'/'desc' class is appended to user defined css class in PaginatorHelper::sort. Fixes #710

This commit is contained in:
ADmad 2010-05-12 00:42:02 +05:30
parent 6e355312bb
commit 3539660cd0
2 changed files with 6 additions and 5 deletions

View file

@ -316,7 +316,7 @@ class PaginatorHelper extends AppHelper {
$dir = $this->sortDir($options['model']) === 'asc' ? 'desc' : 'asc';
$class = $dir === 'asc' ? 'desc' : 'asc';
if (!empty($options['class'])) {
$options['class'] .= $class;
$options['class'] .= ' ' . $class;
} else {
$options['class'] = $class;
}

View file

@ -188,7 +188,6 @@ class PaginatorHelperTest extends CakeTestCase {
$result = $this->Paginator->sort('title');
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
$this->Paginator->params['paging']['Article']['options']['sort'] = null;
$result = $this->Paginator->sort('title');
@ -199,23 +198,25 @@ class PaginatorHelperTest extends CakeTestCase {
$result = $this->Paginator->sort('Title', 'title', array('direction' => 'desc'));
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc');
$this->Paginator->params['paging']['Article']['options']['sort'] = null;
$result = $this->Paginator->sort('Title', 'title', array('direction' => 'asc'));
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
$this->Paginator->params['paging']['Article']['options']['sort'] = null;
$result = $this->Paginator->sort('Title', 'title', array('direction' => 'asc'));
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result);
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
$this->Paginator->params['paging']['Article']['options']['sort'] = null;
$result = $this->Paginator->sort('Title', 'title', array('direction' => 'desc'));
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result);
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
$this->Paginator->params['paging']['Article']['options']['sort'] = null;
$result = $this->Paginator->sort('Title', 'title', array('direction' => 'desc', 'class' => 'foo'));
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:desc" class="foo asc">Title<\/a>$/', $result);
}
/**