Esempio n. 1
0
 /**
  * Tests resetInput with setDefault
  *
  * @author Nikolaos Dimopoulos <*****@*****.**>
  * @since  2014-09-05
  */
 public function testResetInputWithSetDefault()
 {
     $this->specify("resetInput with setDefault returns invalid HTML Strict", function () {
         Tag::setDoctype(Tag::XHTML10_STRICT);
         $options = 'x_name';
         $expected = '<input type="text" id="x_name" name="x_name" ' . 'value="x_other" />';
         Tag::setDefault('x_name', 'x_other');
         $actual = Tag::textField($options);
         Tag::resetInput();
         expect($actual)->equals($expected);
         $expected = '<input type="text" id="x_name" name="x_name" />';
         $actual = Tag::textField($options);
         expect($actual)->equals($expected);
     });
     $this->specify("resetInput with setDefault returns invalid HTML XHTML", function () {
         Tag::setDoctype(Tag::HTML5);
         $options = 'x_name';
         $expected = '<input type="text" id="x_name" ' . 'name="x_name" value="x_other">';
         Tag::setDefault('x_name', 'x_other');
         $actual = Tag::textField($options);
         Tag::resetInput();
         expect($actual)->equals($expected);
         $expected = '<input type="text" id="x_name" name="x_name">';
         $actual = Tag::textField($options);
         expect($actual)->equals($expected);
     });
 }
Esempio n. 2
0
 /**
  * Tests setDefault
  *
  * @issue  2402
  * @author Dmitry Patsura <*****@*****.**>
  * @since  2014-05-10
  */
 public function testDisplayValues()
 {
     $this->specify("setDefault does not assigns default values to generated tags by helpers", function () {
         Tag::setDefault('property1', 'testVal1');
         Tag::setDefault('property2', 'testVal2');
         Tag::setDefault('property3', 'testVal3');
         expect(Tag::hasValue('property1'))->true();
         expect(Tag::hasValue('property2'))->true();
         expect(Tag::hasValue('property3'))->true();
         expect(Tag::hasValue('property4'))->false();
         expect(Tag::getValue('property1'))->equals('testVal1');
         expect(Tag::getValue('property2'))->equals('testVal2');
         expect(Tag::getValue('property3'))->equals('testVal3');
     });
 }
Esempio n. 3
0
 /**
  * Tests selectStatic with setDefault and element not present
  *
  * @author Nikolaos Dimopoulos <*****@*****.**>
  * @since  2014-09-05
  */
 public function testSelectStaticOptGroupWithSetDefaultElementNotPresent()
 {
     $this->specify("selectStatic with setDefault and element not present returns invalid HTML", function () {
         Tag::resetInput();
         $params = ['x_name', 'name' => 'x_other', 'class' => 'x_class', 'size' => '10'];
         $options = ["Active" => ['A1' => 'A One', 'A2' => 'A Two'], "B" => "B One"];
         $expected = '<select id="x_name" name="x_other" class="x_class" size="10">' . PHP_EOL . chr(9) . '<optgroup label="Active">' . PHP_EOL . chr(9) . '<option value="A1">A One</option>' . PHP_EOL . chr(9) . '<option value="A2">A Two</option>' . PHP_EOL . chr(9) . '</optgroup>' . PHP_EOL . chr(9) . '<option value="B">B One</option>' . PHP_EOL . '</select>';
         Tag::setDefault('x_name', 'I');
         $actual = Tag::selectStatic($params, $options);
         Tag::resetInput();
         expect($actual)->equals($expected);
     });
 }
Esempio n. 4
0
 /**
  * Tests textArea with displayTo and newline in value
  *
  * @author Nikolaos Dimopoulos <*****@*****.**>
  * @since  2014-10-03
  */
 public function testTextAreaWithDisplayToAndNewlineInValue()
 {
     $this->specify("textArea with displayTo and newline in value", function () {
         $options = 'x_name';
         $value = "\r\nx_content";
         $expected = '<textarea id="x_name" name="x_name">' . $value . '</textarea>';
         Tag::setDefault('x_name', $value);
         $actual = Tag::textArea($options);
         Tag::setDefault('x_name', '');
         expect($actual)->equals($expected);
     });
 }