diff --git a/VERSIONS_HOTLINE/153815 b/VERSIONS_HOTLINE/153815 new file mode 100644 index 0000000000000000000000000000000000000000..2d3dd8ad35ea1e97c86d918e4889fb446548680f --- /dev/null +++ b/VERSIONS_HOTLINE/153815 @@ -0,0 +1 @@ + - correctif #153815 : Magasin de thèmes: Le bouton de recherche peut maintenant contenir plusieurs mots. \ No newline at end of file diff --git a/application/modules/admin/controllers/WidgetController.php b/application/modules/admin/controllers/WidgetController.php index 011da8510b1cb8ee965375ab675bed082fbb6c83..841ac6959c15522f99b29d8f529f367f394fb131 100644 --- a/application/modules/admin/controllers/WidgetController.php +++ b/application/modules/admin/controllers/WidgetController.php @@ -225,7 +225,7 @@ class Admin_WidgetController extends ZendAfi_Controller_Action { ->setProfileId($this->_getParam('id_profil')) ->setParent($this->_getParam('parent')) ->load()) { - $this->_helper->notify($this->_('Impossible de configurer l\'élément : "%s"', get_class($instance))); + $this->_helper->notify($this->_('Impossible de configurer l\'élément')); return $this->_redirectClose($this->_getReferer()); } diff --git a/library/templates/Intonation/Library/Widget/Search/View.php b/library/templates/Intonation/Library/Widget/Search/View.php index 7e31073d0f5b202ae2e4f676f12bfefe0a3aa4db..b399ce0e79353032aa38951bbdb66399255a8a31 100644 --- a/library/templates/Intonation/Library/Widget/Search/View.php +++ b/library/templates/Intonation/Library/Widget/Search/View.php @@ -256,9 +256,10 @@ abstract class IntonationSearchRenderAbstract { protected function _renderPicto($text) { - return false === strpos($text, ' ') - ? $text - : Class_Template::current()->getIco($this->_view, $text); + return ( 0 === strpos($text, ZendAfi_View_Helper_RenderIcon::CLASS_STRATEGY)) + || ( 0 === strpos($text, ZendAfi_View_Helper_RenderIcon::URL_STRATEGY)) + ? Class_Template::current()->getIco($this->_view, $text) + : $text; } diff --git a/tests/scenarios/Templates/TemplatesSearchTest.php b/tests/scenarios/Templates/TemplatesSearchTest.php index adc5a28f54bab02e71def5173bf632ee3fe28447..b26d3856be381aaa8feaa38e2bf242f271c0f53b 100644 --- a/tests/scenarios/Templates/TemplatesSearchTest.php +++ b/tests/scenarios/Templates/TemplatesSearchTest.php @@ -32,6 +32,7 @@ abstract class TemplatesSearchWithSortParameterInWidgetTestCase extends Admin_A ->setBoiteOfTypeInDivision(1, Intonation_Library_Widget_Search_Definition::CODE, ['tri' => Class_CriteresRecherche::SORT_NOVELTY_DESC, + 'search_button' => 'Recherche simple', 'placeholder' => 'Pomme, poire']) ->assertSave(); } @@ -62,6 +63,12 @@ class TemplatesSearchWithSortParameterInWidgetFromIndexPageTest extends Template public function formShouldContainsHiddenInputTriWithValueDateCreationAscAlphaTitreAsc() { $this->assertXPath('//form//input[@type="hidden"][@name="tri"][@value="date_creation desc, alpha_titre asc"]'); } + + + /** @test */ + public function searchSubmitButtonShouldBeRechercheSimple() { + $this->assertXPathContentContains('//div[@id="boite_1"]//button[contains(@class, "search_submit_button")]', 'Recherche simple'); + } } @@ -1277,3 +1284,49 @@ class TemplatesSearchHighlightCollectionTest extends AbstractControllerTestCase 'cahiers'); } } + + + + +class TemplatesSearchSearchSubmitButtonTest extends Admin_AbstractControllerTestCase { + + protected + $_storm_default_to_volatile = true; + + + public function setUp() { + parent::setUp(); + + $this->_buildTemplateProfil(['id' => 1]); + } + + + public function searchButtonXpath() : array { + return [['class fas fa-search', + '//button//i[@class="fas fa-search"]'], + + ['Recherche simple', + '//button[text()="Recherche simple"]'], + + ['url https://une-icone-de-recherche.ch', + '//button//img[@src="https://une-icone-de-recherche.ch"]']]; + } + + + /** + * @test + * @dataProvider searchButtonXpath + */ + public function contextShouldExpectation($value, $xpath) { + Class_Profil::find(1) + ->setBoiteOfTypeInDivision(1, + Intonation_Library_Widget_Search_Definition::CODE, + ['tri' => Class_CriteresRecherche::SORT_NOVELTY_DESC, + 'search_button' => $value]) + ->assertSave(); + + $this->dispatch('/'); + + $this->assertXPath($xpath); + } +} \ No newline at end of file diff --git a/tests/scenarios/Templates/TemplatesWidgetTest.php b/tests/scenarios/Templates/TemplatesWidgetTest.php index b2db41396f1ae649f2bc0639926784559db99e25..3ac1b6077e866617d5363541ef4d1b3844da63ac 100644 --- a/tests/scenarios/Templates/TemplatesWidgetTest.php +++ b/tests/scenarios/Templates/TemplatesWidgetTest.php @@ -1821,3 +1821,20 @@ class TemplatesWidgetWithTopHighlightLayoutAndCycleTest extends AbstractTemplate $this->assertXPath('//div[contains(@class, "boite library")]//div[contains(@class, "carousel slide top_highlight_carousel")][@data-interval="2000"]'); } } + + + + +class TemplatesWidgetEditUnknownWidgetTest extends TemplatesIntonationTestCase { + + public function setUp() { + parent::setUp(); + $this->dispatch('/admin/widget/edit-widget/id/2478978973284729/id_profil/72'); + } + + + /** @test */ + public function shouldReturnErrorMessage() { + $this->assertFlashMessengerContentContains('Impossible de configurer l\'élément'); + } +}