2
0

SpinnerTest.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category ZendX
  16. * @package ZendX_JQuery
  17. * @subpackage View
  18. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. require_once "jQueryTestCase.php";
  23. require_once "ZendX/JQuery/View/Helper/Spinner.php";
  24. class ZendX_JQuery_View_SpinnerTest extends ZendX_JQuery_View_jQueryTestCase
  25. {
  26. public function testCallingInViewEnablesJQueryHelper()
  27. {
  28. $element = $this->view->spinner("element", "");
  29. $this->assertTrue($this->jquery->isEnabled());
  30. $this->assertTrue($this->jquery->uiIsEnabled());
  31. }
  32. public function testShouldAppendToJqueryHelper()
  33. {
  34. $element = $this->view->spinner("elem1", "", array("option" => "true"));
  35. $jquery = $this->view->jQuery()->__toString();
  36. $this->assertContains('spinner(', $jquery);
  37. $this->assertContains('"option":"true"', $jquery);
  38. }
  39. public function testShouldCreateInputElement()
  40. {
  41. $element = $this->view->spinner("elem1");
  42. $this->assertEquals(array('$("#elem1").spinner({});'), $this->jquery->getOnLoadActions());
  43. $this->assertContains('<input', $element);
  44. $this->assertContains('id="elem1"', $element);
  45. }
  46. public function testNumericValueShouldBecomeStartOptionParameterIfNoneGiven()
  47. {
  48. $element = $this->view->spinner("elem1", "100");
  49. $this->assertEquals(array('$("#elem1").spinner({"start":"100"});'), $this->jquery->getOnLoadActions());
  50. }
  51. }