| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 10 require_once('limb/wact/src/components/form/form.inc.php'); 11 12 class WactFormMultipleTagTest extends WactTemplateTestCase 13 { 14 function testChildFormElementsNamesWrapping() 15 { 16 $template = '<form_multiple id="testForm" name="testForm"> 17 <label id="testLabel" name="label" for="testId">A label</label> 18 <input id="testInput" name="testInput" type="text"/> 19 </form_multiple>'; 20 21 $this->registerTestingTemplate('/form/multiple/elements_name_wrapping.html', $template); 22 23 $page = $this->initTemplate('/form/multiple/elements_name_wrapping.html'); 24 25 $input = $page->getChild('testInput'); 26 $label = $page->getChild('testLabel'); 27 28 $this->assertEqual($input->getAttribute('name'), 'testForm[testInput]'); 29 $this->assertEqual($label->getAttribute('name'), 'label'); 30 } 31 32 function testChildFormElementsNamesWrappingFilter() 33 { 34 $template = '<form_multiple id="testForm" name="testForm"> 35 <input id="testInput" name="{$\'testInput\'|uppercase}" type="text"/> 36 </form_multiple>'; 37 38 $this->registerTestingTemplate('/form/multiple/elements_name_wrapping_filter.html', $template); 39 40 $page = $this->initTemplate('/form/multiple/elements_name_wrapping_filter.html'); 41 42 $input = $page->getChild('testInput'); 43 44 $this->assertEqual($input->getAttribute('name'), 'testForm[TESTINPUT]'); 45 } 46 47 function testChildFormElementsNamesWrappingDBE() 48 { 49 $template = '<core:SET name="testinput" runtime="false"/> 50 <form_multiple id="testForm" name="testForm"> 51 <input id="testInput" name="{$^name|uppercase}" type="text"/> 52 </form_multiple>'; 53 54 $this->registerTestingTemplate('/form/multiple/elements_name_wrapping_dbe.html', $template); 55 56 $page = $this->initTemplate('/form/multiple/elements_name_wrapping_dbe.html'); 57 58 $input = $page->getChild('testInput'); 59 60 $this->assertEqual($input->getAttribute('name'), 'testForm[TESTINPUT]'); 61 } 62 63 function testChildFormElementsComplicatedNamesWrapping() 64 { 65 $template = '<form_multiple id="testForm" name="testForm"> 66 <input id="testInput" name="wow[wrap][testInput]" type="text"/> 67 </form_multiple>'; 68 69 $this->registerTestingTemplate('/form/multiple/elements_name_wrapping_comples.html', $template); 70 71 $page = $this->initTemplate('/form/multiple/elements_name_wrapping_comples.html'); 72 73 $input = $page->getChild('testInput'); 74 75 $this->assertEqual($input->getAttribute('name'), 'testForm[wow][wrap][testInput]'); 76 } 77 78 function testElementsNamesWrappingInDeeperComponent() 79 { 80 $template = '<form_multiple id="testForm" name="testForm"> 81 <div id="wow" runat="server"> 82 <input id="testInput" name="testInput" type="text"/> 83 </div> 84 </form_multiple>'; 85 86 $this->registerTestingTemplate('/form/multiple/elements_name_wrapping_in_deeper_component.html', $template); 87 88 $page = $this->initTemplate('/form/multiple/elements_name_wrapping_in_deeper_component.html'); 89 90 $input = $page->getChild('testInput'); 91 92 $this->assertEqual($input->getAttribute('name'), 'testForm[testInput]'); 93 } 94 95 function testRenderAsCommonForm() 96 { 97 $template = '<form_multiple id="testForm" name="testForm"></form_multiple>'; 98 99 $this->registerTestingTemplate('/form/multiple/render_as_regular_form.html', $template); 100 101 $page = $this->initTemplate('/form/multiple/render_as_regular_form.html'); 102 $result = $page->capture(); 103 104 $this->assertEqual($result, '<form id="testForm" name="testForm"></form>'); 105 } 106 107 function testFormComponentsReceiveValues() 108 { 109 $template = '<form_multiple id="testForm" name="testForm"> 110 <input id="testInput" name="testInput" type="text"/> 111 </form_multiple>'; 112 113 $this->registerTestingTemplate('/form/multiple/form_elements_accept_values.html', $template); 114 115 $page = $this->initTemplate('/form/multiple/form_elements_accept_values.html'); 116 117 $form = $page->getChild('testForm'); 118 119 $form->registerDatasource(array('testInput' => 'Hello')); 120 121 $input = $page->getChild('testInput'); 122 $this->assertEqual($input->getValue(), 'Hello'); 123 } 124 } 125 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jan 8 04:06:23 2009 | Cross-referenced by PHPXref 0.7 |