Skip to content
Snippets Groups Projects
Commit cd248dfb authored by catch's avatar catch
Browse files

Issue #2732111 by damiankloip, Lendude, dawehner: Reset button doesn't work...

Issue #2732111 by damiankloip, Lendude, dawehner: Reset button doesn't work and never gets removed on AJAX enabled views
parent b686f057
No related branches found
No related tags found
No related merge requests found
...@@ -114,7 +114,9 @@ ...@@ -114,7 +114,9 @@
Drupal.views.ajaxView.prototype.attachExposedFormAjax = function () { Drupal.views.ajaxView.prototype.attachExposedFormAjax = function () {
var that = this; var that = this;
this.exposedFormAjax = []; this.exposedFormAjax = [];
$('input[type=submit], input[type=image]', this.$exposed_form).each(function (index) { // Exclude the reset buttons so no AJAX behaviours are bound. Many things
// break during the form reset phase if using AJAX.
$('input[type=submit], input[type=image]', this.$exposed_form).not('[data-drupal-selector=edit-reset]').each(function (index) {
var self_settings = $.extend({}, that.element_settings, { var self_settings = $.extend({}, that.element_settings, {
base: $(this).attr('id'), base: $(this).attr('id'),
element: this element: this
......
...@@ -169,6 +169,9 @@ public function testResetButton() { ...@@ -169,6 +169,9 @@ public function testResetButton() {
$this->assertResponse(200); $this->assertResponse(200);
$this->assertFieldById('edit-type', 'All', 'Article type filter has been reset.'); $this->assertFieldById('edit-type', 'All', 'Article type filter has been reset.');
// Test the button is hidden after reset.
$this->assertNoField('edit-reset');
// Rename the label of the reset button. // Rename the label of the reset button.
$view = Views::getView('test_exposed_form_buttons'); $view = Views::getView('test_exposed_form_buttons');
$view->setDisplay(); $view->setDisplay();
......
...@@ -70,6 +70,14 @@ public function testExposedFiltering() { ...@@ -70,6 +70,14 @@ public function testExposedFiltering() {
$html = $session->getPage()->getHtml(); $html = $session->getPage()->getHtml();
$this->assertContains('Page Two', $html); $this->assertContains('Page Two', $html);
$this->assertNotContains('Page One', $html); $this->assertNotContains('Page One', $html);
// Reset the form.
$this->submitForm([], t('Reset'));
$this->assertSession()->assertWaitOnAjaxRequest();
$this->assertSession()->pageTextContains('Page One');
$this->assertSession()->pageTextContains('Page Two');
$this->assertFalse($session->getPage()->hasButton('Reset'));
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment