From dd57af9278601aace2d6e323040f9d4eb3e3446f Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Tue, 19 May 2020 15:32:11 -0700 Subject: [PATCH 1/3] Fix docblock --- template/twig/extension/ideas_status_icon.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/template/twig/extension/ideas_status_icon.php b/template/twig/extension/ideas_status_icon.php index d1561607..f40d0202 100644 --- a/template/twig/extension/ideas_status_icon.php +++ b/template/twig/extension/ideas_status_icon.php @@ -1,14 +1,11 @@ * @license GNU General Public License, version 2 (GPL-2.0) * - * For full copyright and license information, please see - * the docs/CREDITS.txt file. - * */ namespace phpbb\ideas\template\twig\extension; From 8149b736851bc17b0a71c3f361d2a7bad150fd4b Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Tue, 19 May 2020 15:32:32 -0700 Subject: [PATCH 2/3] Fix all overflow issues on idea panel --- styles/prosilver/theme/ideas.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/styles/prosilver/theme/ideas.css b/styles/prosilver/theme/ideas.css index dcf4e936..67e09929 100644 --- a/styles/prosilver/theme/ideas.css +++ b/styles/prosilver/theme/ideas.css @@ -9,6 +9,10 @@ dd.topics { font-weight: 400 !important; } +.idea-panel dd { + overflow: visible !important; +} + /* Vote buttons */ .minivote { line-height: normal; @@ -184,10 +188,6 @@ dd.topics { color: #ffffff; } -.status-dropdown-container { - overflow: visible !important; -} - .status-dropdown { margin-top: 8px; } From f5cba3d89cdcb4ae888dcf837645fcb192a7f669 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Tue, 19 May 2020 16:17:09 -0700 Subject: [PATCH 3/3] Add tests for the new custom twig function --- tests/template/status_icon_test.php | 98 +++++++++++++++++++++++ tests/template/templates/status_icon.html | 1 + 2 files changed, 99 insertions(+) create mode 100644 tests/template/status_icon_test.php create mode 100644 tests/template/templates/status_icon.html diff --git a/tests/template/status_icon_test.php b/tests/template/status_icon_test.php new file mode 100644 index 00000000..d1344f48 --- /dev/null +++ b/tests/template/status_icon_test.php @@ -0,0 +1,98 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ + +namespace phpbb\ideas\tests\template; + +require_once __DIR__ . '/../../../../../../tests/template/template_test_case.php'; + +class status_icon_test extends \phpbb_template_template_test_case +{ + protected $test_path = __DIR__; + + protected function setup_engine(array $new_config = array()) + { + global $phpbb_root_path, $phpEx; + + $defaults = $this->config_defaults(); + $config = new \phpbb\config\config(array_merge($defaults, $new_config)); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $this->lang = $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $this->user = $user; + + $filesystem = new \phpbb\filesystem\filesystem(); + + $path_helper = new \phpbb\path_helper( + new \phpbb\symfony_request( + new \phpbb_mock_request() + ), + $filesystem, + $this->createMock('\phpbb\request\request'), + $phpbb_root_path, + $phpEx + ); + + $this->template_path = $this->test_path . '/templates'; + + $container = new \phpbb_mock_container_builder(); + $cache_path = $phpbb_root_path . 'cache/twig'; + $context = new \phpbb\template\context(); + $loader = new \phpbb\template\twig\loader(new \phpbb\filesystem\filesystem(), ''); + $twig = new \phpbb\template\twig\environment( + $config, + $filesystem, + $path_helper, + $cache_path, + null, + $loader, + new \phpbb\event\dispatcher($container), + [ + 'cache' => false, + 'debug' => false, + 'auto_reload' => true, + 'autoescape' => false, + ] + ); + $this->template = new \phpbb\template\twig\twig( + $path_helper, + $config, + $context, + $twig, + $cache_path, + $this->user, + [ + new \phpbb\template\twig\extension($context, $twig, $this->lang), + new \phpbb\ideas\template\twig\extension\ideas_status_icon(), + ] + ); + $twig->setLexer(new \phpbb\template\twig\lexer($twig)); + $this->template->set_custom_style('tests', $this->template_path); + } + + public function data_template_status_icons() + { + return [ + [0, ''], + [1, 'fa-lightbulb-o'], + [2, 'fa-code-fork'], + [3, 'fa-check'], + [4, 'fa-files-o'], + [5, 'fa-ban'], + ]; + } + + /** + * @dataProvider data_template_status_icons + */ + public function test_ideas_status_icon($var, $expected) + { + $this->run_template('status_icon.html', ['id' => $var], [], [], $expected, []); + } +} diff --git a/tests/template/templates/status_icon.html b/tests/template/templates/status_icon.html new file mode 100644 index 00000000..7769952a --- /dev/null +++ b/tests/template/templates/status_icon.html @@ -0,0 +1 @@ +{{ ideas_status_icon(id) }}