Adding tests for #2371

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4891 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mariano.iglesias 2007-04-28 07:42:54 +00:00
parent 9b8f81cc82
commit abb287180d
2 changed files with 18 additions and 0 deletions

View file

@ -585,6 +585,12 @@ class FormHelperTest extends CakeTestCase {
$result = $this->Form->submit('Test Submit', array('div' => array('id' => 'SaveButton')));
$this->assertPattern('/^<div[^<>]+id="SaveButton"[^<>]*><input type="submit"[^<>]+value="Test Submit"[^<>]+\/><\/div>$/', $result);
$this->assertNoPattern('/<input[^<>]+[^type|value]=[^<>]*>/', $result);
$result = $this->Form->submit('Next >');
$this->assertPattern('/^<div\s+class="submit"><input type="submit"[^<>]+value="Next &gt;"[^<>]+\/><\/div>$/', $result);
$result = $this->Form->submit('Next >', array('escape'=>false));
$this->assertPattern('/^<div\s+class="submit"><input type="submit"[^<>]+value="Next >"[^<>]+\/><\/div>$/', $result);
}
function testFormCreate() {

View file

@ -47,6 +47,18 @@ class HtmlHelperTest extends UnitTestCase {
ClassRegistry::addObject('view', $view);
}
function testLinkEscape() {
$result = $this->Html->link('Next >', '#');
$expected = '/^<a href="#"\s+>Next &gt;<\/a>$/';
$this->assertPattern($expected, $result);
$result = $this->Html->link('Next >', '#', array('escape' => false));
$expected = '/^<a href="#"\s+>Next ><\/a>$/';
$this->assertPattern($expected, $result);
}
function testImageLink() {
$result = $this->Html->link($this->Html->image('test.gif'), '#', array(), false, false, false);
$expected = '/^<a href="#"\s+><img\s+src="img\/test.gif"\s+alt=""\s+\/><\/a>$/';