Paginator Helper prev and next methods are now wrapped in span tags instead of div tags. Tests also modified to support this. Closes #3991

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6795 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
joelmoss 2008-05-10 18:32:51 +00:00
parent 9aa1d645ab
commit df24fff1a2
2 changed files with 7 additions and 4 deletions

View file

@ -311,7 +311,10 @@ class PaginatorHelper extends AppHelper {
if ($this->{$check}()) { if ($this->{$check}()) {
return $this->link($title, $url, array_merge($options, array('escape' => $escape))); return $this->link($title, $url, array_merge($options, array('escape' => $escape)));
} else { } else {
return $this->Html->div(null, $title, $options, $escape); if ($escape) {
$title = h($title);
}
return sprintf('<span%s>%s</span>', $this->_parseAttributes($options), $title);
} }
} }
/** /**

View file

@ -85,12 +85,12 @@ class PaginatorTest extends UnitTestCase {
$this->Paginator->params['paging']['Article']['nextPage'] = false; $this->Paginator->params['paging']['Article']['nextPage'] = false;
$this->Paginator->params['paging']['Article']['page'] = 1; $this->Paginator->params['paging']['Article']['page'] = 1;
$result = $this->Paginator->next('Next', array(), true); $result = $this->Paginator->next('Next', array(), true);
$expected = '<div>Next</div>'; $expected = '<span>Next</span>';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$this->Paginator->params['paging']['Article']['prevPage'] = false; $this->Paginator->params['paging']['Article']['prevPage'] = false;
$result = $this->Paginator->prev('prev', array('update'=> 'theList', 'indicator'=> 'loading', 'url'=> array('controller' => 'posts')), null, array('class' => 'disabled')); $result = $this->Paginator->prev('prev', array('update'=> 'theList', 'indicator'=> 'loading', 'url'=> array('controller' => 'posts')), null, array('class' => 'disabled'));
$expected = '<div class="disabled">prev</div>'; $expected = '<span class="disabled">prev</span>';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
} }
@ -202,7 +202,7 @@ class PaginatorTest extends UnitTestCase {
'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array())) 'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
); );
$result = $this->Paginator->prev('<< Previous', null, null, array('class' => 'disabled')); $result = $this->Paginator->prev('<< Previous', null, null, array('class' => 'disabled'));
$expected = '<div class="disabled">&lt;&lt; Previous</div>'; $expected = '<span class="disabled">&lt;&lt; Previous</span>';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$this->Paginator->params['paging']['Client']['page'] = 2; $this->Paginator->params['paging']['Client']['page'] = 2;