mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-10-31 10:39:30 +00:00 
			
		
		
		
	remove sorting of tags (#17604)
* remove sorting of tags from ui * add playwright tests * add playwright test for tags in children
This commit is contained in:
		
							parent
							
								
									749cf7945e
								
							
						
					
					
						commit
						dfafca8231
					
				| @ -201,7 +201,8 @@ export class EntityClass { | |||||||
|   async tag(page: Page, tag1: string, tag2: string) { |   async tag(page: Page, tag1: string, tag2: string) { | ||||||
|     await assignTag(page, tag1); |     await assignTag(page, tag1); | ||||||
|     await assignTag(page, tag2, 'Edit'); |     await assignTag(page, tag2, 'Edit'); | ||||||
|     await removeTag(page, [tag1, tag2]); |     await removeTag(page, [tag2]); | ||||||
|  |     await removeTag(page, [tag1]); | ||||||
| 
 | 
 | ||||||
|     await page |     await page | ||||||
|       .getByTestId('entity-right-panel') |       .getByTestId('entity-right-panel') | ||||||
| @ -233,7 +234,13 @@ export class EntityClass { | |||||||
|     }); |     }); | ||||||
|     await removeTagsFromChildren({ |     await removeTagsFromChildren({ | ||||||
|       page, |       page, | ||||||
|       tags: [tag1, tag2], |       tags: [tag2], | ||||||
|  |       rowId, | ||||||
|  |       rowSelector, | ||||||
|  |     }); | ||||||
|  |     await removeTagsFromChildren({ | ||||||
|  |       page, | ||||||
|  |       tags: [tag1], | ||||||
|       rowId, |       rowId, | ||||||
|       rowSelector, |       rowSelector, | ||||||
|     }); |     }); | ||||||
|  | |||||||
| @ -50,7 +50,6 @@ import { | |||||||
|   mockTableNameWithSpecialChar4, |   mockTableNameWithSpecialChar4, | ||||||
|   mockTableNameWithSpecialChar5, |   mockTableNameWithSpecialChar5, | ||||||
|   mockTags, |   mockTags, | ||||||
|   sortedMockTags, |  | ||||||
| } from './CommonUtils.mock'; | } from './CommonUtils.mock'; | ||||||
| 
 | 
 | ||||||
