diff --git a/library/ZendAfi/View/Helper/TagEditArticle.php b/library/ZendAfi/View/Helper/TagEditArticle.php index 6beb6f36066e0977d2902e7c68afb4a0b720b32a..70f27ad4649eb512fb421f6d26f5b967783f5d0c 100644 --- a/library/ZendAfi/View/Helper/TagEditArticle.php +++ b/library/ZendAfi/View/Helper/TagEditArticle.php @@ -34,7 +34,8 @@ class ZendAfi_View_Helper_TagEditArticle extends ZendAfi_View_Helper_BaseHelper if (!Class_Users::isCurrentUserCanEditArticle($article)) return ''; - return $this->_renderEdit() . $this->_renderVersion(); + return $this->_tag('div', $this->_renderEdit() . $this->_renderVersion(), + ['class' => 'edit_article']); } diff --git a/public/admin/css/front_nav.css b/public/admin/css/front_nav.css index c5143b5c4ac2850e855fdc601e8b83a5d660ab99..5060492f66aede1878584fe097437df5ddc5962e 100644 --- a/public/admin/css/front_nav.css +++ b/public/admin/css/front_nav.css @@ -232,7 +232,11 @@ div.menu_vertical ul a.edit_menu, left: -1em !important; } -article header .edit_article, section .edit_library { top: 2ex; -} \ No newline at end of file +} + +article header .edit_article { + position:absolute; + top: 2ex; +} diff --git a/tests/library/ZendAfi/View/Helper/Accueil/NewsTest.php b/tests/library/ZendAfi/View/Helper/Accueil/NewsTest.php index 09cd0607f75e23542aee5d4575f1dcfbe6bbb428..de4961d7b2b849520f5c1f59638f309a0592958d 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/NewsTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/NewsTest.php @@ -22,11 +22,12 @@ require_once 'library/ZendAfi/View/Helper/ViewHelperTestCase.php'; abstract class NewsHelperTestCase extends ViewHelperTestCase { + protected $_storm_default_to_volatile = true; + public function setUp() { parent::setUp(); - Storm_Model_Loader::defaultToVolatile(); - $this->article_wrapper = Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Article'); + $this->article_wrapper = $this->onLoaderOfModel('Class_Article'); Class_Profil::setCurrentProfil(Class_Profil::newInstanceWithId(5)); Zend_Registry::get('translate')->setLocale('fr'); @@ -329,7 +330,9 @@ class NewsHelperWithThreeArticlesWithPermissionUserModoTest extends NewsHelperWi -class NewsHelperWithThreeArticlesWorkflowActivatedUserAdminTest extends NewsHelperWithThreeArticlesTestCase { +class NewsHelperWithThreeArticlesWorkflowActivatedUserAdminTest + extends NewsHelperWithThreeArticlesTestCase { + public function setUp() { parent::setUp(); @@ -352,27 +355,36 @@ class NewsHelperWithThreeArticlesWorkflowActivatedUserAdminTest extends NewsHelp 'op_largeur_img' => 200, 'op_transition' => 'zork']]; + Class_Versions::setPersistence($this->mock()->whenCalled('count')->answers(2)); + $helper = new ZendAfi_View_Helper_Accueil_News(12, $params); $helper->setView(new ZendAfi_Controller_Action_Helper_View()); $this->html = $helper->getBoite(); } + + public function tearDown() { + Class_Versions::setPersistence(null); + parent::tearDown(); + } + + /** @test */ - function getArticlesByPreferencesParamsShouldContainStatusValidated() { + public function getArticlesByPreferencesParamsShouldContainStatusValidated() { $prefs = $this->article_wrapper->getFirstAttributeForLastCallOn('getArticlesByPreferences'); $this->assertEquals(Class_Article::STATUS_VALIDATED, $prefs['status'][1]); } /** @test */ - function getArticlesByPreferencesParamsShouldContainStatusDraft() { + public function getArticlesByPreferencesParamsShouldContainStatusDraft() { $prefs = $this->article_wrapper->getFirstAttributeForLastCallOn('getArticlesByPreferences'); $this->assertEquals(Class_Article::STATUS_DRAFT, $prefs['status'][0]); } /** @test */ - function getArticlesByPreferencesParamsShouldNotContainLangue() { + public function getArticlesByPreferencesParamsShouldNotContainLangue() { $prefs = $this->article_wrapper->getFirstAttributeForLastCallOn('getArticlesByPreferences'); $this->assertFalse(array_isset('langue',$prefs)); } @@ -405,20 +417,27 @@ class NewsHelperWithThreeArticlesWorkflowActivatedUserAdminTest extends NewsHelp /** @test */ - function editArticleLinksShouldBePresent() { + public function editArticleLinksShouldBePresent() { + $this->assertXPath($this->html, + '//div[contains(@class, "edit_article")]//a[contains(@href, "admin/cms/edit/id/34")]'); + } + + + /** @test */ + public function articleVersionLinkShouldBePresent() { $this->assertXPath($this->html, - '//a[contains(@href, "admin/cms/edit/id/34")]//img[@class="article_edit"]'); + '//div[contains(@class, "edit_article")]//a[contains(@href, "admin/cms/version/id/34")]'); } /** @test */ - function separatorShouldNotBeVisible() { + public function separatorShouldNotBeVisible() { $this->assertNotXPath($this->html, '//div[@class="article_full_separator"]'); } /** @test */ - function diaporamaTransitionShouldFallbackToFade() { + public function diaporamaTransitionShouldFallbackToFade() { $this->assertContains('"fx":"fade"', Class_ScriptLoader::getInstance()->html()); }