Permalink
Browse files

Space is now properly added inbetween when 'asc'/'desc' class is appe…

…nded to user defined css class in PaginatorHelper::sort. Fixes #710
  • Loading branch information...
1 parent 6e35531 commit 3539660cd042fd028d9e63b455403b8941c6b980 @ADmad ADmad committed May 11, 2010
Showing with 6 additions and 5 deletions.
  1. +1 −1 cake/libs/view/helpers/paginator.php
  2. +5 −4 cake/tests/cases/libs/view/helpers/paginator.test.php
@@ -316,7 +316,7 @@ function sort($title, $key = null, $options = array()) {
$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;
}
@@ -188,7 +188,6 @@ function testSortLinks() {
$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 @@ function testSortLinks() {
$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);
}
/**

0 comments on commit 3539660

Please sign in to comment.