Skip to content
Permalink
Browse files

Applying fixes made to JavascriptHelper to JsBaseEngine.

  • Loading branch information...
markstory committed Feb 18, 2010
1 parent 2209f19 commit 96bbbb2d72891b5d04b2b401339f29b2b87e6d25
Showing with 9 additions and 2 deletions.
  1. +1 −1 cake/libs/view/helpers/js.php
  2. +8 −1 cake/tests/cases/libs/view/helpers/js.test.php
@@ -590,7 +590,7 @@ function object($data = array(), $options = array()) {
foreach ($data as $key => $val) {
if (is_array($val) || is_object($val)) {
$val = $this->object($val, $options);
$val = $this->object($val);
} else {
$val = $this->value($val);
}
@@ -502,7 +502,7 @@ function testSetVarsAtTopOfBufferedScripts() {
$this->Js->alert('hey you!', array('buffer' => true));
$this->Js->confirm('Are you sure?', array('buffer' => true));
$result = $this->Js->getBuffer(false);
$expected = 'window.app = {"height":"tall","color":"purple"};';
$this->assertEqual($result[0], $expected);
$this->assertEqual($result[1], 'alert("hey you!");');
@@ -665,6 +665,13 @@ function testObject() {
$result = $this->JsEngine->object($data);
$this->assertEqual($result, $expected);
}
$object = array('title' => 'New thing', 'indexes' => array(5, 6, 7, 8), 'object' => array('inner' => array('value' => 1)));
$result = $this->JsEngine->object($object, array('prefix' => 'PREFIX', 'postfix' => 'POSTFIX'));
$this->assertPattern('/^PREFIX/', $result);
$this->assertPattern('/POSTFIX$/', $result);
$this->assertNoPattern('/.PREFIX./', $result);
$this->assertNoPattern('/.POSTFIX./', $result);
}
/**

0 comments on commit 96bbbb2

Please sign in to comment.
You can’t perform that action at this time.