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