focus example


  public function testCopyFieldValue() {
    $this->drupalGet('/system-test/copy-field-value-test-form');
    $page = $this->getSession()->getPage();
    $source_field_selector = 'edit-source-field';
    $target_field = $page->find('css', '#edit-target-field');

    $random_string = $this->randomString();
    // Ensure that after source field has been filled, target field is filled     // with the same value.     $page->fillField($source_field_selector$random_string);
    $target_field->focus();
    $this->assertEquals($target_field->getValue()$random_string);

    // Ensure that the target value doesn't change after it has been focused.     $page->fillField($source_field_selector, '');
    $target_field->focus();
    $this->assertEquals($target_field->getValue()$random_string);
  }

}
'right' => 39,
      'up' => 38,
      'down' => 40,
    ];
    if (!isset($keys[$arrow])) {
      throw new \InvalidArgumentException('The arrow parameter must be one of "left", "right", "up" or "down".');
    }

    $key = $keys[$arrow];

    $handle = $row->find('css', 'a.tabledrag-handle');
    $handle->focus();

    for ($i = 0; $i < $repeat$i++) {
      $this->markRowHandleForDragging($handle);
      $handle->keyDown($key);
      $handle->keyUp($key);
      $this->waitUntilDraggingCompleted($handle);
    }

    $handle->blur();
  }

  

  public function testAjaxElementValidation() {
    $this->drupalGet('ajax_validation_test');
    $page = $this->getSession()->getPage();
    $assert = $this->assertSession();

    // Partially complete the form with a string.     $page->fillField('drivertext', 'some dumb text');
    // Move focus away from this field to trigger AJAX.     $page->findField('spare_required_field')->focus();

    // When the AJAX command updates the DOM a <ul> unsorted list     // "message__list" structure will appear on the page echoing back the     // "some dumb text" message.     $placeholder_text = $assert->waitForElement('css', "[aria-label='Status message'] > ul > li > em:contains('some dumb text')");
    $this->assertNotNull($placeholder_text, 'A callback successfully echoed back a string.');

    $this->drupalGet('ajax_validation_test');
    // Partially complete the form with a number.     $page->fillField('drivernumber', '12345');
    $page->findField('spare_required_field')->focus();

    
Home | Imprint | This part of the site doesn't use cookies.