ramiroaquinoromero commented on code in PR #37479:
URL: https://github.com/apache/superset/pull/37479#discussion_r2741957186
##########
superset-frontend/src/filters/components/Select/SelectFilterPlugin.test.tsx:
##########
@@ -680,6 +683,90 @@ describe('SelectFilterPlugin', () => {
expect(options[1]).toHaveTextContent('alpha');
expect(options[2]).toHaveTextContent('beta');
});
+
+ test('allowSelectAll is disabled when searchAllOptions is enabled and data
is truncated at 1000 rows', () => {
+ // Create mock data with 1000 rows to simulate truncation
+ const largeData = Array.from({ length: 1000 }, (_, i) => ({
+ gender: `value_${i}`,
+ }));
+
+ const { container } = getWrapper({
+ searchAllOptions: true,
+ multiSelect: true,
+ queriesData: [
+ {
+ rowcount: 1000,
+ colnames: ['gender'],
+ coltypes: [1],
+ data: largeData,
+ applied_filters: [{ column: 'gender' }],
+ rejected_filters: [],
+ },
+ ],
+ });
+ // Verify the Select component is rendered with multiSelect mode
+ const selectElement = container.querySelector('.ant-select-multiple');
+ expect(selectElement).toBeInTheDocument();
+ // Note: allowSelectAll is disabled because with searchAllOptions + 1000
rows,
+ // data is likely truncated, so "Select All" would be misleading
+ });
+
+ test('allowSelectAll is enabled when searchAllOptions is enabled but data is
less than 1000 rows', () => {
+ const { container } = getWrapper({
+ searchAllOptions: true,
+ multiSelect: true,
+ });
+ // With only 3 rows (default test data), Select All should work fine
+ const selectElement = container.querySelector('.ant-select-multiple');
+ expect(selectElement).toBeInTheDocument();
+ });
Review Comment:
I've updated the tests to properly verify that the "Select All" button is
actually present/absent in the dropdown.
The tests now:
- Open the dropdown by clicking the select input
- Explicitly check for "Select all" button text for enabled cases
- Explicitly check that "Select all" is NOT present for the 1000+ row case
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]