Skip to content
Snippets Groups Projects
Commit 3bedddd5 authored by Laurent's avatar Laurent
Browse files

Merge branch 'hotline#133971_conserver_la_mise_en_page_des_avis_vsr_gpsea' into 'hotline'

hotline MT #133971 fix new ligne rendering of reviews

See merge request !4212
parents 996292d0 ae71ed53
Branches
Tags
3 merge requests!4230master in,!4227hotline#137304 : Worklfow : link sent in email for article validation in...,!4212hotline MT #133971 fix new ligne rendering of reviews
Pipeline #14780 passed with stage
in 49 minutes and 51 seconds
- ticket #133971 : Magasin de thèmes : Les sauts de lignes dans les avis sont maintenant visibles.
\ No newline at end of file
......@@ -139,14 +139,17 @@ abstract class Intonation_Library_View_Wrapper_Abstract {
? $this->_widget_context->getDescriptionLength()
: null;
$with_html = $this->_widget_context
? $this->_widget_context->getDescriptionHtml()
: null;
return $this->_view->truncate($text,
['class' => 'model_description_' . get_class($this->_model)],
$number_of_word,
$with_html);
$this->_allowHTMLInDescription());
}
protected function _allowHTMLInDescription() {
return $this->_widget_context
? $this->_widget_context->getDescriptionHtml()
: null;
}
......
......@@ -104,12 +104,12 @@ class Intonation_Library_View_Wrapper_Review extends Intonation_Library_View_Wra
public function getFullDescription() {
return $this->_model->getAvis();
return nl2br($this->_model->getAvis());
}
public function getDescription() {
return $this->_truncate($this->_model->getAvis());
return $this->_truncate($this->getFullDescription());
}
......@@ -204,4 +204,11 @@ class Intonation_Library_View_Wrapper_Review extends Intonation_Library_View_Wra
public function getOsmData() {
return null;
}
protected function _allowHTMLInDescription() {
return Intonation_Library_Widget_Carousel_NullContext::class == get_class($this->_widget_context)
? true
: parent::_allowHTMLInDescription();
}
}
\ No newline at end of file
......@@ -775,3 +775,88 @@ class TemplatesReviewsActionWithBabelthequeBabelioTest
$this->assertXPath('//form//input[@id="BW_id_isbn"][@value="0-12-345678-9"]');
}
}
class TemplateReviewsWithBrTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
$this->_buildTemplateProfil(['id' => 90,
'template' => 'MUSCLE']);
$reviewer = $this->fixture('Class_Users',
['id' => '88',
'login' => 'Albert',
'password' => 'secret',
'role_level' => ZendAfi_Acl_AdminControllerRoles::INVITE]);
$this->fixture(Class_Notice::class,
['id' => 8,
'clef_oeuvre' => 'PROMENADEPETITBONHOMME']);
$this->fixture(Class_AvisNotice::class,
['id' => 4,
'id_notice' => 8,
'clef_oeuvre' => 'PROMENADEPETITBONHOMME',
'note' => 4,
'entete' => 'With BR',
'avis' => 'With BR should go to next line',
])
->setUser($reviewer)
->setUserRole($reviewer)
->save();
ZendAfi_Auth::getInstance()->logUser($reviewer);
}
/** @test */
public function ratingFourShouldBeSavedWithBRInAvis() {
$this->postDispatch('abonne/review/id/4',
['note' => '4',
'entete' => 'With BR',
'avis' => 'With BR should go to <br>next line']);
$this->assertEquals('With BR should go to <br>next line',
Class_AvisNotice::find(4)->getAvis());
}
/** @test */
public function withBackSlashInAvisShouldRenderBrInDescription() {
Class_AvisNotice::find(4)->setAvis("With BR should go to\nnext line")->assertSave();
$this->dispatch('abonne/mes-avis');
$this->assertXPathContentContains('//div[contains(@class, "truncate_list_widget")]//div[@class="card"]//p[@class="model_description_Class_AvisNotice"]',
'With BR should go to<br/>
next line',
$this->_response->getBody());
}
/** @test */
public function brInAvisShouldRenderBrInDescription() {
Class_AvisNotice::find(4)->setAvis('With BR should go to<br/>next line')->assertSave();
$this->dispatch('abonne/mes-avis');
$this->assertXPathContentContains('//div[contains(@class, "truncate_list_widget")]//div[@class="card"]//p[@class="model_description_Class_AvisNotice"]',
'With BR should go to<br/>next line');
}
/** @test */
public function brInAvisShouldBeRemovedInJsContent() {
Class_AvisNotice::find(4)->setAvis('With BR should go to<br/>next line')->assertSave();
$this->dispatch('abonne/mes-avis');
$this->assertXPathContentContains('//div[contains(@class, "truncate_list_widget")]//div[@class="card"]//div[@class="hidde_content"]', 'With BR should go to next line');
}
/** @test */
public function backSlashNInAvisShouldBeRemovedInJsContent() {
Class_AvisNotice::find(4)->setAvis("With BR should go to\nnext line")->assertSave();
$this->dispatch('abonne/mes-avis');
$this->assertXPathContentContains('//div[contains(@class, "truncate_list_widget")]//div[@class="card"]//div[@class="hidde_content"]', 'With BR should go to next line');
}
}
\ No newline at end of file
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