diff core/modules/system/src/Tests/Ajax/AjaxInGroupTest.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/modules/system/src/Tests/Ajax/AjaxInGroupTest.php	Wed Nov 29 16:09:58 2017 +0000
@@ -0,0 +1,32 @@
+<?php
+
+namespace Drupal\system\Tests\Ajax;
+
+/**
+ * Tests that form elements in groups work correctly with AJAX.
+ *
+ * @group Ajax
+ */
+class AjaxInGroupTest extends AjaxTestBase {
+  protected function setUp() {
+    parent::setUp();
+
+    $this->drupalLogin($this->drupalCreateUser(['access content']));
+  }
+
+  /**
+   * Submits forms with select and checkbox elements via Ajax.
+   */
+  public function testSimpleAjaxFormValue() {
+    $this->drupalGet('/ajax_forms_test_get_form');
+    $this->assertText('Test group');
+    $this->assertText('AJAX checkbox in a group');
+
+    $this->drupalPostAjaxForm(NULL, ['checkbox_in_group' => TRUE], 'checkbox_in_group');
+    $this->assertText('Test group');
+    $this->assertText('AJAX checkbox in a group');
+    $this->assertText('AJAX checkbox in a nested group');
+    $this->assertText('Another AJAX checkbox in a nested group');
+  }
+
+}