c8cd81
From 02d3fb8266d8199fd1ed983de6c57b269546df82 Mon Sep 17 00:00:00 2001
c8cd81
From: Armando Neto <abiagion@redhat.com>
c8cd81
Date: Fri, 8 Jul 2022 15:56:31 -0300
c8cd81
Subject: [PATCH] webui: Do not allow empty pagination size
c8cd81
c8cd81
Pagination size must be required, the current validators are triggered after
c8cd81
form is submitted, thus the only way for check if data is not empty is by making
c8cd81
the field required.
c8cd81
c8cd81
Fixes: https://pagure.io/freeipa/issue/9192
c8cd81
c8cd81
Signed-off-by: Armando Neto <abiagion@redhat.com>
c8cd81
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
c8cd81
---
c8cd81
 .../ui/src/freeipa/Application_controller.js  |  1 +
c8cd81
 ipatests/test_webui/test_misc_cases.py        | 19 +++++++++++++++++++
c8cd81
 2 files changed, 20 insertions(+)
c8cd81
c8cd81
diff --git a/install/ui/src/freeipa/Application_controller.js b/install/ui/src/freeipa/Application_controller.js
c8cd81
index 46aabc9c4dd47aa3874cb3ddf27da048607b7516..140ee8fe0d7adc274396248aae0be2f4559db27a 100644
c8cd81
--- a/install/ui/src/freeipa/Application_controller.js
c8cd81
+++ b/install/ui/src/freeipa/Application_controller.js
c8cd81
@@ -318,6 +318,7 @@ define([
c8cd81
                         $type: 'text',
c8cd81
                         name: 'pagination_size',
c8cd81
                         label: '@i18n:customization.table_pagination',
c8cd81
+                        required: true,
c8cd81
                         validators: ['positive_integer']
c8cd81
                     }
c8cd81
                 ]
c8cd81
diff --git a/ipatests/test_webui/test_misc_cases.py b/ipatests/test_webui/test_misc_cases.py
c8cd81
index 5f7ffb54ee33e9b453d6b987b7bf84d6f4311ebd..aca9e1a99e1e2cf60790fe8c33a65430e0d535e2 100644
c8cd81
--- a/ipatests/test_webui/test_misc_cases.py
c8cd81
+++ b/ipatests/test_webui/test_misc_cases.py
c8cd81
@@ -11,6 +11,11 @@ from ipatests.test_webui.ui_driver import screenshot
c8cd81
 import pytest
c8cd81
 import re
c8cd81
 
c8cd81
+try:
c8cd81
+    from selenium.webdriver.common.by import By
c8cd81
+except ImportError:
c8cd81
+    pass
c8cd81
+
c8cd81
 
c8cd81
 @pytest.mark.tier1
c8cd81
 class TestMiscCases(UI_driver):
c8cd81
@@ -26,3 +31,17 @@ class TestMiscCases(UI_driver):
c8cd81
         ver_re = re.compile('version: .*')
c8cd81
         assert re.search(ver_re, about_text), 'Version not found'
c8cd81
         self.dialog_button_click('ok')
c8cd81
+
c8cd81
+    @screenshot
c8cd81
+    def test_customization_pagination_input_required(self):
c8cd81
+        """Test if 'pagination size' is required when submitting the form."""
c8cd81
+        self.init_app()
c8cd81
+
c8cd81
+        self.profile_menu_action('configuration')
c8cd81
+        self.fill_input('pagination_size', '')
c8cd81
+        self.dialog_button_click('save')
c8cd81
+
c8cd81
+        pagination_size_elem = self.find(
c8cd81
+            ".widget[name='pagination_size']", By.CSS_SELECTOR)
c8cd81
+
c8cd81
+        self.assert_field_validation_required(parent=pagination_size_elem)
c8cd81
-- 
c8cd81
2.36.1
c8cd81