You are here

function MaxlengthTestCase::testTitle in Maxlength 7.3

Same name and namespace in other branches
  1. 8 maxlength.test \MaxlengthTestCase::testTitle()

Test title field.

File

./maxlength.test, line 68
Test maxlength module.

Class

MaxlengthTestCase
@file Test maxlength module.

Code

function testTitle() {
  $this
    ->drupalLogin($this->admin);
  $edit = array(
    'maxlength_js' => rand(50, 100),
    'maxlength_js_label' => $this
      ->randomString(30),
  );
  $this
    ->drupalPost('admin/structure/types/manage/' . $this->hyphen_type . '/edit', $edit, t('Save content type'));
  $this
    ->drupalGet('node/add/' . $this->hyphen_type);

  // Check the maxlength html attributes.
  $elements = $this
    ->xpath('//input[@id=:id]', array(
    ':id' => 'edit-title',
  ));

  /*
      foreach ($elements[0]->attributes() as $key => $value) {
        switch ($key) {
          case 'class':
            $this->assertTrue(strpos($value, 'maxlength'), 'Take sure the maxlength class is existant');
            break;

          case 'maxlength_js':
            $this->assertTrue($value, 'Take sure that the maxlenght_js attribute is set.');
            break;

          case 'maxlength_js_label':
            $this->assertEqual($edit['maxlength_js_label'], $value, 'Take sure that the maxlenght_js_label is the defined one.');
            break;

          case 'maxlength':
            $this->assertEqual($edit['maxlenght_js'], $value);
            break;
        }
      }
  */
}