예제 #1
0
 function testElements()
 {
     $form = new QForm('form1', self::URL1);
     $form->add(QForm::ELEMENT, 'username', array('_ui' => 'textbox', 'maxlength' => 15, 'class' => 'input'))->add(QForm::ELEMENT, 'password', array('_ui' => 'password', 'class' => 'input'));
     $this->assertTrue($form->existsElement('username'));
     $this->assertTrue($form->existsElement('password'));
     $this->assertEquals('textbox', $form->element('username')->_ui);
     $this->assertEquals('password', $form->element('password')->_ui);
     $form->remove('password');
     $this->assertFalse($form->existsElement('password'));
     $attrs = $form['username']->attrs();
     $this->assertEquals(array('id' => 'username', 'name' => 'username', 'maxlength' => 15, 'class' => 'input'), $attrs);
     $all_attrs = $form['username']->allAttrs();
     $this->assertEquals(array('id' => 'username', 'name' => 'username', 'maxlength' => 15, 'class' => 'input', '_ui' => 'textbox', '_data_binding' => true, '_nested_name' => 'form1'), $all_attrs);
     unset($form['username']);
     $this->assertFalse($form->existsElement('username'));
     $this->assertFalse(isset($form['username']));
 }