mirror of
https://github.com/apache/superset.git
synced 2026-04-23 01:55:09 +00:00
fix(heatmap): skip orderby for value-based axis sorts (#39290)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
de98fdc37b
commit
c971ea3ec6
@@ -32,7 +32,25 @@ const getQuery = (formData: QueryFormData) => buildQuery(formData).queries[0];
|
||||
const getRankOperation = (formData: QueryFormData) =>
|
||||
getQuery(formData).post_processing?.find(isPostProcessingRank);
|
||||
|
||||
test('adds X axis orderby when sorting alphabetically ascending', () => {
|
||||
test('Heatmap buildQuery omits orderby for value-based ascending X-axis sort', () => {
|
||||
const query = getQuery({
|
||||
...baseFormData,
|
||||
sort_x_axis: 'value_asc',
|
||||
});
|
||||
|
||||
expect(query.orderby).toEqual([]);
|
||||
});
|
||||
|
||||
test('Heatmap buildQuery omits orderby for value-based descending X-axis sort', () => {
|
||||
const query = getQuery({
|
||||
...baseFormData,
|
||||
sort_x_axis: 'value_desc',
|
||||
});
|
||||
|
||||
expect(query.orderby).toEqual([]);
|
||||
});
|
||||
|
||||
test('Heatmap buildQuery adds column orderby for alpha ascending X-axis sort', () => {
|
||||
const query = getQuery({
|
||||
...baseFormData,
|
||||
sort_x_axis: 'alpha_asc',
|
||||
@@ -41,7 +59,49 @@ test('adds X axis orderby when sorting alphabetically ascending', () => {
|
||||
expect(query.orderby).toEqual([['category', true]]);
|
||||
});
|
||||
|
||||
test('adds Y axis orderby when sorting alphabetically descending', () => {
|
||||
test('Heatmap buildQuery adds column orderby for alpha descending X-axis sort', () => {
|
||||
const query = getQuery({
|
||||
...baseFormData,
|
||||
sort_x_axis: 'alpha_desc',
|
||||
});
|
||||
|
||||
expect(query.orderby).toEqual([['category', false]]);
|
||||
});
|
||||
|
||||
test('Heatmap buildQuery omits X-axis orderby when sort_x_axis is not set', () => {
|
||||
const query = getQuery({ ...baseFormData });
|
||||
|
||||
expect(query.orderby).toEqual([]);
|
||||
});
|
||||
|
||||
test('Heatmap buildQuery omits orderby for value-based ascending Y-axis sort', () => {
|
||||
const query = getQuery({
|
||||
...baseFormData,
|
||||
sort_y_axis: 'value_asc',
|
||||
});
|
||||
|
||||
expect(query.orderby).toEqual([]);
|
||||
});
|
||||
|
||||
test('Heatmap buildQuery omits orderby for value-based descending Y-axis sort', () => {
|
||||
const query = getQuery({
|
||||
...baseFormData,
|
||||
sort_y_axis: 'value_desc',
|
||||
});
|
||||
|
||||
expect(query.orderby).toEqual([]);
|
||||
});
|
||||
|
||||
test('Heatmap buildQuery adds column orderby for alpha ascending Y-axis sort', () => {
|
||||
const query = getQuery({
|
||||
...baseFormData,
|
||||
sort_y_axis: 'alpha_asc',
|
||||
});
|
||||
|
||||
expect(query.orderby).toEqual([['region', true]]);
|
||||
});
|
||||
|
||||
test('Heatmap buildQuery adds column orderby for alpha descending Y-axis sort', () => {
|
||||
const query = getQuery({
|
||||
...baseFormData,
|
||||
sort_y_axis: 'alpha_desc',
|
||||
@@ -50,7 +110,13 @@ test('adds Y axis orderby when sorting alphabetically descending', () => {
|
||||
expect(query.orderby).toEqual([['region', false]]);
|
||||
});
|
||||
|
||||
test('should ALWAYS include rank operation when normalized=true', () => {
|
||||
test('Heatmap buildQuery omits Y-axis orderby when sort_y_axis is not set', () => {
|
||||
const query = getQuery({ ...baseFormData });
|
||||
|
||||
expect(query.orderby).toEqual([]);
|
||||
});
|
||||
|
||||
test('Heatmap buildQuery always includes rank operation when normalized is true', () => {
|
||||
const rankOperation = getRankOperation({
|
||||
...baseFormData,
|
||||
normalized: true,
|
||||
@@ -60,7 +126,7 @@ test('should ALWAYS include rank operation when normalized=true', () => {
|
||||
expect(rankOperation?.operation).toBe('rank');
|
||||
});
|
||||
|
||||
test('should ALWAYS include rank operation when normalized=false', () => {
|
||||
test('Heatmap buildQuery always includes rank operation when normalized is false', () => {
|
||||
const rankOperation = getRankOperation({
|
||||
...baseFormData,
|
||||
normalized: false,
|
||||
@@ -70,11 +136,8 @@ test('should ALWAYS include rank operation when normalized=false', () => {
|
||||
expect(rankOperation?.operation).toBe('rank');
|
||||
});
|
||||
|
||||
test('should ALWAYS include rank operation when normalized is undefined', () => {
|
||||
const rankOperation = getRankOperation({
|
||||
...baseFormData,
|
||||
// normalized not set
|
||||
});
|
||||
test('Heatmap buildQuery always includes rank operation when normalized is unset', () => {
|
||||
const rankOperation = getRankOperation({ ...baseFormData });
|
||||
|
||||
expect(rankOperation).toBeDefined();
|
||||
expect(rankOperation?.operation).toBe('rank');
|
||||
|
||||
Reference in New Issue
Block a user