mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Adding test cases for alert, confirm, prompt
This commit is contained in:
parent
c92cfa7238
commit
1c2cd94786
1 changed files with 42 additions and 0 deletions
|
@ -81,6 +81,48 @@ class JsHelperTestCase extends CakeTestCase {
|
||||||
$expected = 'my \\\"string\\\"';
|
$expected = 'my \\\"string\\\"';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* test prompt() creation
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
function testPrompt() {
|
||||||
|
$result = $this->Js->prompt('Hey, hey you', 'hi!');
|
||||||
|
$expected = 'prompt("Hey, hey you", "hi!");';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$result = $this->Js->prompt('"Hey"', '"hi"');
|
||||||
|
$expected = 'prompt("\"Hey\"", "\"hi\"");';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* test alert generation
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
function testAlert() {
|
||||||
|
$result = $this->Js->alert('Hey there');
|
||||||
|
$expected = 'alert("Hey there");';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$result = $this->Js->alert('"Hey"');
|
||||||
|
$expected = 'alert("\"Hey\"");';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* test confirm generation
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
function testConfirm() {
|
||||||
|
$result = $this->Js->confirm('Are you sure?');
|
||||||
|
$expected = 'confirm("Are you sure?");';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$result = $this->Js->confirm('"Are you sure?"');
|
||||||
|
$expected = 'confirm("\"Are you sure?\"");';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue