Skip to content

Commit

Permalink
Add test for postLink with escape false + confirm option.
Browse files Browse the repository at this point in the history
Closes #4008
  • Loading branch information
markstory committed Aug 21, 2013
1 parent 036954b commit 24123e2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/Cake/Test/Case/View/Helper/FormHelperTest.php
Expand Up @@ -6992,6 +6992,23 @@ public function testPostLink() {
'Delete',
'/a'
));

$result = $this->Form->postLink(
'',
array('controller' => 'items', 'action' => 'delete', 10),
array('class' => 'btn btn-danger', 'escape' => false),
'Confirm thing'
);
$this->assertTags($result, array(
'form' => array(
'method' => 'post', 'action' => '/items/delete/10',
'name' => 'preg:/post_\w+/', 'id' => 'preg:/post_\w+/', 'style' => 'display:none;'
),
'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'),
'/form',
'a' => array('class' => 'btn btn-danger', 'href' => '#', 'onclick' => 'preg:/if \(confirm\(\'Confirm thing\'\)\) \{ document\.post_\w+\.submit\(\); \} event\.returnValue = false; return false;/'),
'/a'
));
}

/**
Expand Down

0 comments on commit 24123e2

Please sign in to comment.