Merge branch 'bugfix/discard-changes-notify-4622'
fixes #4622 fixes #4617
This commit is contained in:
commit
fff746bdb3
|
@ -126,7 +126,6 @@ class LoggingForm extends Form
|
|||
if ($this->config === null) {
|
||||
$this->config = new Zend_Config(array());
|
||||
}
|
||||
|
||||
$logging = $this->config->logging;
|
||||
if ($logging === null) {
|
||||
$logging = new IcingaConfig(array());
|
||||
|
|
|
@ -17,6 +17,6 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
@copyright %(YEAR)s Icinga Development Team <info@icinga.org>
|
||||
@license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
@author Icinga Development Team <info@icinga.org>
|
||||
@copyright %(YEAR)s Icinga Development Team <info@icinga.org>
|
||||
@license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
@author Icinga Development Team <info@icinga.org>
|
|
@ -218,6 +218,8 @@ class Form extends Zend_Form
|
|||
}
|
||||
$this->addElementDecorators();
|
||||
$this->created = true;
|
||||
$this->setAttrib('data-icinga-component', 'app/form');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -308,7 +310,7 @@ class Form extends Zend_Form
|
|||
foreach ($triggerElements as $elementName) {
|
||||
$element = $this->getElement($elementName);
|
||||
if ($element !== null) {
|
||||
$element->setAttrib('onchange', '$(this.form).submit();');
|
||||
$element->setAttrib('data-icinga-form-autosubmit', 'true');
|
||||
} else {
|
||||
throw new ProgrammingError(
|
||||
'You need to add the element "' . $elementName . '" to' .
|
||||
|
@ -345,10 +347,12 @@ class Form extends Zend_Form
|
|||
} else {
|
||||
// only populate if not submitted
|
||||
$this->populate($checkData);
|
||||
$this->setAttrib('data-icinga-form-modified', 'true');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check whether this form has been submitted
|
||||
*
|
||||
|
|
|
@ -1,7 +1,29 @@
|
|||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* {{LICENSE_HEADER}}
|
||||
* {{LICENSE_HEADER}}
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
/**
|
||||
* A module to load and manage frontend components
|
||||
|
@ -28,7 +50,7 @@ define(['jquery', 'logging', 'icinga/componentRegistry'], function ($, log, regi
|
|||
try {
|
||||
cmp = new Cmp(target);
|
||||
} catch (e) {
|
||||
log.emergency(e);
|
||||
log.emergency('Error in component "' + cmpType + '" : "' + e + '"');
|
||||
err(e);
|
||||
return;
|
||||
}
|
||||
|
@ -77,7 +99,7 @@ define(['jquery', 'logging', 'icinga/componentRegistry'], function ($, log, regi
|
|||
|
||||
registry.markAllInactive();
|
||||
|
||||
$('div[data-icinga-component]')
|
||||
$('[data-icinga-component]')
|
||||
.each(function(index, el) {
|
||||
var type = $(el).attr('data-icinga-component');
|
||||
pendingFns++;
|
||||
|
|
|
@ -1,7 +1,29 @@
|
|||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* {{LICENSE_HEADER}}
|
||||
* {{LICENSE_HEADER}}
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
/**
|
||||
* A component registry that maps components to unique IDs and keeps track
|
||||
|
|
|
@ -1,3 +1,29 @@
|
|||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/*global Icinga:false, document: false, define:false require:false base_url:false console:false */
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,143 @@
|
|||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/*global Icinga:false define:false require:false base_url:false console:false */
|
||||
|
||||
/**
|
||||
* Icinga app/form component.
|
||||
*
|
||||
* This component makes sure a user has to confirm when trying to discard unsaved changes
|
||||
* by leaving the current page. It also implements the code for autosubmitting fields having the
|
||||
* 'data-icinga-form-autosubmit' component.
|
||||
*/
|
||||
define(['jquery'], function($) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* The attribute name marking forms as being modified
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
var ATTR_MODIFIED = 'data-icinga-form-modified';
|
||||
|
||||
/**
|
||||
* Return true when the input element is a autosubmit field
|
||||
*
|
||||
* @param {string|DOMElement|jQuery} el The element to test for autosubmission
|
||||
*
|
||||
* @returns {boolean} True when the element should be automatically submitted
|
||||
*/
|
||||
var isAutoSubmitInput = function(el) {
|
||||
return $(el).attr('data-icinga-form-autosubmit') === 'true' ||
|
||||
$(el).attr('data-icinga-form-autosubmit') === '1';
|
||||
};
|
||||
|
||||
/**
|
||||
* Takes a form and returns an overloaded jQuery object
|
||||
*
|
||||
* The returned object is the jQuery matcher with the following additional methods:
|
||||
*
|
||||
* - isModified: Return true when the form is marked as modified
|
||||
* - setModificationFlag: Mark this form as being modified
|
||||
* - clearModificationFlag: Clear the modification mark
|
||||
*
|
||||
* @param targetForm
|
||||
* @returns {jQuery}
|
||||
*/
|
||||
var getFormObject = function(targetForm) {
|
||||
var form = $(targetForm);
|
||||
/**
|
||||
* Return true when the form is marked as modified
|
||||
*
|
||||
* @returns {boolean} True when the form has the @see ATTR_MODIFIED attribute set to 'true', otherwise false
|
||||
*/
|
||||
form.isModified = function() {
|
||||
return form.attr(ATTR_MODIFIED) === 'true' ||
|
||||
form.attr(ATTR_MODIFIED) === '1';
|
||||
};
|
||||
|
||||
/**
|
||||
* Mark this form as being modified
|
||||
*/
|
||||
form.setModificationFlag = function() {
|
||||
form.attr(ATTR_MODIFIED, true);
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear the modification flag on this form
|
||||
*/
|
||||
form.clearModificationFlag = function() {
|
||||
form.attr(ATTR_MODIFIED, false);
|
||||
};
|
||||
return form;
|
||||
};
|
||||
|
||||
/**
|
||||
* Register event handler for detecting form modifications.
|
||||
*
|
||||
* This handler takes care of autosubmit form fields causing submissions on change and
|
||||
* makes sure the modification flag on the form is set when changes occur.
|
||||
*
|
||||
* @param {jQuery} form A form object returned from @see getFormObject()
|
||||
*/
|
||||
var registerFormEventHandler = function(form) {
|
||||
form.change(function(changed) {
|
||||
if (isAutoSubmitInput(changed.target)) {
|
||||
form.clearModificationFlag();
|
||||
form.submit();
|
||||
} else {
|
||||
form.setModificationFlag();
|
||||
}
|
||||
|
||||
});
|
||||
// submissions should clear the modification flag
|
||||
form.submit(form.clearModificationFlag);
|
||||
};
|
||||
|
||||
/**
|
||||
* Register an eventhandler that triggers a confirmation message when the user tries to leave a modified form
|
||||
*
|
||||
* @param {jQuery} form A form object returned from @see getFormObject()
|
||||
*/
|
||||
var registerLeaveConfirmationHandler = function(form) {
|
||||
|
||||
$(window).on('beforeunload', function() {
|
||||
if (form.isModified()) {
|
||||
return 'All unsaved changes will be lost when leaving this page';
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The component bootstrap
|
||||
*/
|
||||
return function(targetForm) {
|
||||
var form = getFormObject(targetForm);
|
||||
registerFormEventHandler(form);
|
||||
registerLeaveConfirmationHandler(form);
|
||||
};
|
||||
});
|
|
@ -1,4 +1,31 @@
|
|||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/*global Icinga:false, document: false, define:false require:false base_url:false console:false */
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'logging',
|
||||
|
|
|
@ -1,4 +1,31 @@
|
|||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/*global Icinga:false define:false require:false base_url:false console:false */
|
||||
|
||||
(function() {
|
||||
"use strict";
|
||||
var asyncMgrInstance = null;
|
||||
|
|
|
@ -1,3 +1,29 @@
|
|||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/*global Icinga:false, document: false, define:false require:false base_url:false console:false, window:false */
|
||||
|
||||
define(function() {
|
||||
|
|
|
@ -109,7 +109,8 @@ if (path === null) {
|
|||
};
|
||||
|
||||
exports.performLogin = function() {
|
||||
casper.start("/authentication/login", function() {
|
||||
casper.start("/authentication/logout");
|
||||
casper.thenOpen("/authentication/login", function() {
|
||||
this.fill('form#form_login', icinga.getCredentials());
|
||||
this.click('form#form_login input#submit');
|
||||
});
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
/**
|
||||
* Config: Warn about unsaved changes before leaving current dialog (Bug #4622)
|
||||
*
|
||||
* It's not possible to test if the confirmation dialog really appears, but as this is a rather simple
|
||||
* event listener (that is also tested with mocha), the state preservation is tested here
|
||||
*
|
||||
* This test performs the following steps
|
||||
* - Log in and open the logging dialog form
|
||||
* - Wait for component initialisation
|
||||
* - Modify the first input field and test for the data-icinga-form-modified flag to be set
|
||||
* - Modify the an autosubmit field (debug log), wait for the textfield to appear or disappear and test if
|
||||
* the modified attribute is set on the server side.
|
||||
**/
|
||||
|
||||
|
||||
/**
|
||||
* The icinga util object
|
||||
*
|
||||
* @type object
|
||||
*/
|
||||
var icinga = require('./icingawebtest');
|
||||
|
||||
/**
|
||||
* The casperjs object
|
||||
*
|
||||
* @type Casper
|
||||
*/
|
||||
var casper = icinga.getTestEnv();
|
||||
|
||||
/**
|
||||
* Login to the instance
|
||||
*/
|
||||
icinga.performLogin();
|
||||
|
||||
/**
|
||||
* Test if the modified attribute is correctly set when altering input
|
||||
*/
|
||||
casper.thenOpen('./config/logging', function() {
|
||||
"use strict";
|
||||
|
||||
this.test.assertExists('form#form_config_logging', 'Assert the logging configuration form being displayed');
|
||||
this.test.assertEquals(
|
||||
this.getElementAttribute('form#form_config_logging', 'data-icinga-form-modified'),
|
||||
"",
|
||||
'Assert a form to initially have no modified flag'
|
||||
);
|
||||
// Wait for the component to initialize
|
||||
this.wait(1000, function() {
|
||||
this.sendKeys('#form_config_logging input#logging_app_target', 'somewhere');
|
||||
this.test.assertEquals(
|
||||
this.getElementAttribute('form#form_config_logging', 'data-icinga-form-modified'),
|
||||
"true",
|
||||
'Assert a form to initially be marked as modified when changed'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Test if the modified flag will be set on the server side
|
||||
*/
|
||||
casper.then(function() {
|
||||
"use strict";
|
||||
|
||||
var checkbox = this.getElementAttribute('form#form_config_logging input#logging_debug_enable', 'value');
|
||||
this.click('form#form_config_logging input#logging_debug_enable');
|
||||
// determine whether the text input field appears after the click or not
|
||||
var waitFn = (checkbox === '0' ? this.waitForSelector : this.waitWhileSelector).bind(this);
|
||||
waitFn('form#form_config_logging input#logging_debug_target', function() {
|
||||
this.test.assertEquals(
|
||||
this.getElementAttribute('form#form_config_logging', 'data-icinga-form-modified'),
|
||||
"true",
|
||||
'Assert modify flag to be set on the server side if using an autosubmit field'
|
||||
);
|
||||
}, function() {
|
||||
this.test.fail('Debug textfield appearcance didn\'t occur after click');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Run the tests
|
||||
*/
|
||||
casper.run(function() {
|
||||
"use strict";
|
||||
|
||||
this.test.done();
|
||||
});
|
|
@ -172,5 +172,7 @@ export CASPERJS_PASS=$CASPERJS_PASS
|
|||
export CASPERJS_PATH=$CASPERJS_PATH
|
||||
|
||||
echo Executing $EXEC $FILELIST
|
||||
$EXEC $FILELIST
|
||||
for JSFILE in $FILELIST;do
|
||||
$EXEC $JSFILE;
|
||||
done;
|
||||
exit 0
|
||||
|
|
|
@ -113,8 +113,8 @@ def main():
|
|||
for a in arguments[:len(arguments)]
|
||||
if os.path.isfile(a) or os.path.isdir(a)]
|
||||
if not path_args:
|
||||
path_args = ['../../application', '../../bin',
|
||||
'../../library/Icinga']
|
||||
path_args = ['../../public/js/icinga', '../../bin',
|
||||
'../../modules/']
|
||||
if options.include:
|
||||
path_args = [os.path.join(r, f)
|
||||
for a in path_args
|
||||
|
@ -143,6 +143,7 @@ def main():
|
|||
with open(result_path, 'w') as result_file:
|
||||
result_file.write(result_data)
|
||||
else:
|
||||
print (application_path )
|
||||
execute_command([application_path] + DEFAULT_ARGS +
|
||||
command_options + arguments + path_args)
|
||||
return 0
|
||||
|
|
|
@ -60,7 +60,7 @@ class FormTest extends Zend_Test_PHPUnit_ControllerTestCase
|
|||
$form = new TestForm();
|
||||
$form->addElement('checkbox', 'example1', array());
|
||||
$form->enableAutoSubmit(array('example1'));
|
||||
$this->assertArrayHasKey('onchange', $form->getElement('example1')->getAttribs(),
|
||||
$this->assertArrayHasKey('data-icinga-form-autosubmit', $form->getElement('example1')->getAttribs(),
|
||||
'Asserting that auto-submit got enabled for one element');
|
||||
}
|
||||
|
||||
|
@ -73,9 +73,9 @@ class FormTest extends Zend_Test_PHPUnit_ControllerTestCase
|
|||
$form->addElement('checkbox', 'example1', array());
|
||||
$form->addElement('checkbox', 'example2', array());
|
||||
$form->enableAutoSubmit(array('example1', 'example2'));
|
||||
$this->assertArrayHasKey('onchange', $form->getElement('example1')->getAttribs(),
|
||||
$this->assertArrayHasKey('data-icinga-form-autosubmit', $form->getElement('example1')->getAttribs(),
|
||||
'Asserting that auto-submit got enabled for multiple elements');
|
||||
$this->assertArrayHasKey('onchange', $form->getElement('example2')->getAttribs(),
|
||||
$this->assertArrayHasKey('data-icinga-form-autosubmit', $form->getElement('example2')->getAttribs(),
|
||||
'Asserting that auto-submit got enabled for multiple elements');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue