Permalink
Browse files

Add test for postLink with escape false + confirm option.

Closes #4008
  • Loading branch information...
1 parent 036954b commit 24123e23740c69885f3ec6afe9989c55ed2935d7 @markstory markstory committed Aug 21, 2013
Showing with 17 additions and 0 deletions.
  1. +17 −0 lib/Cake/Test/Case/View/Helper/FormHelperTest.php
@@ -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'
+ ));
}
/**

0 comments on commit 24123e2

Please sign in to comment.