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 { ...@@ -35,6 +35,7 @@ class HelperFormElement {
* @throws UserReportException * @throws UserReportException
*/ */
public static function explodeParameterInArrayElements(array &$elements, $keyName) { public static function explodeParameterInArrayElements(array &$elements, $keyName) {
foreach ($elements AS $key => $element) { foreach ($elements AS $key => $element) {
self::explodeParameter($element, $keyName); self::explodeParameter($element, $keyName);
$elements[$key] = $element; $elements[$key] = $element;
...@@ -50,6 +51,7 @@ class HelperFormElement { ...@@ -50,6 +51,7 @@ class HelperFormElement {
public static function formElementSetDefault(array $elements) { public static function formElementSetDefault(array $elements) {
foreach ($elements AS $key => $element) { foreach ($elements AS $key => $element) {
$elements[$key][FE_TG_INDEX] = 0; $elements[$key][FE_TG_INDEX] = 0;
// $elements[$key][FE_DATA_REFERENCE] = '';
} }
return $elements; return $elements;
...@@ -67,6 +69,7 @@ class HelperFormElement { ...@@ -67,6 +69,7 @@ class HelperFormElement {
* @throws UserReportException * @throws UserReportException
*/ */
public static function explodeParameter(array &$element, $keyName, $flagAllowOverwrite = false) { public static function explodeParameter(array &$element, $keyName, $flagAllowOverwrite = false) {
// Something to explode? // Something to explode?
if (isset($element[$keyName]) && $element[$keyName] !== '') { if (isset($element[$keyName]) && $element[$keyName] !== '') {
// Explode // Explode
......
...@@ -533,6 +533,7 @@ class BuildFormPlainTest extends AbstractDatabaseTest { ...@@ -533,6 +533,7 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
FE_CHECK_PATTERN => '', FE_CHECK_PATTERN => '',
FE_HTML_ID => '123', FE_HTML_ID => '123',
FE_HIDE_ZERO => '0', FE_HIDE_ZERO => '0',
FE_DATA_REFERENCE => '',
'tabindex' => 0, 'tabindex' => 0,
]; ];
......
...@@ -1199,8 +1199,8 @@ class LinkTest extends TestCase { ...@@ -1199,8 +1199,8 @@ class LinkTest extends TestCase {
$js = <<<EOF $js = <<<EOF
id="12345" onClick="var alert = new QfqNS.Alert({ message: 'Please confirm', type: 'info', modal: true, timeout: 0, buttons: [ id="12345" onClick="var alert = new QfqNS.Alert({ message: 'Please confirm', type: 'info', modal: true, timeout: 0, buttons: [
{ label: 'Ok', eventName: 'ok' }, { label: 'Ok', eventName: 'ok' }
{ label: 'Cancel',eventName: 'cancel'} , { label: 'Cancel',eventName: 'cancel'}
] } ); ] } );
alert.on('alert.ok', function() { alert.on('alert.ok', function() {
window.location = $('#12345').attr('href'); window.location = $('#12345').attr('href');
...@@ -1264,6 +1264,34 @@ EOF; ...@@ -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 CodeException
* @throws UserFormException * @throws UserFormException
......
...@@ -527,8 +527,8 @@ class ReportTest extends AbstractDatabaseTest { ...@@ -527,8 +527,8 @@ class ReportTest extends AbstractDatabaseTest {
public function testReportPageTokenQuestion() { public function testReportPageTokenQuestion() {
$js = <<<EOF $js = <<<EOF
id="12345" onClick="var alert = new QfqNS.Alert({ message: 'Please confirm', type: 'info', modal: true, timeout: 0, buttons: [ id="12345" onClick="var alert = new QfqNS.Alert({ message: 'Please confirm', type: 'info', modal: true, timeout: 0, buttons: [
{ label: 'Ok', eventName: 'ok' }, { label: 'Ok', eventName: 'ok' }
{ label: 'Cancel',eventName: 'cancel'} , { label: 'Cancel',eventName: 'cancel'}
] } ); ] } );
alert.on('alert.ok', function() { alert.on('alert.ok', function() {
window.location = $('#12345').attr('href'); window.location = $('#12345').attr('href');
...@@ -605,8 +605,8 @@ EOF; ...@@ -605,8 +605,8 @@ EOF;
$js = <<<EOF $js = <<<EOF
id="12345" onClick="var alert = new QfqNS.Alert({ message: 'Please confirm', type: 'info', modal: true, timeout: 0, buttons: [ id="12345" onClick="var alert = new QfqNS.Alert({ message: 'Please confirm', type: 'info', modal: true, timeout: 0, buttons: [
{ label: 'Ok', eventName: 'ok' }, { label: 'Ok', eventName: 'ok' }
{ label: 'Cancel',eventName: 'cancel'} , { label: 'Cancel',eventName: 'cancel'}
] } ); ] } );
alert.on('alert.ok', function() { alert.on('alert.ok', function() {
window.location = $('#12345').attr('href'); window.location = $('#12345').attr('href');
...@@ -700,8 +700,8 @@ EOF; ...@@ -700,8 +700,8 @@ EOF;
$js = <<<EOF $js = <<<EOF
id="12345" onClick="var alert = new QfqNS.Alert({ message: 'Please confirm!', type: 'info', modal: true, timeout: 0, buttons: [ id="12345" onClick="var alert = new QfqNS.Alert({ message: 'Please confirm!', type: 'info', modal: true, timeout: 0, buttons: [
{ label: 'Ok', eventName: 'ok' }, { label: 'Ok', eventName: 'ok' }
{ label: 'Cancel',eventName: 'cancel'} , { label: 'Cancel',eventName: 'cancel'}
] } ); ] } );
alert.on('alert.ok', function() { alert.on('alert.ok', function() {
window.location = $('#12345').attr('href'); window.location = $('#12345').attr('href');
...@@ -745,8 +745,8 @@ EOF; ...@@ -745,8 +745,8 @@ EOF;
$js = <<<EOF $js = <<<EOF
id="12345" onClick="var alert = new QfqNS.Alert({ message: 'Please confirm!', type: 'info', modal: true, timeout: 0, buttons: [ id="12345" onClick="var alert = new QfqNS.Alert({ message: 'Please confirm!', type: 'info', modal: true, timeout: 0, buttons: [
{ label: 'Ok', eventName: 'ok' }, { label: 'Ok', eventName: 'ok' }
{ label: 'Cancel',eventName: 'cancel'} , { label: 'Cancel',eventName: 'cancel'}
] } ); ] } );
alert.on('alert.ok', function() { alert.on('alert.ok', function() {
window.location = $('#12345').attr('href'); window.location = $('#12345').attr('href');
...@@ -790,8 +790,8 @@ EOF; ...@@ -790,8 +790,8 @@ EOF;
$js = <<<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: [ 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: 'Ok', eventName: 'ok' }
{ label: 'Cancel',eventName: 'cancel'} , { label: 'Cancel',eventName: 'cancel'}
] } ); ] } );
alert.on('alert.ok', function() { alert.on('alert.ok', function() {
window.location = $('#12345').attr('href'); window.location = $('#12345').attr('href');
...@@ -843,8 +843,8 @@ EOF; ...@@ -843,8 +843,8 @@ EOF;
$js = <<<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: [ 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: 'Ok', eventName: 'ok' }
{ label: 'Cancel',eventName: 'cancel'} , { label: 'Cancel',eventName: 'cancel'}
] } ); ] } );
alert.on('alert.ok', function() { alert.on('alert.ok', function() {
window.location = $('#12345').attr('href'); window.location = $('#12345').attr('href');
......
Supports Markdown
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