Commit cd248dfb authored by catch's avatar catch

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
......@@ -114,7 +114,9 @@
Drupal.views.ajaxView.prototype.attachExposedFormAjax = function () {
var that = this;
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, {
base: $(this).attr('id'),
element: this
......
......@@ -169,6 +169,9 @@ public function testResetButton() {
$this->assertResponse(200);
$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.
$view = Views::getView('test_exposed_form_buttons');
$view->setDisplay();
......
......@@ -70,6 +70,14 @@ public function testExposedFiltering() {
$html = $session->getPage()->getHtml();
$this->assertContains('Page Two', $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'));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment