Commit 988da079 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

Merge branch 'origin-hotline' into origin-master

# Conflicts:
#	tests/scenarios/Templates/TemplatesMenuTest.php
parents bfadf610 0b98559f
- ticket #131892 : Administration : Correction du composant de recherche de paniers dans les configurations de boites
\ No newline at end of file
- ticket #133092 : Administration : le lien "retour au site" utilise l'URL personnalisée du profil courant
\ No newline at end of file
- ticket #140058 : Magasin de thèmes : Correction du fonctionnement des menus avec des sous menu.
\ No newline at end of file
......@@ -50,7 +50,7 @@ class ZendAfi_View_Helper_Admin_Nav extends ZendAfi_View_Helper_BaseHelper {
['icon' => 'back_to_front',
'label' => $this->_('Retour au site'),
'title' => $this->_('Retourner sur la partie publique du portail'),
'url' => $this->view->url(['id_profil' => Class_Profil::getCurrentProfil()->getId()], null, true)],
'url' => Class_Profil::getCurrentProfil()->getUrl()],
['icon' => 'identity',
'label' => $identity->getLogin() . ' (' . $identity->getLibelleRole() . ')',
......
<!DOCTYPE html>
<!--
/**
* Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH 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 AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-->
<html>
<head>
<meta charset="utf-8">
<title>QUnit tests</title>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css">
<link rel="stylesheet" href="../../css/bootstrap.min.css">
<link rel="stylesheet" href="../../../../css/intonation.css">
<link rel="stylesheet" href="../../../../../../../../public/opac/css/core.css">
<script type="text/javascript" src="../../../../../../../../public/admin/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="../../../../../../../../public/admin/js/jquery-ui-1.12.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="../../../popper.min.js"></script>
<script type="text/javascript" src="../bootstrap.min.js"></script>
<script src="http://code.jquery.com/qunit/qunit-1.13.0.js"></script>
<script src="dropdown_tests.js"></script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div>
<div class="boite">
<ul class="nav navbar-nav list-unstyled">
<li class="nav-item">
<a href="/" class="nav-link active_item active">Home</a>
</li>
<li class="nav-item dropdown">
<a href="#" id="6126059b06918" onclick="return false;" class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Information</a>
<ul class="dropdown-menu list-unstyled" aria-labelledby="6126059b06918">
<li class="nav-item">
<a href="" class="nav-link">News</a>
</li>
<li class="nav-item dropdown">
<a href="#" id="6126059b11326" onclick="return false;" class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Libraries</a>
<ul class="dropdown-menu list-unstyled" aria-labelledby="6126059b11326">
<li class="nav-item">
<a href="" class="nav-link">Valleiry</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<script src="../bootstrap_dropdown.js"></script>
</body>
</html>
/**
* Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH 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 AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
QUnit.module('dropdown_with_submenu');
test('Click on Information should display News', function() {
$('#6126059b06918').trigger('click');
deepEqual($('[aria-labelledby="6126059b06918"].show').length, 1, $('body'));
});
test('Click on Libraries should display Valleiry', function() {
$('#6126059b06918').trigger('click');
$('#6126059b11326').trigger('click');
deepEqual($('.has-child-dropdown-show [aria-labelledby="6126059b11326"].show').length, 1, $('body'));
});
......@@ -26,6 +26,12 @@ class Intonation_Library_View_Wrapper_MenuEntry extends Intonation_Library_View_
return $this->_model->getLabel();
}
public function isMenu() {
return $this->_model->isMenu();
}
public function getMainLink() {
return '';
}
......
......@@ -38,7 +38,9 @@ abstract class Intonation_View_Menu_Abstract extends ZendAfi_View_Helper_BaseHel
$html = '';
foreach ( $collection as $menu)
$html .= $this->_tag('li', $callback($menu), ['class' => 'nav-item']);
$html .= $this->_tag('li', $callback($menu), ['class' => 'nav-item'. (($menu->isMenu())
? ' dropdown'
: '')]);
return $this->_renderMenu($this->_navbarHeader() . $this->_navbarEntries($html),
['class' => implode(' ',
......
......@@ -37,10 +37,6 @@ class Intonation_View_RenderMenuEntry extends ZendAfi_View_Helper_BaseHelper {
$entry .= $this->_renderChildren($menu_entry, $id, $use_menu_layout);
if ($menu_entry->getChildren())
$entry = $this->_div(['class' => 'dropdown'],
$entry);
return $use_menu_layout
? $entry
: $this->_div(['class' => 'menu_entry'],
......@@ -80,7 +76,9 @@ class Intonation_View_RenderMenuEntry extends ZendAfi_View_Helper_BaseHelper {
$html[] = $this->_tag('li',
$this->_renderMenuEntry($menu_entry_child, $use_menu_layout),
['class' => 'nav-item']);
['class' => 'nav-item' . (($menu_entry_child->isMenu())
? ' dropdown'
: '')]);
}
return $this->_tag('ul',
......
/**
* Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH 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 AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
QUnit.module('treeselect');
var datas = [{
"id": "paniers_by_users",
"label": "Paniers",
"categories": {
"1020": {
"id": "cart-owner-id-1020",
"label": "Administrateur",
"categories": [],
"items": [
{
"id": 111,
"label": "201111-jeunesse",
"options": {
"ico": "/public/admin/images/picto/paniers_16.png"
}
},
{
"id": 112,
"label": "201111-ados",
"options": {
"ico": "/public/admin/images/picto/paniers_16.png"
}
},
{
"id": 113,
"label": "201111-adultes",
"options": {
"ico": "/public/admin/images/picto/paniers_16.png"
}
},
{
"id": 114,
"label": "201222-jeunesse",
"options": {
"ico": "/public/admin/images/picto/paniers_16.png"
}
},
{
"id": 115,
"label": "201222-ados",
"options": {
"ico": "/public/admin/images/picto/paniers_16.png"
}
},
{
"id": 116,
"label": "201222-adultes",
"options": {
"ico": "/public/admin/images/picto/paniers_16.png"
}
},
{
"id": 117,
"label": "201222-cdc",
"options": {
"ico": "/public/admin/images/picto/paniers_16.png"
}
}
],
"options": {
"ico": "/public/admin/images/picto/abonnes.gif",
"removeCheckbox": true
}
}
},
"items": [],
"options": {
"multipleSelection": false
}
}];
function pack_ids(ids) {
return $.map(ids, function(d) { return d.id; }).join('-');
};
function call_treeselect() {
$('.treeselect.id_catalogue')
.treeselect({ datas: datas })
.treeselect('selectItems', [])
.treeselect('selectCategories', [])
.treeselect('toggleVisibility', true)
.treeselect('disableMultipleSelection');
$("form").submit(function() {
$(".treeselect").each(function(index) {
var node = $(this);
node.treeselect("readSelection",
function(items, categories) {
node.siblings("input:hidden:nth-child(2)").val(pack_ids(categories));
node.siblings("input:hidden:nth-child(3)").val(pack_ids(items));
});
});
});
};
function init_and_search(value) {
call_treeselect();
$('.ui-treeselect-search').find('input[type=textfield]').val(value);
$('.ui-treeselect-search').find('input[type=textfield]').trigger($.Event('keyup', { keyCode: 0 }));
return $('.ui-treeselect-category').find('li:visible');
}
test('Search "biq" will display no item', function() {
var visibles = init_and_search('biq');
equal(visibles.length, 0);
});
test('Search "2011" will display 3 items', function() {
var visibles = init_and_search('2011');
equal(visibles.length, 3);
equal(visibles[0].textContent, '201111-jeunesse');
equal(visibles[1].textContent, '201111-ados');
equal(visibles[2].textContent, '201111-adultes');
});
test('Search "2012" will display 4 items', function() {
var visibles = init_and_search('2012');
equal(visibles.length, 4);
equal(visibles[0].textContent, '201222-jeunesse');
equal(visibles[1].textContent, '201222-ados');
equal(visibles[2].textContent, '201222-adultes');
equal(visibles[3].textContent, '201222-cdc');
});
test('Search "ados" will display 2 items', function() {
var visibles = init_and_search('ados');
equal(visibles.length, 2);
equal(visibles[0].textContent, '201111-ados');
equal(visibles[1].textContent, '201222-ados');
});
test('Search"cdc" will display 1 item', function() {
var visibles = init_and_search('cdc');
equal(visibles.length, 1);
equal(visibles[0].textContent, '201222-cdc');
});
<!DOCTYPE html>
<!--
/**
* Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH 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 AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-->
<html>
<head>
<meta charset="utf-8">
<title>QUnit tests</title>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script type="text/javascript" src="../jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="../jquery-ui-1.12.1/jquery-ui.min.js"></script>
<script src="treeselect.js"></script>
<script src="http://code.jquery.com/qunit/qunit-1.13.0.js"></script>
<script src="test.js"></script>
<form>
<div class="treeselect id_catalogue ui-widget ui-helper-reset"></div>
</form>
</body>
</html>
......@@ -467,27 +467,26 @@
return;
}
accentsTidy = function(s){
var r=s.toLowerCase();
r = r.replace(new RegExp("[àáâãäå]", 'g'),"a");
r = r.replace(new RegExp("æ", 'g'),"ae");
r = r.replace(new RegExp("ç", 'g'),"c");
r = r.replace(new RegExp("[èéêë]", 'g'),"e");
r = r.replace(new RegExp("[ìíîï]", 'g'),"i");
r = r.replace(new RegExp("ñ", 'g'),"n");
r = r.replace(new RegExp("[òóôõö]", 'g'),"o");
r = r.replace(new RegExp("œ", 'g'),"oe");
r = r.replace(new RegExp("[ùúûü]", 'g'),"u");
r = r.replace(new RegExp("[ýÿ]", 'g'),"y");
return r;
accentsTidy = function (s) {
var r = s.toLowerCase();
r = r.replace(new RegExp("[àáâãäå]", 'g'), "a");
r = r.replace(new RegExp("æ", 'g'), "ae");
r = r.replace(new RegExp("ç", 'g'), "c");
r = r.replace(new RegExp("[èéêë]", 'g'), "e");
r = r.replace(new RegExp("[ìíîï]", 'g'), "i");
r = r.replace(new RegExp("ñ", 'g'), "n");
r = r.replace(new RegExp("[òóôõö]", 'g'), "o");
r = r.replace(new RegExp("œ", 'g'), "oe");
r = r.replace(new RegExp("[ùúûü]", 'g'), "u");
return r.replace(new RegExp("[ýÿ]", 'g'), "y");
};
searchText = accentsTidy(searchText);
var re = new RegExp('\\b' + searchText, 'gi');
var matches = this.itemsTree.find('li, h3').filter(function() {
return re.test(accentsTidy($(this).text()));
return accentsTidy($(this).text()).indexOf(searchText) > -1;
});
this._highlightItems(matches);
matches.parents(".ui-accordion-content").show();
},
......
......@@ -126,6 +126,12 @@ class Admin_IndexControllerTest extends Admin_IndexControllerTestCase {
Class_BokehVersion::setWebClient($mock_http);
$this->fixture(Class_Profil::class,
['id' => 4,
'libelle' => 'ludotek',
'rewrite_url' => 'ludotek'])
->beCurrentProfil();
$this->dispatch('/admin/index/index', true);
}
......@@ -173,6 +179,12 @@ class Admin_IndexControllerTest extends Admin_IndexControllerTestCase {
}
/** @test */
public function menuBackToSiteLinkShouldBeSlashLudotek() {
$this->assertXPathContentContains('//div[@class="menu barre_nav"]//a[text()="Retour au site"]/@href', '/ludotek');
}
/** @test */
public function linkToGoogleGroupShouldBePresent() {
$this->assertXPathContentContains('//a[contains(@href, "utilisateurs-bokeh")]', 'Google group Bokeh');
......
......@@ -96,6 +96,7 @@ require_once 'tests/library/Class/WebService/SIGB/TestingService.php';
require_once 'tests/fixtures/RessourcesNumeriquesFixtures.php';
require_once 'tests/fixtures/MockedClasses.php';
require_once 'tests/application/modules/telephone/controllers/TelephoneAbstractControllerTestCase.php';
require_once 'tests/js/PhantomJsTest.php';
register_shutdown_function(function(){
TestSpeedTrap::printSpeedTrappedTests();
......
<?php
/**
* Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved.
* Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
......@@ -20,12 +20,6 @@
*/
class AuthorityPickerTest extends PHPUnit_Framework_TestCase {
/** @test */
public function searchInputJStestShouldSuccess() {
exec('phantomjs ' . ROOT_PATH . 'tests_js/lib/qunit-phantomjs-runner/runner.js ' . ROOT_PATH . 'public/opac/js/authority_picker/tests.html', $output, $result);
$this->assertEquals(0, $result, implode("\n", $output));
}
class AuthorityPickerTest extends PhantomJsTest {
protected $_test_path = 'public/opac/js/authority_picker/tests.html';
}
?>
\ No newline at end of file
<?php
/**
* Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH 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 AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class BootstrapDropdownTest extends PhantomJsTest {
protected $_test_path = ['library/templates/Intonation/Assets/Bootstrap/bootstrap-4.3.1-dist/js/tests/dropdown_tests.html'];
}
<?php
/**
* Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved.
* Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
......@@ -16,15 +16,10 @@
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class CustomFieldsReportTest extends PHPUnit_Framework_TestCase {
/** @test */
public function customFieldsReportMethodsJStestShouldSuccess() {
exec('phantomjs ' . ROOT_PATH . 'tests_js/lib/qunit-phantomjs-runner/runner.js ' . ROOT_PATH . 'public/admin/js/custom-fields/tests/custom_fields.html', $output, $result);
$this->assertEquals(0, $result, implode("\n", $output));
}
class CustomFieldsReportTest extends PhantomJsTest {
protected $_test_path = 'public/admin/js/custom-fields/tests/custom_fields.html';
}
?>
\ No newline at end of file
<?php
/**
* Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved.
* Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
......@@ -20,11 +20,6 @@
*/
class MultiInputTest extends PHPUnit_Framework_TestCase {
/** @test */
public function multiInputJstestShouldSuccess() {
exec('phantomjs ' . ROOT_PATH . 'tests_js/lib/qunit-phantomjs-runner/runner.js ' . ROOT_PATH . 'public/admin/js/multi_inputs/tests.html', $output, $result);
$this->assertEquals(0, $result, implode("\n", $output));
}
}
\ No newline at end of file
class MultiInputTest extends PhantomJsTest {
protected $_test_path = 'public/admin/js/multi_inputs/tests.html';
}
<?php
/**
* Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved.
* Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
......@@ -20,11 +20,6 @@
*/
class MultiSelectionTest extends PHPUnit_Framework_TestCase {
/** @test */
public function multiSelectJstestShouldSuccess() {
exec('phantomjs ' . ROOT_PATH . 'tests_js/lib/qunit-phantomjs-runner/runner.js ' . ROOT_PATH . 'public/admin/js/multi_selection/tests.html', $output, $result);
$this->assertEquals(0, $result, implode("\n", $output));
}
}
\ No newline at end of file
class MultiSelectionTest extends PhantomJsTest {
protected $_test_path = 'public/admin/js/multi_selection/tests.html';
}
<?php
/**
* Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*