Commit 84ecb3cf authored by Carsten  Rose's avatar Carsten Rose
Browse files

Fix and add unit test

parent 4645df03
Pipeline #1374 passed with stage
in 2 minutes and 8 seconds
......@@ -35,6 +35,7 @@ class HelperFormElement {
* @throws UserReportException
*/
public static function explodeParameterInArrayElements(array &$elements, $keyName) {
foreach ($elements AS $key => $element) {
self::explodeParameter($element, $keyName);
$elements[$key] = $element;
......@@ -50,6 +51,7 @@ class HelperFormElement {
public static function formElementSetDefault(array $elements) {
foreach ($elements AS $key => $element) {
$elements[$key][FE_TG_INDEX] = 0;
// $elements[$key][FE_DATA_REFERENCE] = '';
}
return $elements;
......@@ -67,6 +69,7 @@ class HelperFormElement {
* @throws UserReportException
*/
public static function explodeParameter(array &$element, $keyName, $flagAllowOverwrite = false) {
// Something to explode?
if (isset($element[$keyName]) && $element[$keyName] !== '') {
// Explode
......
......@@ -533,6 +533,7 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
FE_CHECK_PATTERN => '',
FE_HTML_ID => '123',
FE_HIDE_ZERO => '0',
FE_DATA_REFERENCE => '',
'tabindex' => 0,
];
......
......@@ -1199,8 +1199,8 @@ class LinkTest extends TestCase {
$js = <<<EOF
id="12345" onClick="var alert = new QfqNS.Alert({ message: 'Please confirm', type: 'info', modal: true, timeout: 0, buttons: [
{ label: 'Ok', eventName: 'ok' },
{ label: 'Cancel',eventName: 'cancel'}
{ label: 'Ok', eventName: 'ok' }
, { label: 'Cancel',eventName: 'cancel'}
] } );
alert.on('alert.ok', function() {
window.location = $('#12345').attr('href');
......@@ -1264,6 +1264,34 @@ EOF;
}
/**
*
* @throws CodeException
* @throws UserFormException
* @throws UserReportException
*/
public function testQuestion2() {
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
$js = <<<EOF
id="12345" onClick="var alert = new QfqNS.Alert({ message: 'Please confirm', type: 'info', modal: true, timeout: 0, buttons: [
{ label: 'Ok', eventName: 'ok' }
] } );
alert.on('alert.ok', function() {
window.location = $('#12345').attr('href');
});
alert.show();
return false;"
EOF;
// Question: Hide 'cancel' Button
$result = $link->renderLink('p:person|c:n|q::::-');
$this->assertEquals('<a href="?id=person" ' . $js . ' >?id=person</a>', $result);
}
/**
* @throws CodeException
* @throws UserFormException
......
......@@ -527,8 +527,8 @@ class ReportTest extends AbstractDatabaseTest {
public function testReportPageTokenQuestion() {
$js = <<<EOF
id="12345" onClick="var alert = new QfqNS.Alert({ message: 'Please confirm', type: 'info', modal: true, timeout: 0, buttons: [
{ label: 'Ok', eventName: 'ok' },
{ label: 'Cancel',eventName: 'cancel'}
{ label: 'Ok', eventName: 'ok' }
, { label: 'Cancel',eventName: 'cancel'}
] } );
alert.on('alert.ok', function() {
window.location = $('#12345').attr('href');
......@@ -605,8 +605,8 @@ EOF;
$js = <<<EOF
id="12345" onClick="var alert = new QfqNS.Alert({ message: 'Please confirm', type: 'info', modal: true, timeout: 0, buttons: [
{ label: 'Ok', eventName: 'ok' },
{ label: 'Cancel',eventName: 'cancel'}
{ label: 'Ok', eventName: 'ok' }
, { label: 'Cancel',eventName: 'cancel'}
] } );
alert.on('alert.ok', function() {
window.location = $('#12345').attr('href');
......@@ -700,8 +700,8 @@ EOF;
$js = <<<EOF
id="12345" onClick="var alert = new QfqNS.Alert({ message: 'Please confirm!', type: 'info', modal: true, timeout: 0, buttons: [
{ label: 'Ok', eventName: 'ok' },
{ label: 'Cancel',eventName: 'cancel'}
{ label: 'Ok', eventName: 'ok' }
, { label: 'Cancel',eventName: 'cancel'}
] } );
alert.on('alert.ok', function() {
window.location = $('#12345').attr('href');
......@@ -745,8 +745,8 @@ EOF;
$js = <<<EOF
id="12345" onClick="var alert = new QfqNS.Alert({ message: 'Please confirm!', type: 'info', modal: true, timeout: 0, buttons: [
{ label: 'Ok', eventName: 'ok' },
{ label: 'Cancel',eventName: 'cancel'}
{ label: 'Ok', eventName: 'ok' }
, { label: 'Cancel',eventName: 'cancel'}
] } );
alert.on('alert.ok', function() {
window.location = $('#12345').attr('href');
......@@ -790,8 +790,8 @@ EOF;
$js = <<<EOF
id="12345" onClick="var alert = new QfqNS.Alert({ message: 'Do you really want to delete the record?', type: 'warning', modal: true, timeout: 0, buttons: [
{ label: 'Ok', eventName: 'ok' },
{ label: 'Cancel',eventName: 'cancel'}
{ label: 'Ok', eventName: 'ok' }
, { label: 'Cancel',eventName: 'cancel'}
] } );
alert.on('alert.ok', function() {
window.location = $('#12345').attr('href');
......@@ -843,8 +843,8 @@ EOF;
$js = <<<EOF
id="12345" onClick="var alert = new QfqNS.Alert({ message: 'Do you really want to delete the record?', type: 'warning', modal: true, timeout: 0, buttons: [
{ label: 'Ok', eventName: 'ok' },
{ label: 'Cancel',eventName: 'cancel'}
{ label: 'Ok', eventName: 'ok' }
, { label: 'Cancel',eventName: 'cancel'}
] } );
alert.on('alert.ok', function() {
window.location = $('#12345').attr('href');
......
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