| const AXIOS_ERROR_MESSAGE = { | const AXIOS_ERROR_MESSAGE = { | ||||||
| @ -71,21 +70,7 @@ const AXIOS_ERROR_MESSAGE = { | |||||||
| describe('Tests for CommonUtils', () => { | describe('Tests for CommonUtils', () => { | ||||||
|   describe('Tests for sortTagsCaseInsensitive function', () => { |   describe('Tests for sortTagsCaseInsensitive function', () => { | ||||||
|     it('Input of unsorted array to sortTagsCaseInsensitive should return array of tags sorted by tagFQN', () => { |     it('Input of unsorted array to sortTagsCaseInsensitive should return array of tags sorted by tagFQN', () => { | ||||||
|       expect(sortTagsCaseInsensitive(cloneDeep(mockTags))).toEqual( |       expect(sortTagsCaseInsensitive(cloneDeep(mockTags))).toEqual(mockTags); | ||||||
|         sortedMockTags |  | ||||||
|       ); |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     it('Input of sorted array to sortTagsCaseInsensitive should return array of tags sorted by tagFQN', () => { |  | ||||||
|       expect(sortTagsCaseInsensitive(cloneDeep(sortedMockTags))).toEqual( |  | ||||||
|         sortedMockTags |  | ||||||
|       ); |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     it('Array returned by sortTagsCaseInsensitive should not be equal to the unsorted input array of tags', () => { |  | ||||||
|       expect(sortTagsCaseInsensitive(cloneDeep(mockTags))).not.toEqual( |  | ||||||
|         mockTags |  | ||||||
|       ); |  | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     it('Function getNameFromFQN should return the correct table name for fqn without special characters', () => { |     it('Function getNameFromFQN should return the correct table name for fqn without special characters', () => { | ||||||
|  | |||||||
| @ -733,9 +733,7 @@ export const getTrimmedContent = (content: string, limit: number) => { | |||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| export const sortTagsCaseInsensitive = (tags: TagLabel[]) => { | export const sortTagsCaseInsensitive = (tags: TagLabel[]) => { | ||||||
|   return tags.sort((tag1, tag2) => |   return tags; | ||||||
|     tag1.tagFQN.toLowerCase() < tag2.tagFQN.toLowerCase() ? -1 : 1 |  | ||||||
|   ); |  | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| export const Transi18next = ({ | export const Transi18next = ({ | ||||||
|  | |||||||
| @ -13,24 +13,12 @@ | |||||||
| 
 | 
 | ||||||
| import { cloneDeep } from 'lodash'; | import { cloneDeep } from 'lodash'; | ||||||
| import { sortTagsForCharts } from './DashboardDetailsUtils'; | import { sortTagsForCharts } from './DashboardDetailsUtils'; | ||||||
| import { mockCharts, sortedTagsMockCharts } from './DashboardDetailsUtils.mock'; | import { mockCharts } from './DashboardDetailsUtils.mock'; | ||||||
| 
 | 
 | ||||||
| describe('Tests for DashboardDetailsUtils', () => { | describe('Tests for DashboardDetailsUtils', () => { | ||||||
|   describe('Tests for sortTagsForCharts function', () => { |   describe('Tests for sortTagsForCharts function', () => { | ||||||
|     it('Input of unsorted array to sortTagsForCharts should return charts array with sorted order of tags by tagsFQN', () => { |     it('Input of unsorted array to sortTagsForCharts should return charts array with sorted order of tags by tagsFQN', () => { | ||||||
|       expect(sortTagsForCharts(cloneDeep(mockCharts))).toEqual( |       expect(sortTagsForCharts(cloneDeep(mockCharts))).toEqual(mockCharts); | ||||||
|         sortedTagsMockCharts |  | ||||||
|       ); |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     it('Input of sorted array to sortTagsForCharts should return charts array with sorted order of tags by tagsFQN', () => { |  | ||||||
|       expect(sortTagsForCharts(cloneDeep(sortedTagsMockCharts))).toEqual( |  | ||||||
|         sortedTagsMockCharts |  | ||||||
|       ); |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     it('The Array returned by sortTagsForCharts should not be eqaul to the unsorted input array', () => { |  | ||||||
|       expect(sortTagsForCharts(cloneDeep(mockCharts))).not.toEqual(mockCharts); |  | ||||||
|     }); |     }); | ||||||
|   }); |   }); | ||||||
| }); | }); | ||||||
|  | |||||||
| @ -14,7 +14,6 @@ | |||||||
| import { | import { | ||||||
|   mockPipelineDetails, |   mockPipelineDetails, | ||||||
|   mockPipelineDetailsWithoutTaskTags, |   mockPipelineDetailsWithoutTaskTags, | ||||||
|   mockSortedPipelineDetails, |  | ||||||
| } from './mocks/PipelineDetailsUtils.mock'; | } from './mocks/PipelineDetailsUtils.mock'; | ||||||
| import { getFormattedPipelineDetails } from './PipelineDetailsUtils'; | import { getFormattedPipelineDetails } from './PipelineDetailsUtils'; | ||||||
| 
 | 
 | ||||||
| @ -22,7 +21,7 @@ describe('PipelineDetailsUtils test', () => { | |||||||
|   it('getFormattedPipelineDetails should return pipeline details with sorted tags for tasks', () => { |   it('getFormattedPipelineDetails should return pipeline details with sorted tags for tasks', () => { | ||||||
|     const results = getFormattedPipelineDetails(mockPipelineDetails); |     const results = getFormattedPipelineDetails(mockPipelineDetails); | ||||||
| 
 | 
 | ||||||
|     expect(results).toEqual(mockSortedPipelineDetails); |     expect(results).toEqual(mockPipelineDetails); | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   it('getFormattedPipelineDetails should return pipeline details without any changes in case no tasks are present in it', () => { |   it('getFormattedPipelineDetails should return pipeline details without any changes in case no tasks are present in it', () => { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Karan Hotchandani
						Karan Hotchandani