diff --git a/VERSIONS_HOTLINE/182255 b/VERSIONS_HOTLINE/182255 new file mode 100644 index 0000000000000000000000000000000000000000..8b14778e4c8fb42c88570a55d679fc00fb8c6d75 --- /dev/null +++ b/VERSIONS_HOTLINE/182255 @@ -0,0 +1 @@ + - correctif #182255 : Magasin de thèmes : correction des liens ajouter à ma sélection Déjà lu, À lire et Mes préférés. \ No newline at end of file diff --git a/library/templates/Intonation/Library/Selection.php b/library/templates/Intonation/Library/Selection.php index 50bd0a7c5ec1b8b27a432a16bf313d795c317ff9..0bf90c37f8c3b8293014a0ec5e14fece133101d8 100644 --- a/library/templates/Intonation/Library/Selection.php +++ b/library/templates/Intonation/Library/Selection.php @@ -92,6 +92,10 @@ class Intonation_Library_Selection { sprintf("event.preventDefault(); event.stopPropagation(); var url = $(this).attr('href'); var anchors = $('a[href=\'' + url + '\']'); $.ajax({type: 'GET', url: '%s', success: function(data) {if (data){return anchors.replaceWith(data.anchor);} return false;}});", $url); + $popup = Class_Users::getIdentity() + ? false + : (null === $this->_authenticateProfile()); + return (new Intonation_Library_Link) ->setUrl($url) ->setAttribs(Class_Users::getIdentity() ? ['onclick' => $js] : []) @@ -101,7 +105,7 @@ class Intonation_Library_Selection { ->setClass($this->getClass()) ->setTitle($this->_getTitleForContext(false)) ->setScreenReaderText($this->_getTitleForContext()) - ->setPopup((null === $this->_authenticateProfile())); + ->setPopup($popup); } diff --git a/tests/scenarios/Templates/TemplatesSearchCartsTest.php b/tests/scenarios/Templates/TemplatesSearchCartsTest.php index f6eb5db6eb355bab31361eef6abff582521a60e4..e0aeb95fdfd22687eb3c7e490707a3ef62157a66 100644 --- a/tests/scenarios/Templates/TemplatesSearchCartsTest.php +++ b/tests/scenarios/Templates/TemplatesSearchCartsTest.php @@ -136,7 +136,7 @@ class TemplatesSearchCartsTest extends AbstractControllerTestCase { */ public function linkAddContainsRecordIdAndLabelName(string $label, string $end_url) { - $this->assertXPath(sprintf('//a[@href="/abonne/ajouter-le-document-a-la-selection/selection_label/%s/%s"]', + $this->assertXPath(sprintf('//a[@href="/abonne/ajouter-le-document-a-la-selection/selection_label/%s/%s"][not(@data-popup)]', urlencode($label), $end_url)); } @@ -165,8 +165,42 @@ class TemplatesSearchCartsTest extends AbstractControllerTestCase { */ public function linkDeleteContainsRecordIdAndLabelName(string $label, string $end_url) { - $this->assertXPath(sprintf('//a[@href="/abonne/supprimer-de-la-selection/selection_label/%s/%s"]', + $this->assertXPath(sprintf('//a[@href="/abonne/supprimer-de-la-selection/selection_label/%s/%s"][not(@data-popup)]', urlencode($label), $end_url)); } } + + + + +class TemplatesSearchCartsNotLoggedTest extends AbstractControllerTestCase { + public function setUp() { + parent::setUp(); + $this->_buildTemplateProfil(['id' => 99]); + + ZendAfi_Auth::getInstance()->clearIdentity(); + + $this->fixture(Class_Notice::class, + ['id' => 1, + 'type' => 1, + 'facettes' => 'T1', + 'type_doc' => Class_TypeDoc::LIVRE]); + + $mock_sql = $this->mock() + + ->whenCalled('fetchAll') + ->answers([[1, 'T1']]); + + + Zend_Registry::set('sql', $mock_sql); + + $this->dispatch('/recherche/pomme'); + } + + + /** @test */ + public function linkAddToSelectionDejaLuShouldContainsDataPopupTrue() { + $this->assertXPath('//a[contains(@href, "/abonne/ajouter-le-document-a-la-selection/selection_label")][@data-popup=1]'); + } +}