diff --git a/VERSIONS_HOTLINE/170633 b/VERSIONS_HOTLINE/170633 new file mode 100644 index 0000000000000000000000000000000000000000..dde8e6bb2f1ee86a1e361fdcd81b7e5351d3c714 --- /dev/null +++ b/VERSIONS_HOTLINE/170633 @@ -0,0 +1 @@ + - correctif #170633 : Administration : Correction de l'enregistrement de la valeur par défaut de la propriété "Visible aux tailles" pour les divisions. \ No newline at end of file diff --git a/library/templates/Intonation/System/Abstract.php b/library/templates/Intonation/System/Abstract.php index 4b0ec5adbcb4400ce96bb7dded49551f3240c5f1..f155ed6a4270ee18defa01f04380a20c9c5c1288 100644 --- a/library/templates/Intonation/System/Abstract.php +++ b/library/templates/Intonation/System/Abstract.php @@ -373,7 +373,7 @@ abstract class Intonation_System_Abstract { protected function _defaultsSettings() { $map = ['expand_breakpoint' => Intonation_Library_Constants::RESPONSIVE_MODE_SMALL, - 'hidden_mode' => Intonation_Library_Constants::WIDTH_AUTO, + 'hidden_mode' => Intonation_Library_Constants::RESPONSIVE_MODES, 'width_xsmall' => Intonation_Library_Constants::WIDTH_AUTO, 'width_small' => Intonation_Library_Constants::WIDTH_AUTO, 'width_medium' => Intonation_Library_Constants::WIDTH_AUTO, diff --git a/library/templates/Intonation/System/Section.php b/library/templates/Intonation/System/Section.php index 5d863d6c61f76d7bfb91b66fb21d182ea2292c24..52ddb99ede074ce0e8bd73b6ab9039beca2526c4 100644 --- a/library/templates/Intonation/System/Section.php +++ b/library/templates/Intonation/System/Section.php @@ -79,7 +79,7 @@ class Intonation_System_Section extends Intonation_System_Abstract { protected function _defaultsSettings() { return array_merge(parent::_defaultsSettings(), [Class_Template::current()->withNameSpace('display_mode') => Intonation_Library_Constants::SECTION_DISPLAY_MODE_COL, - Class_Template::current()->withNameSpace('hidden_mode') => Intonation_Library_Constants::RESPONSIVE_MODE_XSMALL]); + Class_Template::current()->withNameSpace('hidden_mode') => Intonation_Library_Constants::RESPONSIVE_MODES]); } diff --git a/tests/scenarios/Templates/TemplatesArticlesTest.php b/tests/scenarios/Templates/TemplatesArticlesTest.php index 2c8aaeecc20fea882b27ca10e5988a80a87a01a5..467b941877e17ab96f4afa21a641c865c60956d0 100644 --- a/tests/scenarios/Templates/TemplatesArticlesTest.php +++ b/tests/scenarios/Templates/TemplatesArticlesTest.php @@ -994,7 +994,7 @@ class TemplatesArticlesWithWidgetRenderWallNotLoggedTest public function rssLinkShouldContainsCacheKey() { $expected_settings = ['MybibappExpandBreakpoint' => 'sm', - 'MybibappHiddenMode' => '', + 'MybibappHiddenMode' => ['', 'sm', 'md', 'lg', 'xl'], 'MybibappWidthXsmall' => '', 'MybibappWidthSmall' => '', 'MybibappWidthMedium' => '', diff --git a/tests/scenarios/Templates/TemplatesSectionTest.php b/tests/scenarios/Templates/TemplatesSectionTest.php index 336a01fa5e8b46394933236b02eb4eefd66e2eff..651a76188ecc369084ff9b54ebbcf168ad3c1570 100644 --- a/tests/scenarios/Templates/TemplatesSectionTest.php +++ b/tests/scenarios/Templates/TemplatesSectionTest.php @@ -34,3 +34,45 @@ class TemplatesSectionAdminToolsTest extends TemplatesIntonationTestCase { $this->assertXPath('//div[@class=\'section_configuration\']//img[@alt=\'Modifier la section "Division principale"\']'); } } + + + + +class TemplatesSectionDefaultHiddenModeTest extends AbstractControllerTestCase { + public function setUp() { + parent::setUp(); + $this->_buildTemplateProfil(['id' => 890]); + } + + + public function paramsToCss() : array { + return + [['', ''], + [null, ''], + ['sm', 'd-none d-sm-block'], + [[], 'd-none'], + [[''], 'd-sm-none d-md-none d-lg-none d-xl-none'], + [['','sm', 'md', 'lg', 'xl'] , ''], + [['', 'md', 'lg'] , 'd-md-block d-lg-block d-sm-none d-xl-none'], + [['xl'] , 'd-xl-block d-none d-sm-none d-md-none d-lg-none']]; + } + + + /** + * @test + * @dataProvider paramsToCss + */ + public function mainShouldHaveExpectedHiddenModeSet($hidden_param, $classes) { + $section = (new Class_Systeme_Widget_Section_Main) + ->setProfileId(890) + ->load(); + + $section + ->setNewDatas(['IntonationHiddenMode' => $hidden_param]) + ->updateProfile(); + + $this->dispatch('/index'); + + $this->assertXPath('//main[@class="col' . ($classes ? ' ' . $classes : '') . '"]'); + } +} diff --git a/tests/scenarios/Templates/TemplatesTest.php b/tests/scenarios/Templates/TemplatesTest.php index 64cf4604891733f3d202badcbd662a7f466a0dcc..3f5bb5a801fe90153641c36ce239fe3bddcb7c06 100644 --- a/tests/scenarios/Templates/TemplatesTest.php +++ b/tests/scenarios/Templates/TemplatesTest.php @@ -670,6 +670,10 @@ class TemplatesDispatchEditAllSectionTest extends TemplatesIntonationTestCase { [1, '//select[@name="IntonationDisplayMode"]//option[@value="col"][@selected]'], [1, '//select[@name="IntonationWidthXsmall"]//option[@value="3"][@selected]'], [1, '//input[@name="IntonationHiddenMode[]"][@value=""][@checked]'], + [1, '//input[@name="IntonationHiddenMode[]"][@value="sm"][@checked]'], + [1, '//input[@name="IntonationHiddenMode[]"][@value="md"][@checked]'], + [1, '//input[@name="IntonationHiddenMode[]"][@value="lg"][@checked]'], + [1, '//input[@name="IntonationHiddenMode[]"][@value="xl"][@checked]'], [2, '//h1[contains(text(), "Division principale")]'], [2, '//input[@name="IntonationVisibilityIndex"][not(@checked)]'], @@ -681,6 +685,10 @@ class TemplatesDispatchEditAllSectionTest extends TemplatesIntonationTestCase { [2, '//select[@name="IntonationDisplayMode"]//option[@value="col"][@selected]'], [2, '//select[@name="IntonationWidthXsmall"]//option[@value=""][@selected]'], [2, '//input[@name="IntonationHiddenMode[]"][@value=""][@checked]'], + [2, '//input[@name="IntonationHiddenMode[]"][@value="sm"][@checked]'], + [2, '//input[@name="IntonationHiddenMode[]"][@value="md"][@checked]'], + [2, '//input[@name="IntonationHiddenMode[]"][@value="lg"][@checked]'], + [2, '//input[@name="IntonationHiddenMode[]"][@value="xl"][@checked]'], [3, '//h1[contains(text(), "Seconde division optionnelle")]'], [3, '//input[@name="IntonationVisibilityIndex"][@checked]'], @@ -833,8 +841,7 @@ class TemplatesPostEditTest extends TemplatesEnabledTestCase { parent::setUp(); $this->postDispatch('/admin/template/edit/template/intonation', - ['IntonationHiddenMode' => Intonation_Library_Constants::RESPONSIVE_MODE_MEDIUM, - 'IntonationHydratingMappingSource' => ['body', 'widget'], + ['IntonationHydratingMappingSource' => ['body', 'widget'], 'IntonationHydratingMappingDestination' => ['container-fluid', ''], 'IntonationIconsMapDocTypesSource' => ['1', '2'], 'IntonationIconsMapDocTypesDestination' => ['class fas fa-link', '']]); @@ -847,12 +854,6 @@ class TemplatesPostEditTest extends TemplatesEnabledTestCase { } - /** @test */ - public function intonationHiddenModeShouldHaveBeenSavedToMd() { - $this->assertEquals('md', Class_Template::current()->getIntonationHiddenMode()); - } - - /** @test */ public function intonationCoreCssShouldHaveBeenSavedTo1() { $this->assertEquals('1',