From c82d95aecbbdf3379929ca99fb474909f08bfbf4 Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Mon, 1 Dec 2025 18:47:30 +0200 Subject: [PATCH] fix(editor): Standardize CSS class naming conventions across new design system components (#22551) --- .../src/v2/components/Checkbox/Checkbox.vue | 16 ++-- .../src/v2/components/Input/Input.test.ts | 19 +++-- .../src/v2/components/Input/Input.vue | 62 +++++++-------- .../components/Pagination/Pagination.test.ts | 27 ++++--- .../v2/components/Pagination/Pagination.vue | 70 ++++++++--------- .../src/v2/components/Select/Select.test.ts | 28 ++++--- .../src/v2/components/Select/Select.vue | 78 +++++++++---------- .../src/v2/components/Select/SelectItem.vue | 16 ++-- 8 files changed, 164 insertions(+), 152 deletions(-) diff --git a/packages/frontend/@n8n/design-system/src/v2/components/Checkbox/Checkbox.vue b/packages/frontend/@n8n/design-system/src/v2/components/Checkbox/Checkbox.vue index 5c0d05bddf8..a131016bd87 100644 --- a/packages/frontend/@n8n/design-system/src/v2/components/Checkbox/Checkbox.vue +++ b/packages/frontend/@n8n/design-system/src/v2/components/Checkbox/Checkbox.vue @@ -27,17 +27,17 @@ function onUpdate(value: boolean | 'indeterminate') { diff --git a/packages/frontend/@n8n/design-system/src/v2/components/Pagination/Pagination.test.ts b/packages/frontend/@n8n/design-system/src/v2/components/Pagination/Pagination.test.ts index 4d3546d8ce4..4d4b12fb474 100644 --- a/packages/frontend/@n8n/design-system/src/v2/components/Pagination/Pagination.test.ts +++ b/packages/frontend/@n8n/design-system/src/v2/components/Pagination/Pagination.test.ts @@ -1,8 +1,21 @@ import userEvent from '@testing-library/user-event'; import { render, waitFor } from '@testing-library/vue'; +import type { PaginationSizes, PaginationVariants } from './Pagination.types'; import Pagination from './Pagination.vue'; +const sizeCases: Array<[PaginationSizes | undefined, string]> = [ + [undefined, 'small'], + ['small', 'small'], + ['medium', 'medium'], +]; + +const variantCases: Array<[PaginationVariants | undefined, string]> = [ + [undefined, 'default'], + ['default', 'default'], + ['ghost', 'ghost'], +]; + describe('v2/components/Pagination', () => { describe('rendering', () => { it('should render with default props', () => { @@ -58,11 +71,7 @@ describe('v2/components/Pagination', () => { }); describe('sizes', () => { - test.each([ - [undefined, 'Small'], - ['small' as const, 'Small'], - ['medium' as const, 'Medium'], - ])('size %s should apply %s class', (size, expected) => { + test.each(sizeCases)('size %s should apply %s class', (size, expected) => { const wrapper = render(Pagination, { props: { total: 100, @@ -75,11 +84,7 @@ describe('v2/components/Pagination', () => { }); describe('variants', () => { - test.each([ - [undefined, 'Default'], - ['default' as const, 'Default'], - ['ghost' as const, 'Ghost'], - ])('variant %s should apply %s class', (variant, expected) => { + test.each(variantCases)('variant %s should apply %s class', (variant, expected) => { const wrapper = render(Pagination, { props: { total: 100, @@ -98,7 +103,7 @@ describe('v2/components/Pagination', () => { }, }); const container = wrapper.container.firstChild as HTMLElement; - expect(container?.className).toContain('Background'); + expect(container?.className).toContain('background'); }); }); diff --git a/packages/frontend/@n8n/design-system/src/v2/components/Pagination/Pagination.vue b/packages/frontend/@n8n/design-system/src/v2/components/Pagination/Pagination.vue index 151b62986a9..aa53a7d7964 100644 --- a/packages/frontend/@n8n/design-system/src/v2/components/Pagination/Pagination.vue +++ b/packages/frontend/@n8n/design-system/src/v2/components/Pagination/Pagination.vue @@ -161,19 +161,19 @@ const handlePageSizeUpdate = (newSize: number | string) => { // Styles const variants: Record = { - default: $style.Default, - ghost: $style.Ghost, + default: $style.default, + ghost: $style.ghost, }; const variant = computed(() => variants[props.variant]); const sizes: Record = { - small: $style.Small, - medium: $style.Medium, + small: $style.small, + medium: $style.medium, }; const size = computed(() => sizes[props.size]); // Background class -const backgroundClass = computed(() => (props.background ? $style.Background : '')); +const backgroundClass = computed(() => (props.background ? $style.background : '')); // Page size selector items const pageSizeItems = computed(() => @@ -200,13 +200,13 @@ const handleJumperSubmit = () => { - + {{ nextText }} @@ -273,14 +273,14 @@ const handleJumperSubmit = () => { -
- Go to +
+ Go to @@ -290,7 +290,7 @@ const handleJumperSubmit = () => {