diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a3c92f039f..68a0dad48d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1319,6 +1319,9 @@ importers: specifier: 5.1.2 version: 5.1.2 devDependencies: + '@semcore/badge': + specifier: workspace:* + version: link:../badge '@semcore/base-components': specifier: workspace:* version: link:../base-components @@ -19556,7 +19559,7 @@ snapshots: sirv: 3.0.2 tinyglobby: 0.2.17 tinyrainbow: 2.0.0 - vitest: 3.2.4(@types/debug@4.1.13)(@types/node@25.5.2)(@vitest/browser@3.2.4)(@vitest/ui@3.2.4)(happy-dom@9.20.3)(jsdom@22.1.0)(lightningcss@1.31.1)(sass@1.100.0)(sugarss@5.0.1(postcss@8.5.15))(terser@5.48.0)(yaml@2.8.3) + vitest: 3.2.4(@types/debug@4.1.13)(@types/node@25.5.2)(@vitest/browser@3.2.4)(@vitest/ui@3.2.4)(happy-dom@9.20.3)(jsdom@22.1.0)(lightningcss@1.31.1)(sass@1.100.0)(sugarss@5.0.1(postcss@8.5.14))(terser@5.48.0)(yaml@2.8.3) '@vitest/utils@3.2.4': dependencies: diff --git a/semcore/carousel/__tests__/__snapshots__/index.test.tsx.snap b/semcore/carousel/__tests__/__snapshots__/index.test.tsx.snap index 9a58a738a6..5c74edc9fd 100644 --- a/semcore/carousel/__tests__/__snapshots__/index.test.tsx.snap +++ b/semcore/carousel/__tests__/__snapshots__/index.test.tsx.snap @@ -106,3 +106,110 @@ exports[`Carousel > Verify data-ui-name 1`] = ` "uiName": null, } `; + +exports[`Carousel > Verify data-ui-name 2`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "ChevronLeft", + }, + ], + "uiName": "Button.Addon", + }, + ], + "uiName": "Button.InnerWrapper", + }, + ], + "uiName": "Button", + }, + ], + "uiName": "Carousel.Prev", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Carousel.Item", + }, + { + "children": [], + "uiName": "Carousel.Item", + }, + ], + "uiName": "Carousel.Container", + }, + ], + "uiName": "Carousel.ContentBox", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "ChevronRight", + }, + ], + "uiName": "Button.Addon", + }, + ], + "uiName": "Button.InnerWrapper", + }, + ], + "uiName": "Button", + }, + ], + "uiName": "Carousel.Next", + }, + ], + "uiName": "Flex", + }, + { + "children": [ + { + "children": [], + "uiName": "Carousel.Indicator", + }, + { + "children": [], + "uiName": "Carousel.Indicator", + }, + ], + "uiName": "Carousel.Indicators", + }, + ], + "uiName": "Carousel", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/carousel/__tests__/index.test.tsx b/semcore/carousel/__tests__/index.test.tsx index a4eee3ad0d..31f83496ba 100644 --- a/semcore/carousel/__tests__/index.test.tsx +++ b/semcore/carousel/__tests__/index.test.tsx @@ -35,6 +35,20 @@ describe('Carousel', () => { expect(result).toMatchSnapshot(); }); + test('Verify data-ui-name', () => { + const carousel = ( + + + + + ); + + const { container } = render(carousel); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + test('Verify control mode', () => { const spy = vi.fn(); diff --git a/semcore/drag-and-drop/__tests__/__snapshots__/index.test.tsx.snap b/semcore/drag-and-drop/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..7f9acf1815 --- /dev/null +++ b/semcore/drag-and-drop/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,30 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`DragAndDrop > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [], + "uiName": "DragAndDrop.Draggable", + }, + { + "children": [], + "uiName": "DragAndDrop.Draggable", + }, + { + "children": [], + "uiName": "DragAndDrop.DropZone", + }, + ], + "uiName": "DragAndDrop", + }, + { + "children": [], + "uiName": "Box", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/drag-and-drop/__tests__/index.test.tsx b/semcore/drag-and-drop/__tests__/index.test.tsx index 6b6b3d5f75..d871bfb755 100644 --- a/semcore/drag-and-drop/__tests__/index.test.tsx +++ b/semcore/drag-and-drop/__tests__/index.test.tsx @@ -1,6 +1,36 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; -import { describe } from '@semcore/testing-utils/vitest'; +import { cleanup, render } from '@semcore/testing-utils/testing-library'; +import { beforeEach, describe, expect, test } from '@semcore/testing-utils/vitest'; +import React from 'react'; + +import DragAndDrop from '../src'; describe('drag-and-drop Dependency imports', () => { runDependencyCheckTests('drag-and-drop'); }); + +describe('DragAndDrop', () => { + beforeEach(cleanup); + + test('Verify data-ui-name', () => { + const dragAndDrop = ( + {}}> + + First item + + + Second item + + + Drop zone + + + ); + + const { container } = render(dragAndDrop); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); +}); diff --git a/semcore/dropdown-menu/__tests__/__snapshots__/index.test.tsx.snap b/semcore/dropdown-menu/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..51bb280d91 --- /dev/null +++ b/semcore/dropdown-menu/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,132 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`DropdownMenu > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "ButtonTrigger.Text", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "ChevronDown", + }, + ], + "uiName": "ButtonTrigger.Addon", + }, + ], + "uiName": "DropdownMenu.Trigger.InnerTriggerWrapper", + }, + ], + "uiName": "DropdownMenu.Trigger", + }, + { + "children": [], + "uiName": null, + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Flex", + }, + ], + "uiName": "Dropdown.Item", + }, + { + "children": [ + { + "children": [], + "uiName": "DropdownMenu.Item", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "DropdownMenu.Item.Addon", + }, + { + "children": [], + "uiName": "DropdownMenu.Item.Text", + }, + ], + "uiName": "DropdownMenu.Item.Content", + }, + { + "children": [], + "uiName": "DropdownMenu.Item.Hint", + }, + ], + "uiName": "DropdownMenu.Item", + }, + ], + "uiName": "DropdownMenu.Group", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Button.Text", + }, + ], + "uiName": "Button.InnerWrapper", + }, + ], + "uiName": "Button", + }, + ], + "uiName": "DropdownMenu.Actions", + }, + { + "children": [], + "uiName": "DropdownMenu.StatusItem", + }, + { + "children": [], + "uiName": "Box", + }, + ], + "uiName": null, + }, + ], + "uiName": "ScrollArea.Container", + }, + ], + "uiName": "DropdownMenu.Menu", + }, + ], + "uiName": "DropdownMenu.Popper", + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": null, +} +`; diff --git a/semcore/dropdown-menu/__tests__/index.test.tsx b/semcore/dropdown-menu/__tests__/index.test.tsx index 39d56496bb..efaf76c18f 100644 --- a/semcore/dropdown-menu/__tests__/index.test.tsx +++ b/semcore/dropdown-menu/__tests__/index.test.tsx @@ -1,6 +1,7 @@ import { Box } from '@semcore/base-components'; import { ButtonTrigger } from '@semcore/base-trigger'; import Button from '@semcore/button'; +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { cleanup, render, userEvent } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi } from '@semcore/testing-utils/vitest'; @@ -15,14 +16,37 @@ describe('dropdown-menu Dependency imports', () => { describe('DropdownMenu', () => { beforeEach(() => { cleanup(); + }); + + test('Verify data-ui-name', () => { + const dropdownMenu = ( + + + Trigger + + + + Item 1 + + + Before + Item 2 + + Hint text + + + + + + + + + ); + + const { container } = render(dropdownMenu); + const result = extractUIName(container); - const mockIntersectionObserver = vi.fn(); - mockIntersectionObserver.mockReturnValue({ - observe: () => null, - unobserve: () => null, - disconnect: () => null, - }); - window.IntersectionObserver = mockIntersectionObserver; + expect(result).toMatchSnapshot(); }); test.sequential('Verify does not trigger visibility change on Space key in input', async () => { diff --git a/semcore/dropdown/__tests__/__snapshots__/index.test.tsx.snap b/semcore/dropdown/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..fc291e2b61 --- /dev/null +++ b/semcore/dropdown/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,25 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Dropdown > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [], + "uiName": "Dropdown.Trigger", + }, + { + "children": [], + "uiName": null, + }, + { + "children": [], + "uiName": "Dropdown.Popper", + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": null, +} +`; diff --git a/semcore/dropdown/__tests__/index.test.tsx b/semcore/dropdown/__tests__/index.test.tsx index ccdcb68c61..2d1d41d772 100644 --- a/semcore/dropdown/__tests__/index.test.tsx +++ b/semcore/dropdown/__tests__/index.test.tsx @@ -1,3 +1,4 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { cleanup, @@ -81,6 +82,22 @@ describe('Dropdown', () => { window.IntersectionObserver = mockIntersectionObserver; }); + test('Verify data-ui-name', () => { + const dropdown = ( + + + Trigger + + + + ); + + const { container } = render(dropdown); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + test('Verify not open popper by keyboard enter if interaction none', async () => { const spy = vi.fn(); render( diff --git a/semcore/errors/__tests__/__snapshots__/index.test.tsx.snap b/semcore/errors/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..5ace18444d --- /dev/null +++ b/semcore/errors/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,104 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Error > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": null, + }, + { + "children": [ + { + "children": [], + "uiName": "Error.Title", + }, + { + "children": [], + "uiName": "Error.Description", + }, + { + "children": [], + "uiName": "Error.Controls", + }, + ], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": "Error", + }, + ], + "uiName": null, +} +`; + +exports[`PageError > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": null, + }, + { + "children": [ + { + "children": [], + "uiName": "Error.Title", + }, + { + "children": [], + "uiName": "Error.Description", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Button.Text", + }, + ], + "uiName": "Button.InnerWrapper", + }, + ], + "uiName": "Button", + }, + ], + "uiName": "Error.Controls", + }, + ], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": "PageError", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/errors/__tests__/index.test.tsx b/semcore/errors/__tests__/index.test.tsx index 79e4128e85..55e3b6863b 100644 --- a/semcore/errors/__tests__/index.test.tsx +++ b/semcore/errors/__tests__/index.test.tsx @@ -1,15 +1,46 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; -import { render, screen, userEvent } from '@semcore/testing-utils/testing-library'; -import { describe, it, expect, vi } from '@semcore/testing-utils/vitest'; +import { cleanup, render, screen, userEvent } from '@semcore/testing-utils/testing-library'; +import { beforeEach, describe, it, expect, vi } from '@semcore/testing-utils/vitest'; import React from 'react'; -import { PageError } from '../src'; +import BaseError, { PageError } from '../src'; describe('errors Dependency imports', () => { runDependencyCheckTests('errors'); }); +describe('Error', () => { + beforeEach(cleanup); + + it('Verify data-ui-name', () => { + const error = ( + + Error title + Error description + Controls + + ); + + const { container } = render(error); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); +}); + describe('PageError', () => { + beforeEach(cleanup); + + it('Verify data-ui-name', () => { + const pageError = ; + + const { container } = render(pageError); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + it('Verify calls onClick when reload button is clicked', async () => { const handleClick = vi.fn((event: React.MouseEvent) => { event.preventDefault(); diff --git a/semcore/feature-highlight/__tests__/__snapshots__/index.test.tsx.snap b/semcore/feature-highlight/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..fdfb3e2712 --- /dev/null +++ b/semcore/feature-highlight/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,440 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`BadgeFH > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [], + "uiName": "BadgeFH", + }, + ], + "uiName": null, +} +`; + +exports[`ButtonFH > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "SummaryAI", + }, + ], + "uiName": "ButtonFH.Addon", + }, + { + "children": [], + "uiName": "ButtonFH.Text", + }, + { + "children": [ + { + "children": [], + "uiName": "BadgeFH", + }, + ], + "uiName": "ButtonFH.Addon", + }, + ], + "uiName": "ButtonFH.InnerWrapper", + }, + ], + "uiName": "ButtonFH", + }, + ], + "uiName": null, +} +`; + +exports[`ButtonTriggerFH > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "SummaryAI", + }, + ], + "uiName": "ButtonTriggerFH.Addon", + }, + { + "children": [], + "uiName": "ButtonTriggerFH.Text", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "ChevronDown", + }, + ], + "uiName": "ButtonTrigger.Addon", + }, + ], + "uiName": "ButtonTriggerFH.InnerTriggerWrapper", + }, + ], + "uiName": "ButtonTriggerFH", + }, + ], + "uiName": null, +} +`; + +exports[`CheckboxFH > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [], + "uiName": "CheckboxFH.Value", + }, + { + "children": [], + "uiName": "Value.CheckMark", + }, + { + "children": [], + "uiName": "CheckboxFH.Text", + }, + ], + "uiName": "CheckboxFH", + }, + ], + "uiName": null, +} +`; + +exports[`InputFH > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "SummaryAI", + }, + ], + "uiName": "InputFH.Addon", + }, + { + "children": [], + "uiName": "InputFH.Value", + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": "InputFH", + }, + ], + "uiName": null, +} +`; + +exports[`NoticeFH > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [], + "uiName": "NoticeFH.Label", + }, + { + "children": [ + { + "children": [], + "uiName": "NoticeFH.Title", + }, + { + "children": [], + "uiName": "NoticeFH.Text", + }, + { + "children": [], + "uiName": "NoticeFH.Actions", + }, + ], + "uiName": "NoticeFH.Content", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Close", + }, + ], + "uiName": "Button.Addon", + }, + ], + "uiName": "NoticeFH.Close.InnerWrapper", + }, + ], + "uiName": "NoticeFH.Close", + }, + ], + "uiName": "NoticeFH", + }, + ], + "uiName": null, +} +`; + +exports[`PillsFH > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Pills.Item.Text", + }, + ], + "uiName": "PillsFH.Item", + }, + { + "children": [ + { + "children": [], + "uiName": "HighlightedItem.Text", + }, + { + "children": [], + "uiName": "HighlightedItem.Addon", + }, + ], + "uiName": "PillsFH.HighlightedItem", + }, + ], + "uiName": "PillsFH", + }, + ], + "uiName": null, +} +`; + +exports[`RadioFH > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [], + "uiName": "RadioFH.Value", + }, + { + "children": [], + "uiName": "Value.RadioMark", + }, + { + "children": [], + "uiName": "RadioFH.Text", + }, + ], + "uiName": "RadioFH", + }, + ], + "uiName": null, +} +`; + +exports[`SelectFH > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "SummaryAI", + }, + ], + "uiName": "SelectFH.Trigger.Addon", + }, + { + "children": [], + "uiName": "SelectFH.Trigger.Text", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "ChevronDown", + }, + ], + "uiName": "ButtonTrigger.Addon", + }, + ], + "uiName": "SelectFH.Trigger.InnerTriggerWrapper", + }, + ], + "uiName": "SelectFH.Trigger", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "SelectFH.Option", + }, + ], + "uiName": null, + }, + ], + "uiName": "ScrollArea.Container", + }, + ], + "uiName": "SelectFH.Menu", + }, + ], + "uiName": "Select.Popper", + }, + ], + "uiName": "SelectFH.Popper", + }, + ], + "uiName": null, +} +`; + +exports[`SwitchFH > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "SwitchFH.Value", + }, + { + "children": [], + "uiName": "Box", + }, + ], + "uiName": "Box", + }, + { + "children": [], + "uiName": "SwitchFH.Addon", + }, + ], + "uiName": "SwitchFH", + }, + ], + "uiName": null, +} +`; + +exports[`TabLineFH > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "TabLine.Item.Text", + }, + ], + "uiName": "TabLineFH.Item", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "SummaryAI", + }, + ], + "uiName": "HighlightedItem.Addon", + }, + { + "children": [], + "uiName": "HighlightedItem.Text", + }, + ], + "uiName": "TabLineFH.HighlightedItem", + }, + ], + "uiName": "TabLineFH", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/feature-highlight/__tests__/index.test.tsx b/semcore/feature-highlight/__tests__/index.test.tsx index 796c408d09..273c5575a1 100644 --- a/semcore/feature-highlight/__tests__/index.test.tsx +++ b/semcore/feature-highlight/__tests__/index.test.tsx @@ -1,5 +1,6 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { render } from '@semcore/testing-utils/testing-library'; -import { expect, test, describe } from '@semcore/testing-utils/vitest'; +import { expect, describe } from '@semcore/testing-utils/vitest'; import React, { createRef } from 'react'; import { BadgeFH } from '../src/components/badge/Badge'; @@ -9,11 +10,20 @@ import { InputFH } from '../src/components/input/Input'; import { NoticeFH } from '../src/components/notice/Notice'; import { PillsFH } from '../src/components/pills/Pills'; import { RadioFH } from '../src/components/radio/Radio'; +import { SelectFH } from '../src/components/select/Select'; import { SwitchFH } from '../src/components/switch/Switch'; import { TabLineFH } from '../src/components/tab-line/TabLine'; +import { ButtonTriggerFH } from '../src/inner-components/button-trigger/ButtonTrigger'; import SvgSparkle from '../src/inner-components/sparkle/Sparkle'; -describe('SvgSparkle', () => { +const expectUINameToMatchSnapshot = (component: React.ReactElement) => { + const { container } = render(component); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); +}; + +describe('SvgSparkle', (test) => { test('Verify renders an SVG element', () => { const { container } = render(); const svg = container.querySelector('svg'); @@ -37,7 +47,27 @@ const verifyDataTestIds = (container: HTMLElement, ids: string[], texts?: Record }); }; -describe('PillsFH', () => { +describe('BadgeFH', (test) => { + test('Verify data-ui-name', () => { + expectUINameToMatchSnapshot(AI-powered); + }); +}); + +describe('PillsFH', (test) => { + test('Verify data-ui-name', () => { + const pills = ( + + One + + Two + {999} + + + ); + + expectUINameToMatchSnapshot(pills); + }); + test('Verify allow adding data-test-id everywhere', () => { const { container } = render( @@ -58,7 +88,21 @@ describe('PillsFH', () => { }); }); -describe('ButtonFH', () => { +describe('ButtonFH', (test) => { + test('Verify data-ui-name', () => { + const button = ( + + + Button + + AI-powered + + + ); + + expectUINameToMatchSnapshot(button); + }); + test('Verify allow adding data-test-id everywhere', () => { const { container } = render( @@ -77,7 +121,31 @@ describe('ButtonFH', () => { }); }); -describe('CheckboxFH', () => { +describe('ButtonTriggerFH', (test) => { + test('Verify data-ui-name', () => { + const buttonTrigger = ( + + + Button trigger + + ); + + expectUINameToMatchSnapshot(buttonTrigger); + }); +}); + +describe('CheckboxFH', (test) => { + test('Verify data-ui-name', () => { + const checkbox = ( + + + First option + + ); + + expectUINameToMatchSnapshot(checkbox); + }); + test('Verify allow adding data-test-id everywhere', () => { const { container } = render( @@ -92,7 +160,18 @@ describe('CheckboxFH', () => { }); }); -describe('InputFH', () => { +describe('InputFH', (test) => { + test('Verify data-ui-name', () => { + const input = ( + + + + + ); + + expectUINameToMatchSnapshot(input); + }); + test('Verify allow adding data-test-id everywhere', () => { const { container } = render( @@ -105,7 +184,43 @@ describe('InputFH', () => { }); }); -describe('NoticeFH', () => { +describe('SelectFH', (test) => { + test('Verify data-ui-name', () => { + const select = ( + + + + One + + + + One + + + + ); + + expectUINameToMatchSnapshot(select); + }); +}); + +describe('NoticeFH', (test) => { + test.sequential('Verify data-ui-name', () => { + const notice = ( + + + + + + + + + + ); + + expectUINameToMatchSnapshot(notice); + }); + test('Verify render closable notice with data-test-id', () => { const { container } = render( , @@ -132,7 +247,7 @@ describe('NoticeFH', () => { expect(container.querySelector('[data-testid="label-icon"]')).toBeTruthy(); }); - test('Should render in advanced mode with subcomponents', () => { + test.sequential('Should render in advanced mode with subcomponents', () => { const { getByText, container } = render( @@ -185,7 +300,18 @@ describe('NoticeFH', () => { }); }); -describe('RadioFH', () => { +describe('RadioFH', (test) => { + test('Verify data-ui-name', () => { + const radio = ( + + + First option + + ); + + expectUINameToMatchSnapshot(radio); + }); + test('Verify allow adding data-test-id to all subcomponents', () => { const { container } = render( @@ -200,7 +326,18 @@ describe('RadioFH', () => { }); }); -describe('SwitchFH', () => { +describe('SwitchFH', (test) => { + test('Verify data-ui-name', () => { + const switchFH = ( + + + Medium switch + + ); + + expectUINameToMatchSnapshot(switchFH); + }); + test('Verify allow adding data-test-id to all subcomponents', () => { const { container } = render( @@ -215,7 +352,21 @@ describe('SwitchFH', () => { }); }); -describe('TabLineFH', () => { +describe('TabLineFH', (test) => { + test('Verify data-ui-name', () => { + const tabLine = ( + + First option + + + Second option + + + ); + + expectUINameToMatchSnapshot(tabLine); + }); + test('Verify allow adding data-test-id to all subcomponents', () => { const { container } = render( diff --git a/semcore/feature-popover/__tests__/__snapshots__/index.test.jsx.snap b/semcore/feature-popover/__tests__/__snapshots__/index.test.jsx.snap new file mode 100644 index 0000000000..6b08d5f39b --- /dev/null +++ b/semcore/feature-popover/__tests__/__snapshots__/index.test.jsx.snap @@ -0,0 +1,57 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`FeaturePopover.Popper > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [], + "uiName": "FeaturePopover.Spot", + }, + ], + "uiName": "FeaturePopover.Trigger", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Close", + }, + ], + "uiName": "Button.Addon", + }, + ], + "uiName": "Button.InnerWrapper", + }, + ], + "uiName": "Button", + }, + ], + "uiName": "FeaturePopover.Popper", + }, + ], + "uiName": "Animation", + }, + ], + "uiName": "Popper.Popper", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/feature-popover/__tests__/index.test.jsx b/semcore/feature-popover/__tests__/index.test.jsx index 4f25ec0868..8f9e247fd2 100644 --- a/semcore/feature-popover/__tests__/index.test.jsx +++ b/semcore/feature-popover/__tests__/index.test.jsx @@ -1,4 +1,5 @@ import Button from '@semcore/button'; +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { cleanup, render } from '@semcore/testing-utils/testing-library'; import { beforeEach, describe, expect, test } from '@semcore/testing-utils/vitest'; @@ -13,6 +14,25 @@ describe('feature-popover Dependency imports', () => { describe('FeaturePopover.Popper', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const featurePopover = ( + + + Trigger + + + + Feature content + + + ); + + const { container } = render(featurePopover); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + test('Verify supports custom tag', () => { const { getByTestId } = render( diff --git a/semcore/feedback-form/__tests__/__snapshots__/index.test.tsx.snap b/semcore/feedback-form/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..a1255af563 --- /dev/null +++ b/semcore/feedback-form/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,234 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`FeedbackForm > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Notice.Content", + }, + ], + "uiName": "FeedbackForm.Notice", + }, + { + "children": [ + { + "children": [], + "uiName": "FeedbackForm.Item", + }, + ], + "uiName": "Tooltip.Trigger", + }, + { + "children": [ + { + "children": [], + "uiName": null, + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": "FeedbackForm.Success", + }, + { + "children": [ + { + "children": [], + "uiName": "FeedbackForm.Cancel.InnerWrapper", + }, + ], + "uiName": "FeedbackForm.Cancel", + }, + { + "children": [ + { + "children": [], + "uiName": "FeedbackForm.Submit.InnerWrapper", + }, + ], + "uiName": "FeedbackForm.Submit", + }, + ], + "uiName": "FeedbackForm", + }, + ], + "uiName": "SpinContainer.Content", + }, + ], + "uiName": "SpinContainer", + }, + ], + "uiName": null, +} +`; + +exports[`FeedbackRating - Props and Rendering > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + { + "children": [], + "uiName": null, + }, + { + "children": [], + "uiName": null, + }, + { + "children": [], + "uiName": null, + }, + { + "children": [], + "uiName": null, + }, + { + "children": [], + "uiName": null, + }, + { + "children": [], + "uiName": null, + }, + { + "children": [], + "uiName": null, + }, + { + "children": [], + "uiName": null, + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Feedback", + }, + ], + "uiName": "Notice.Label", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Text", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "SliderRating.Star", + }, + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "SliderRating.Star", + }, + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "SliderRating.Star", + }, + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "SliderRating.Star", + }, + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "SliderRating.Star", + }, + ], + "uiName": "SliderRating", + }, + ], + "uiName": "Notice.Actions", + }, + ], + "uiName": "Notice.Text", + }, + ], + "uiName": "Notice.Content", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Close", + }, + ], + "uiName": "Button.Addon", + }, + ], + "uiName": "Notice.Close.InnerWrapper", + }, + ], + "uiName": "Notice.Close", + }, + ], + "uiName": "Notice", + }, + ], + "uiName": "FeedbackRatingForm", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/feedback-form/__tests__/index.test.tsx b/semcore/feedback-form/__tests__/index.test.tsx index f18d541b87..d51ea9303e 100644 --- a/semcore/feedback-form/__tests__/index.test.tsx +++ b/semcore/feedback-form/__tests__/index.test.tsx @@ -1,4 +1,5 @@ import CongratsIllustration from '@semcore/illustration/Congrats'; +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { render, cleanup, userEvent } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi } from '@semcore/testing-utils/vitest'; @@ -14,6 +15,25 @@ describe('feedback-form Dependency imports', () => { describe('FeedbackForm', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const feedbackForm = ( + {}}> + + + {({ input }) => } + + + + + + ); + + const { container } = render(feedbackForm); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + test.concurrent('Verify call onSubmit', async () => { const onSubmit = vi.fn(); @@ -181,6 +201,27 @@ describe('FeedbackRating - Props and Rendering', () => { errorFeedbackEmail: 'test@example.com', }; + test('Verify data-ui-name', () => { + const feedbackRating = ( + Feedback header} + /> + ); + + const { container } = render(feedbackRating); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + test('Should render with default props', () => { const { getByText } = render(); diff --git a/semcore/fullscreen-modal/__tests__/__snapshots__/index.test.tsx.snap b/semcore/fullscreen-modal/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..5997ac9dca --- /dev/null +++ b/semcore/fullscreen-modal/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,110 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`FullscreenModal > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Close", + }, + ], + "uiName": "Button.Addon", + }, + ], + "uiName": "FullscreenModal.Close.InnerWrapper", + }, + ], + "uiName": "FullscreenModal.Close", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "ArrowLeft", + }, + ], + "uiName": "Link.Addon", + }, + { + "children": [], + "uiName": "ButtonLink.Text", + }, + ], + "uiName": "FullscreenModal.Back.InnerWrapper", + }, + ], + "uiName": "FullscreenModal.Back", + }, + { + "children": [ + { + "children": [], + "uiName": "FullscreenModal.Title", + }, + { + "children": [], + "uiName": "FullscreenModal.Description", + }, + ], + "uiName": "FullscreenModal.Header", + }, + { + "children": [ + { + "children": [], + "uiName": "FullscreenModal.Section", + }, + ], + "uiName": "FullscreenModal.Body", + }, + { + "children": [], + "uiName": "FullscreenModal.Footer", + }, + ], + "uiName": "FullscreenModal", + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Modal.Overlay.ContentWrapper", + }, + ], + "uiName": "Modal.Overlay", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/fullscreen-modal/__tests__/index.test.tsx b/semcore/fullscreen-modal/__tests__/index.test.tsx index 07988ba154..2221905acf 100644 --- a/semcore/fullscreen-modal/__tests__/index.test.tsx +++ b/semcore/fullscreen-modal/__tests__/index.test.tsx @@ -1,3 +1,4 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { render, cleanup, screen, userEvent } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi } from '@semcore/testing-utils/vitest'; @@ -12,6 +13,27 @@ describe('fullscreen-modal Dependency imports', () => { describe('FullscreenModal', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const fullscreenModal = ( + + Back + + Modal title + Modal description + + + Modal content + + Modal footer + + ); + + const { container } = render(fullscreenModal); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + test('should support hidden props', () => { const { rerender, queryByText } = render(Text); expect(queryByText(/Text/)).toBeNull(); diff --git a/semcore/inline-edit/__tests__/__snapshots__/index.test.tsx.snap b/semcore/inline-edit/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..60e4b2ec5d --- /dev/null +++ b/semcore/inline-edit/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,18 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`InlineEdit > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [], + "uiName": "InlineEdit.View", + }, + ], + "uiName": "InlineEdit", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/inline-edit/__tests__/index.test.tsx b/semcore/inline-edit/__tests__/index.test.tsx index 6c355de8c3..b4871da0be 100644 --- a/semcore/inline-edit/__tests__/index.test.tsx +++ b/semcore/inline-edit/__tests__/index.test.tsx @@ -1,3 +1,4 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { render } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, vi } from '@semcore/testing-utils/vitest'; @@ -10,6 +11,20 @@ describe('inline-edit Dependency imports', () => { }); describe('InlineEdit', () => { + test('Verify data-ui-name', () => { + const inlineEdit = ( + + + + + ); + + const { container } = render(inlineEdit); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + test('Verify throws error when rendered without children', () => { const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {}); expect(() => render()).toThrow( diff --git a/semcore/inline-input/__tests__/__snapshots__/index.test.tsx.snap b/semcore/inline-input/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..ec4a1ca5a1 --- /dev/null +++ b/semcore/inline-input/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,85 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`InlineInput > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "InlineInput.Addon", + }, + { + "children": [], + "uiName": "InlineInput.Value", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Check", + }, + ], + "uiName": "Link.Addon", + }, + ], + "uiName": "ButtonLink.InnerWrapper", + }, + ], + "uiName": "ButtonLink", + }, + ], + "uiName": "InlineInput.ConfirmControl", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Close", + }, + ], + "uiName": "Link.Addon", + }, + ], + "uiName": "ButtonLink.InnerWrapper", + }, + ], + "uiName": "ButtonLink", + }, + ], + "uiName": "InlineInput.CancelControl", + }, + ], + "uiName": null, + }, + ], + "uiName": "InlineInput", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/inline-input/__tests__/index.test.tsx b/semcore/inline-input/__tests__/index.test.tsx index 8e32ee6caa..cbc62f24c0 100644 --- a/semcore/inline-input/__tests__/index.test.tsx +++ b/semcore/inline-input/__tests__/index.test.tsx @@ -1,3 +1,4 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { cleanup, render, userEvent, waitFor } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi } from '@semcore/testing-utils/vitest'; @@ -12,6 +13,24 @@ describe('inline-input Dependency imports', () => { describe('InlineInput', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const inlineInput = ( + <> + + + + + + + + ); + + const { container } = render(inlineInput); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + test.sequential('Verify blur behavior', async () => { // Leaving the field with Tab always discards changes (calls onCancel), // regardless of onBlurBehavior. onBlurBehavior governs mouse blur only. diff --git a/semcore/input-mask/__tests__/__snapshots__/index.test.tsx.snap b/semcore/input-mask/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..26fca3aa8e --- /dev/null +++ b/semcore/input-mask/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,49 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`InputMask > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Badge", + }, + ], + "uiName": "InputMask.Addon", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Box", + }, + { + "children": [], + "uiName": "InputMask.Value", + }, + ], + "uiName": "Flex", + }, + { + "children": [], + "uiName": "Box", + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": "InputMask", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/input-mask/__tests__/index.test.tsx b/semcore/input-mask/__tests__/index.test.tsx index e3ac3f6b68..2e5cd6efd7 100644 --- a/semcore/input-mask/__tests__/index.test.tsx +++ b/semcore/input-mask/__tests__/index.test.tsx @@ -1,3 +1,5 @@ +import Badge from '@semcore/badge'; +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { cleanup, render, userEvent } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach } from '@semcore/testing-utils/vitest'; @@ -12,6 +14,20 @@ describe('input-mask Dependency imports', () => { describe('InputMask', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const inputMask = ( + + + + + ); + + const { container } = render(inputMask); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + test.sequential('Should renders correctly', async () => { const Component = ({ value = '' }) => ( diff --git a/semcore/input-mask/package.json b/semcore/input-mask/package.json index 84ebcd6677..15f099d0b5 100644 --- a/semcore/input-mask/package.json +++ b/semcore/input-mask/package.json @@ -30,6 +30,7 @@ }, "devDependencies": { "@semcore/core": "workspace:*", + "@semcore/badge": "workspace:*", "@semcore/base-components": "workspace:*", "@semcore/testing-utils": "workspace:*" } diff --git a/semcore/input-number/__tests__/__snapshots__/index.test.tsx.snap b/semcore/input-number/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..8e10e63562 --- /dev/null +++ b/semcore/input-number/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,59 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`InputNumber > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [], + "uiName": "InputNumber.Addon", + }, + { + "children": [], + "uiName": "InputNumber.Value", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": null, + }, + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": "InputNumber.Controls", + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": "InputNumber", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/input-number/__tests__/index.test.tsx b/semcore/input-number/__tests__/index.test.tsx index c3aa8dea10..4cc6363c63 100644 --- a/semcore/input-number/__tests__/index.test.tsx +++ b/semcore/input-number/__tests__/index.test.tsx @@ -1,3 +1,4 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { cleanup, render, userEvent } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi } from '@semcore/testing-utils/vitest'; @@ -12,6 +13,21 @@ describe('input-number Dependency imports', () => { describe('InputNumber', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const inputNumber = ( + + + + + + ); + + const { container } = render(inputNumber); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + const focusInput = async (input: HTMLElement) => { await userEvent.click(input); expect(input).toHaveFocus(); diff --git a/semcore/input-tags/__tests__/__snapshots__/index.test.tsx.snap b/semcore/input-tags/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..2b78090335 --- /dev/null +++ b/semcore/input-tags/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,87 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`InputTags > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "InputTags.Tag.Circle", + }, + ], + "uiName": "Box", + }, + { + "children": [], + "uiName": "InputTags.Tag.Addon", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "InputTags.Tag.Text.Content", + }, + ], + "uiName": "Tag.Text", + }, + ], + "uiName": "InputTags.Tag.Text", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Close", + }, + ], + "uiName": "InputTags.Tag.Close", + }, + ], + "uiName": "InputTags.Tag", + }, + ], + "uiName": null, + }, + { + "children": [], + "uiName": "InputTags.Value", + }, + { + "children": [], + "uiName": null, + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": "ScrollArea.Container", + }, + ], + "uiName": "InputTags", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/input-tags/__tests__/index.test.tsx b/semcore/input-tags/__tests__/index.test.tsx index 510ceaee92..24d686df30 100644 --- a/semcore/input-tags/__tests__/index.test.tsx +++ b/semcore/input-tags/__tests__/index.test.tsx @@ -1,3 +1,4 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { render, userEvent, cleanup } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi } from '@semcore/testing-utils/vitest'; @@ -12,6 +13,29 @@ describe('input-tags Dependency imports', () => { describe('InputTags', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const inputTags = ( + + + + + + + + + + + + + + ); + + const { container } = render(inputTags); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + test('Verify calls onClick', async () => { const onClick = vi.fn(); const { getByRole } = render( diff --git a/semcore/input/__tests__/__snapshots__/index.test.tsx.snap b/semcore/input/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..8b5e602711 --- /dev/null +++ b/semcore/input/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,26 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Input > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Input.Addon", + }, + { + "children": [], + "uiName": "Input.Value", + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Input", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/input/__tests__/index.test.tsx b/semcore/input/__tests__/index.test.tsx index a30c5630e3..058b83e15b 100644 --- a/semcore/input/__tests__/index.test.tsx +++ b/semcore/input/__tests__/index.test.tsx @@ -1,3 +1,4 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { cleanup, render, userEvent } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi } from '@semcore/testing-utils/vitest'; @@ -12,6 +13,20 @@ describe('input Dependency imports', () => { describe('Input', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const input = ( + + + + + ); + + const { container } = render(input); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + test.concurrent('Verify value changes when rerender', () => { const { getByTestId, rerender } = render( diff --git a/semcore/link/__tests__/__snapshots__/index.test.tsx.snap b/semcore/link/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..eccabddb21 --- /dev/null +++ b/semcore/link/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,27 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Link > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Link.Addon", + }, + { + "children": [], + "uiName": "Link.Text", + }, + ], + "uiName": "Link.InnerWrapper", + }, + ], + "uiName": "Link", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/link/__tests__/index.test.tsx b/semcore/link/__tests__/index.test.tsx index 9a071bdbc1..549a1fdebc 100644 --- a/semcore/link/__tests__/index.test.tsx +++ b/semcore/link/__tests__/index.test.tsx @@ -1,3 +1,4 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { cleanup, render } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach } from '@semcore/testing-utils/vitest'; @@ -12,6 +13,20 @@ describe('link Dependency imports', () => { describe('Link', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const link = ( + + + + + ); + + const { container } = render(link); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + test('Verify not use ', () => { const { getByTestId } = render( diff --git a/semcore/mini-chart/__tests__/__snapshots__/index.test.tsx.snap b/semcore/mini-chart/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..5ffc1c925c --- /dev/null +++ b/semcore/mini-chart/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,265 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`MiniCharts > Verify data-ui-name for ScoreDonut 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": null, + }, + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": "MiniChart.ScoreDonut", + }, + ], + "uiName": null, +} +`; + +exports[`MiniCharts > Verify data-ui-name for ScoreLine 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "ScoreLine.Segment", + }, + ], + "uiName": "Flex", + }, + { + "children": [], + "uiName": "Box", + }, + ], + "uiName": "MiniChart.ScoreLine", + }, + ], + "uiName": null, +} +`; + +exports[`MiniCharts > Verify data-ui-name for ScoreSemiDonut 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": null, + }, + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": "MiniChart.ScoreSemiDonut", + }, + ], + "uiName": null, +} +`; + +exports[`MiniCharts > Verify data-ui-name for TrendArea 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + { + "children": [], + "uiName": null, + }, + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": "MiniChart.TrendArea", + }, + ], + "uiName": null, +} +`; + +exports[`MiniCharts > Verify data-ui-name for TrendBar 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": null, + }, + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": "MiniChart.TrendBar", + }, + ], + "uiName": null, +} +`; + +exports[`MiniCharts > Verify data-ui-name for TrendHistogram 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": null, + }, + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": "MiniChart.TrendHistogram", + }, + ], + "uiName": null, +} +`; + +exports[`MiniCharts > Verify data-ui-name for TrendLine 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": null, + }, + ], + "uiName": "MiniChart.TrendLine", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/mini-chart/__tests__/index.test.tsx b/semcore/mini-chart/__tests__/index.test.tsx index 43de4a0113..dd9e750e00 100644 --- a/semcore/mini-chart/__tests__/index.test.tsx +++ b/semcore/mini-chart/__tests__/index.test.tsx @@ -1,6 +1,68 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; -import { describe } from '@semcore/testing-utils/vitest'; +import { cleanup, render } from '@semcore/testing-utils/testing-library'; +import { beforeEach, describe, expect, test } from '@semcore/testing-utils/vitest'; +import React from 'react'; + +import MiniCharts from '../src'; + +const expectUINameToMatchSnapshot = (component: React.ReactElement) => { + const { container } = render(component); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); +}; describe('mini-chart Dependency imports', () => { runDependencyCheckTests('mini-chart'); }); + +describe('MiniCharts', () => { + beforeEach(cleanup); + + test('Verify data-ui-name for ScoreLine', () => { + const component = ( + + + + ); + + expectUINameToMatchSnapshot(component); + }); + + test('Verify data-ui-name for ScoreDonut', () => { + const component = ; + + expectUINameToMatchSnapshot(component); + }); + + test('Verify data-ui-name for ScoreSemiDonut', () => { + const component = ; + + expectUINameToMatchSnapshot(component); + }); + + test('Verify data-ui-name for TrendLine', () => { + const component = ; + + expectUINameToMatchSnapshot(component); + }); + + test('Verify data-ui-name for TrendArea', () => { + const component = ; + + expectUINameToMatchSnapshot(component); + }); + + test('Verify data-ui-name for TrendBar', () => { + const component = ; + + expectUINameToMatchSnapshot(component); + }); + + test('Verify data-ui-name for TrendHistogram', () => { + const component = ; + + expectUINameToMatchSnapshot(component); + }); +}); diff --git a/semcore/modal/__tests__/__snapshots__/index.test.tsx.snap b/semcore/modal/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..b208d1b7b1 --- /dev/null +++ b/semcore/modal/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,50 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Modal > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + { + "children": [ + { + "children": [], + "uiName": "Modal.Title", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Button.Text", + }, + ], + "uiName": "Modal.Close.InnerWrapper", + }, + ], + "uiName": "Modal.Close", + }, + ], + "uiName": "Modal.Window", + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Modal.Overlay.ContentWrapper", + }, + ], + "uiName": "Modal.Overlay", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/modal/__tests__/index.test.tsx b/semcore/modal/__tests__/index.test.tsx index b9aaac9f3a..eaa43a0e12 100644 --- a/semcore/modal/__tests__/index.test.tsx +++ b/semcore/modal/__tests__/index.test.tsx @@ -1,3 +1,4 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { cleanup, render, queryByAttribute, userEvent } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi } from '@semcore/testing-utils/vitest'; @@ -13,6 +14,24 @@ describe('modal Dependency imports', () => { describe('Modal', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const modal = ( + + + + Modal title + Close + + + + ); + + const { container } = render(modal); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + test.sequential('Verify onClose event for Escape', async () => { const spy = vi.fn(); const { getByTestId } = render(); diff --git a/semcore/notice-bubble/__tests__/__snapshots__/index.test.tsx.snap b/semcore/notice-bubble/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..f6080f303c --- /dev/null +++ b/semcore/notice-bubble/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,103 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`NoticeBubbleContainer > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Button.Addon", + }, + ], + "uiName": "Button.InnerWrapper", + }, + ], + "uiName": "Button", + }, + { + "children": [ + { + "children": [], + "uiName": null, + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Flex", + }, + ], + "uiName": "Flex", + }, + ], + "uiName": "Animation", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Button.Addon", + }, + ], + "uiName": "Button.InnerWrapper", + }, + ], + "uiName": "Button", + }, + { + "children": [ + { + "children": [], + "uiName": null, + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Flex", + }, + ], + "uiName": "Flex", + }, + ], + "uiName": "Animation", + }, + ], + "uiName": null, + }, + ], + "uiName": "NoticeBubbleContainer", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/notice-bubble/__tests__/index.test.tsx b/semcore/notice-bubble/__tests__/index.test.tsx index 488a4c837c..c5ea4ed4e7 100644 --- a/semcore/notice-bubble/__tests__/index.test.tsx +++ b/semcore/notice-bubble/__tests__/index.test.tsx @@ -1,5 +1,7 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { + act, render, cleanup, waitFor, @@ -17,6 +19,34 @@ describe('notice-bubble Dependency imports', () => { describe('NoticeBubbleContainer', () => { beforeEach(cleanup); + test('Verify data-ui-name', async () => { + const manager = new NoticeBubbleManager(); + const { container, getByText } = render( + , + ); + + manager.add({ + type: 'warning', + children: 'Warning notice', + action: 'Warning action', + duration: 0, + initialAnimation: false, + }); + manager.add({ + type: 'info', + children: 'Info notice', + action: 'Info action', + duration: 0, + initialAnimation: false, + }); + + await waitFor(() => expect(getByText('Info notice')).toBeInTheDocument()); + + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + test('Verify supports rendering outside DOM', () => { const { queryByTestId } = render(
diff --git a/semcore/notice/__tests__/__snapshots__/index.test.tsx.snap b/semcore/notice/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..34118054b6 --- /dev/null +++ b/semcore/notice/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,117 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Notice > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Notice.Label", + }, + { + "children": [ + { + "children": [], + "uiName": "Notice.Title", + }, + { + "children": [], + "uiName": "Notice.Text", + }, + { + "children": [], + "uiName": "Notice.Actions", + }, + ], + "uiName": "Notice.Content", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Close", + }, + ], + "uiName": "Button.Addon", + }, + ], + "uiName": "Notice.Close.InnerWrapper", + }, + ], + "uiName": "Notice.Close", + }, + ], + "uiName": "Notice", + }, + ], + "uiName": null, +} +`; + +exports[`NoticeSmart > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Notice.Label", + }, + { + "children": [ + { + "children": [], + "uiName": "Notice.Title", + }, + { + "children": [], + "uiName": "Notice.Text", + }, + { + "children": [], + "uiName": "Notice.Actions", + }, + ], + "uiName": "Notice.Content", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Close", + }, + ], + "uiName": "Button.Addon", + }, + ], + "uiName": "Notice.Close.InnerWrapper", + }, + ], + "uiName": "Notice.Close", + }, + ], + "uiName": "NoticeSmart", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/notice/__tests__/index.test.tsx b/semcore/notice/__tests__/index.test.tsx index 384528e72a..a2f1373795 100644 --- a/semcore/notice/__tests__/index.test.tsx +++ b/semcore/notice/__tests__/index.test.tsx @@ -1,3 +1,4 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { render, cleanup } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi } from '@semcore/testing-utils/vitest'; @@ -12,6 +13,25 @@ describe('notice Dependency imports', () => { describe('Notice', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const notice = ( + + Label + + Title + Text + Actions + + + + ); + + const { container } = render(notice); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + test('Verify supports custom close icon', () => { const component = ( @@ -51,6 +71,17 @@ describe('Notice', () => { describe('NoticeSmart', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const noticeSmart = ( + + ); + + const { container } = render(noticeSmart); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + test('Verify renders title and text from props', () => { const { container } = render( , diff --git a/semcore/pagination/__tests__/__snapshots__/index.test.tsx.snap b/semcore/pagination/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..4490c7f710 --- /dev/null +++ b/semcore/pagination/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,99 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Pagination > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Button.Text", + }, + ], + "uiName": "Pagination.FirstPage.InnerWrapper", + }, + ], + "uiName": "Pagination.FirstPage", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Button.Text", + }, + ], + "uiName": "Pagination.PrevPage.InnerWrapper", + }, + ], + "uiName": "Pagination.PrevPage", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Button.Text", + }, + ], + "uiName": "Pagination.NextPage.InnerWrapper", + }, + ], + "uiName": "Pagination.NextPage", + }, + { + "children": [], + "uiName": "Text", + }, + { + "children": [ + { + "children": [], + "uiName": "Pagination.PageInput.Value", + }, + { + "children": [], + "uiName": "Pagination.PageInput.Addon", + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Pagination.PageInput", + }, + { + "children": [], + "uiName": "Text", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Link.Text", + }, + ], + "uiName": "Pagination.TotalPages.InnerWrapper", + }, + ], + "uiName": "Pagination.TotalPages", + }, + { + "children": [], + "uiName": "Box", + }, + ], + "uiName": "Pagination", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/pagination/__tests__/index.test.tsx b/semcore/pagination/__tests__/index.test.tsx index 9de3014fff..0a6a546fb4 100644 --- a/semcore/pagination/__tests__/index.test.tsx +++ b/semcore/pagination/__tests__/index.test.tsx @@ -1,5 +1,6 @@ import Button, { ButtonLink } from '@semcore/button'; import Return from '@semcore/icon/Return/m'; +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { render, cleanup, userEvent } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi } from '@semcore/testing-utils/vitest'; @@ -11,6 +12,30 @@ describe('pagination Dependency imports', () => { runDependencyCheckTests('pagination'); }); +describe('Pagination', () => { + beforeEach(cleanup); + + test('Verify data-ui-name', () => { + const pagination = ( + + First page + + + + + + + + + ); + + const { container } = render(pagination); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); +}); + describe('Pagination.FirstPage', () => { beforeEach(cleanup); diff --git a/semcore/pills/__tests__/__snapshots__/index.test.tsx.snap b/semcore/pills/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..c66166b7a9 --- /dev/null +++ b/semcore/pills/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,27 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`PillGroup > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Pills.Item.Addon", + }, + { + "children": [], + "uiName": "Pills.Item.Text", + }, + ], + "uiName": "Pills.Item", + }, + ], + "uiName": "Pills", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/pills/__tests__/index.test.tsx b/semcore/pills/__tests__/index.test.tsx index 59414dcbae..5181fdfd1e 100644 --- a/semcore/pills/__tests__/index.test.tsx +++ b/semcore/pills/__tests__/index.test.tsx @@ -1,4 +1,5 @@ import type { Intergalactic } from '@semcore/core'; +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { render, cleanup, userEvent } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi, assertType } from '@semcore/testing-utils/vitest'; @@ -29,6 +30,22 @@ describe('PillGroup', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const pills = ( + + + + Item + + + ); + + const { container } = render(pills); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + test.concurrent('Verify supports onChange callback', async () => { const spy = vi.fn(); const { getByTestId } = render( diff --git a/semcore/product-head/__tests__/__snapshots__/index.test.jsx.snap b/semcore/product-head/__tests__/__snapshots__/index.test.jsx.snap new file mode 100644 index 0000000000..001130f5d7 --- /dev/null +++ b/semcore/product-head/__tests__/__snapshots__/index.test.jsx.snap @@ -0,0 +1,59 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`ProductHead > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Title.Tool", + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Title", + }, + { + "children": [], + "uiName": "ProductHead.Buttons", + }, + { + "children": [], + "uiName": "ProductHead.Links", + }, + ], + "uiName": "ProductHead.Row", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Info.Item.Label", + }, + ], + "uiName": "Info.Item", + }, + ], + "uiName": "Info", + }, + ], + "uiName": "ProductHead.Row", + }, + ], + "uiName": "ProductHead", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/product-head/__tests__/index.test.jsx b/semcore/product-head/__tests__/index.test.jsx index 17157d4ddf..a75e97141b 100644 --- a/semcore/product-head/__tests__/index.test.jsx +++ b/semcore/product-head/__tests__/index.test.jsx @@ -1,6 +1,38 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; -import { describe } from '@semcore/testing-utils/vitest'; +import { render } from '@semcore/testing-utils/testing-library'; +import { describe, expect, test } from '@semcore/testing-utils/vitest'; +import React from 'react'; + +import ProductHead, { Info, Title } from '../src'; describe('product-head Dependency imports', () => { runDependencyCheckTests('product-head'); }); + +describe('ProductHead', () => { + test('Verify data-ui-name', () => { + const productHead = ( + + + Title + Buttons + Links + + + + + Label + Content + + + + + ); + + const { container } = render(productHead); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); +}); diff --git a/semcore/progress-bar/__tests__/__snapshots__/index.test.jsx.snap b/semcore/progress-bar/__tests__/__snapshots__/index.test.jsx.snap new file mode 100644 index 0000000000..a0112d48b5 --- /dev/null +++ b/semcore/progress-bar/__tests__/__snapshots__/index.test.jsx.snap @@ -0,0 +1,18 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`ProgressBar > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [], + "uiName": "ProgressBar.Value", + }, + ], + "uiName": "ProgressBar", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/progress-bar/__tests__/index.test.jsx b/semcore/progress-bar/__tests__/index.test.jsx index 2f901c1d68..ba1061b5bf 100644 --- a/semcore/progress-bar/__tests__/index.test.jsx +++ b/semcore/progress-bar/__tests__/index.test.jsx @@ -1,6 +1,26 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; -import { describe } from '@semcore/testing-utils/vitest'; +import { render } from '@semcore/testing-utils/testing-library'; +import { describe, expect, test } from '@semcore/testing-utils/vitest'; +import React from 'react'; + +import ProgressBar from '../src'; describe('progress-bar Dependency imports', () => { runDependencyCheckTests('progress-bar'); }); + +describe('ProgressBar', () => { + test('Verify data-ui-name', () => { + const progressBar = ( + + + + ); + + const { container } = render(progressBar); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); +}); diff --git a/semcore/radio/__tests__/__snapshots__/index.test.tsx.snap b/semcore/radio/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..6d26b7fa3c --- /dev/null +++ b/semcore/radio/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,31 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Radio > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Radio.Value", + }, + { + "children": [], + "uiName": "Value.RadioMark", + }, + { + "children": [], + "uiName": "Radio.Text", + }, + ], + "uiName": "Radio", + }, + ], + "uiName": "RadioGroup", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/radio/__tests__/index.test.tsx b/semcore/radio/__tests__/index.test.tsx index fe2813d923..db97db5d35 100644 --- a/semcore/radio/__tests__/index.test.tsx +++ b/semcore/radio/__tests__/index.test.tsx @@ -1,3 +1,4 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { cleanup, render, userEvent } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi } from '@semcore/testing-utils/vitest'; @@ -12,6 +13,25 @@ describe('radio Dependency imports', () => { describe('Radio', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const radio = ( + + + + + + + Label + + + ); + + const { container } = render(radio); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); + test.concurrent('Verify supports custom attributes on the input', () => { const { getByTestId } = render( diff --git a/semcore/select/__tests__/__snapshots__/index.test.tsx.snap b/semcore/select/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..037d6135ab --- /dev/null +++ b/semcore/select/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,172 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Select > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Select.Trigger.Addon", + }, + { + "children": [], + "uiName": "Select.Trigger.Text", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "ChevronDown", + }, + ], + "uiName": "ButtonTrigger.Addon", + }, + ], + "uiName": "Select.Trigger.InnerTriggerWrapper", + }, + ], + "uiName": "Select.Trigger", + }, + { + "children": [], + "uiName": null, + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Search", + }, + ], + "uiName": "Select.InputSearch.SearchIcon", + }, + { + "children": [], + "uiName": "Select.InputSearch.Value", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Close", + }, + ], + "uiName": "Link.Addon", + }, + ], + "uiName": "Select.InputSearch.Clear.InnerWrapper", + }, + ], + "uiName": "Select.InputSearch.Clear", + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Input", + }, + { + "children": [ + { + "children": [], + "uiName": "Flex", + }, + ], + "uiName": "Dropdown.Item", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Select.Option.Checkbox", + }, + { + "children": [], + "uiName": "Select.Option.Addon", + }, + { + "children": [], + "uiName": "Select.Option.Text", + }, + ], + "uiName": "Select.Option.Content", + }, + { + "children": [], + "uiName": "Select.Option.Hint", + }, + ], + "uiName": "Select.Option", + }, + ], + "uiName": "Select.Group", + }, + { + "children": [], + "uiName": "Select.Divider", + }, + { + "children": [], + "uiName": "Select.StatusItem", + }, + { + "children": [], + "uiName": "Box", + }, + ], + "uiName": null, + }, + ], + "uiName": "ScrollArea.Container", + }, + ], + "uiName": "Select.Menu", + }, + ], + "uiName": "Select.Popper", + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": null, +} +`; diff --git a/semcore/select/__tests__/index.test.tsx b/semcore/select/__tests__/index.test.tsx index afdcf57b88..cbfb3d136c 100644 --- a/semcore/select/__tests__/index.test.tsx +++ b/semcore/select/__tests__/index.test.tsx @@ -1,3 +1,4 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { cleanup, render, screen, userEvent, waitFor } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi } from '@semcore/testing-utils/vitest'; @@ -9,6 +10,45 @@ describe('select Dependency imports', () => { runDependencyCheckTests('select'); }); +describe('Select', () => { + beforeEach(cleanup); + + test('Verify data-ui-name', () => { + const select = ( + + ); + + const { container } = render(select); + const result = extractUIName(container); + + expect(result).toMatchSnapshot(); + }); +}); + describe('Select Trigger', () => { beforeEach(() => { cleanup(); diff --git a/semcore/side-panel/__tests__/__snapshots__/index.test.tsx.snap b/semcore/side-panel/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..67cb1fce74 --- /dev/null +++ b/semcore/side-panel/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,86 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`SidePanel > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "ArrowLeft", + }, + ], + "uiName": "Link.Addon", + }, + { + "children": [], + "uiName": "ButtonLink.Text", + }, + ], + "uiName": "SidePanel.Back.InnerWrapper", + }, + ], + "uiName": "SidePanel.Back", + }, + { + "children": [], + "uiName": "SidePanel.Title", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Button.Text", + }, + ], + "uiName": "SidePanel.Close.InnerWrapper", + }, + ], + "uiName": "SidePanel.Close", + }, + ], + "uiName": "SidePanel.Header", + }, + { + "children": [], + "uiName": "SidePanel.Body", + }, + { + "children": [], + "uiName": "SidePanel.Footer", + }, + ], + "uiName": "SidePanel.Panel", + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": "SidePanel.Overlay", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/side-panel/__tests__/index.test.tsx b/semcore/side-panel/__tests__/index.test.tsx index 0792c7eb62..c299eb52be 100644 --- a/semcore/side-panel/__tests__/index.test.tsx +++ b/semcore/side-panel/__tests__/index.test.tsx @@ -1,4 +1,5 @@ import { Portal } from '@semcore/base-components'; +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { render, cleanup, userEvent } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi } from '@semcore/testing-utils/vitest'; @@ -13,6 +14,27 @@ describe('side-panel Dependency imports', () => { describe('SidePanel', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const sidePanel = ( + + + + + Back + Title + Close + + Body + Footer + + + + ); + + const { container } = render(sidePanel); + expect(extractUIName(container)).toMatchSnapshot(); + }); + test('Verify visible property', () => { const component = render(Content); expect(component.queryByText('Content')).toBeNull(); diff --git a/semcore/skeleton/__tests__/__snapshots__/index.test.tsx.snap b/semcore/skeleton/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..d589cb4fbd --- /dev/null +++ b/semcore/skeleton/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,76 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Skeleton > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "SkeletonSVG.Text", + }, + { + "children": [], + "uiName": "SkeletonSVG.Text", + }, + ], + "uiName": null, + }, + ], + "uiName": null, + }, + { + "children": [], + "uiName": null, + }, + ], + "uiName": "SkeletonSVG", + }, + { + "children": [], + "uiName": "Box", + }, + { + "children": [], + "uiName": "Box", + }, + { + "children": [], + "uiName": "Box", + }, + { + "children": [], + "uiName": "Box", + }, + { + "children": [], + "uiName": "Box", + }, + { + "children": [], + "uiName": "Box", + }, + { + "children": [], + "uiName": "Box", + }, + { + "children": [], + "uiName": "Box", + }, + { + "children": [], + "uiName": "Box", + }, + { + "children": [], + "uiName": "Box", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/skeleton/__tests__/index.test.tsx b/semcore/skeleton/__tests__/index.test.tsx index abe8922952..c58dce48ab 100644 --- a/semcore/skeleton/__tests__/index.test.tsx +++ b/semcore/skeleton/__tests__/index.test.tsx @@ -1,6 +1,47 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; -import { describe } from '@semcore/testing-utils/vitest'; +import { render } from '@semcore/testing-utils/testing-library'; +import { describe, expect, test } from '@semcore/testing-utils/vitest'; +import React from 'react'; + +import SkeletonSVG, { + AreaChartSkeleton, + BarChartSkeleton, + BubbleChartSkeleton, + CompactHorizontalBarChartSkeleton, + DonutChartSkeleton, + HistogramChartSkeleton, + LineChartSkeleton, + RadialTreeChartSkeleton, + ScatterPlotChartSkeleton, + VennChartSkeleton, +} from '../src'; describe('skeleton Dependency imports', () => { runDependencyCheckTests('skeleton'); }); + +describe('Skeleton', () => { + test('Verify data-ui-name', () => { + const skeletons = ( + <> + + + + + + + + + + + + + + + ); + + const { container } = render(skeletons); + expect(extractUIName(container)).toMatchSnapshot(); + }); +}); diff --git a/semcore/slider/__tests__/__snapshots__/index.test.tsx.snap b/semcore/slider/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..17b2a9a5b5 --- /dev/null +++ b/semcore/slider/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,35 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Slider > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Slider.Bar", + }, + { + "children": [], + "uiName": "Slider.Knob", + }, + { + "children": [ + { + "children": [], + "uiName": "Slider.Item", + }, + ], + "uiName": "Slider.Options", + }, + { + "children": [], + "uiName": "Box", + }, + ], + "uiName": "Slider", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/slider/__tests__/index.test.tsx b/semcore/slider/__tests__/index.test.tsx index edfef6bd17..70a42d262e 100644 --- a/semcore/slider/__tests__/index.test.tsx +++ b/semcore/slider/__tests__/index.test.tsx @@ -1,3 +1,4 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { render, cleanup, userEvent } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi } from '@semcore/testing-utils/vitest'; @@ -12,6 +13,21 @@ describe('slider Dependency imports', () => { describe('Slider', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const slider = ( + + + + + + + + ); + + const { container } = render(slider); + expect(extractUIName(container)).toMatchSnapshot(); + }); + const focusSlider = async (slider: HTMLElement) => { await userEvent.tab(); expect(slider).toHaveFocus(); diff --git a/semcore/spin-container/__tests__/__snapshots__/index.test.tsx.snap b/semcore/spin-container/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..1b49f41f89 --- /dev/null +++ b/semcore/spin-container/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,37 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`SpinContainer > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [], + "uiName": "SpinContainer.Content", + }, + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Spin", + }, + ], + "uiName": "SpinContainer.Overlay", + }, + ], + "uiName": "FadeInOut", + }, + ], + "uiName": "SpinContainer", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/spin-container/__tests__/index.test.tsx b/semcore/spin-container/__tests__/index.test.tsx index 99c42db3e3..ed88eecc8c 100644 --- a/semcore/spin-container/__tests__/index.test.tsx +++ b/semcore/spin-container/__tests__/index.test.tsx @@ -1,6 +1,25 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; -import { describe } from '@semcore/testing-utils/vitest'; +import { render } from '@semcore/testing-utils/testing-library'; +import { describe, expect, test } from '@semcore/testing-utils/vitest'; +import React from 'react'; + +import SpinContainer from '../src'; describe('spin-container Dependency imports', () => { runDependencyCheckTests('spin-container'); }); + +describe('SpinContainer', () => { + test('Verify data-ui-name', () => { + const spinContainer = ( + + Content + + + ); + + const { container } = render(spinContainer); + expect(extractUIName(container)).toMatchSnapshot(); + }); +}); diff --git a/semcore/spin/__tests__/__snapshots__/index.test.tsx.snap b/semcore/spin/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..3c533d6bf6 --- /dev/null +++ b/semcore/spin/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,18 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Spin > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Spin", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/spin/__tests__/index.test.tsx b/semcore/spin/__tests__/index.test.tsx index 6f0c011907..23c8144ffa 100644 --- a/semcore/spin/__tests__/index.test.tsx +++ b/semcore/spin/__tests__/index.test.tsx @@ -1,6 +1,18 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; -import { describe } from '@semcore/testing-utils/vitest'; +import { render } from '@semcore/testing-utils/testing-library'; +import { describe, expect, test } from '@semcore/testing-utils/vitest'; +import React from 'react'; + +import Spin from '../src'; describe('spin Dependency imports', () => { runDependencyCheckTests('spin'); }); + +describe('Spin', () => { + test('Verify data-ui-name', () => { + const { container } = render(); + expect(extractUIName(container)).toMatchSnapshot(); + }); +}); diff --git a/semcore/switch/__tests__/__snapshots__/index.test.tsx.snap b/semcore/switch/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..373d0a5a05 --- /dev/null +++ b/semcore/switch/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,35 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Switch > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Switch.Addon", + }, + { + "children": [ + { + "children": [], + "uiName": "Switch.Value", + }, + { + "children": [], + "uiName": "Box", + }, + ], + "uiName": "Box", + }, + { + "children": [], + "uiName": "Switch.Addon", + }, + ], + "uiName": "Switch", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/switch/__tests__/index.test.tsx b/semcore/switch/__tests__/index.test.tsx index af13f2cc63..7ba9849af7 100644 --- a/semcore/switch/__tests__/index.test.tsx +++ b/semcore/switch/__tests__/index.test.tsx @@ -1,3 +1,4 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { cleanup, render, userEvent } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi } from '@semcore/testing-utils/vitest'; @@ -12,6 +13,19 @@ describe('switch Dependency imports', () => { describe('Switch', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const switchComponent = ( + + Before + + After + + ); + + const { container } = render(switchComponent); + expect(extractUIName(container)).toMatchSnapshot(); + }); + test('Verify supports onChange callback', async () => { const spy = vi.fn(); const { getByTestId } = render( diff --git a/semcore/tab-line/__tests__/__snapshots__/index.test.tsx.snap b/semcore/tab-line/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..18a7fefcdb --- /dev/null +++ b/semcore/tab-line/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,27 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`TabLine > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "TabLine.Item.Addon", + }, + { + "children": [], + "uiName": "TabLine.Item.Text", + }, + ], + "uiName": "TabLine.Item", + }, + ], + "uiName": "TabLine", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/tab-line/__tests__/index.test.tsx b/semcore/tab-line/__tests__/index.test.tsx index 0befe891c4..9436e9fca2 100644 --- a/semcore/tab-line/__tests__/index.test.tsx +++ b/semcore/tab-line/__tests__/index.test.tsx @@ -1,4 +1,5 @@ import type { Intergalactic } from '@semcore/core'; +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { render, cleanup, userEvent } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi, assertType } from '@semcore/testing-utils/vitest'; @@ -29,6 +30,20 @@ describe('TabLine', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const tabLine = ( + + + + Item + + + ); + + const { container } = render(tabLine); + expect(extractUIName(container)).toMatchSnapshot(); + }); + test('Verify supports onChange callback', async () => { const spyChange = vi.fn(); const spyClick = vi.fn(); diff --git a/semcore/tab-panel/__tests__/__snapshots__/index.test.tsx.snap b/semcore/tab-panel/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..cb949818f8 --- /dev/null +++ b/semcore/tab-panel/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,27 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`TabPanel > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "TabPanel.Item.Addon", + }, + { + "children": [], + "uiName": "TabPanel.Item.Text", + }, + ], + "uiName": "TabPanel.Item", + }, + ], + "uiName": "TabPanel", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/tab-panel/__tests__/index.test.tsx b/semcore/tab-panel/__tests__/index.test.tsx index 8e2b474110..86b9841219 100644 --- a/semcore/tab-panel/__tests__/index.test.tsx +++ b/semcore/tab-panel/__tests__/index.test.tsx @@ -1,4 +1,5 @@ import type { Intergalactic } from '@semcore/core'; +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { render, cleanup, userEvent } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi, assertType } from '@semcore/testing-utils/vitest'; @@ -29,6 +30,20 @@ describe('TabPanel', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const tabPanel = ( + + + + Item + + + ); + + const { container } = render(tabPanel); + expect(extractUIName(container)).toMatchSnapshot(); + }); + test('Verify supports onChange callback', async () => { const spyChange = vi.fn(); const spyClick = vi.fn(); diff --git a/semcore/tag/__tests__/__snapshots__/index.test.tsx.snap b/semcore/tag/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..1bee0322fa --- /dev/null +++ b/semcore/tag/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,83 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Tag > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [], + "uiName": "Tag.Circle", + }, + { + "children": [], + "uiName": "Tag.Addon", + }, + { + "children": [], + "uiName": "Tag.Text", + }, + ], + "uiName": "Tag", + }, + ], + "uiName": null, +} +`; + +exports[`TagContainer > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": "TagContainer.Circle", + }, + ], + "uiName": "Box", + }, + { + "children": [], + "uiName": "TagContainer.Addon", + }, + { + "children": [ + { + "children": [], + "uiName": "Tag.Circle", + }, + { + "children": [], + "uiName": "Tag.Addon", + }, + { + "children": [], + "uiName": "Tag.Text", + }, + ], + "uiName": "TagContainer.Tag", + }, + { + "children": [ + { + "children": [ + { + "children": [], + "uiName": null, + }, + ], + "uiName": "Close", + }, + ], + "uiName": "TagContainer.Close", + }, + ], + "uiName": "TagContainer", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/tag/__tests__/index.test.tsx b/semcore/tag/__tests__/index.test.tsx index 79a9f55c99..c075aae1cb 100644 --- a/semcore/tag/__tests__/index.test.tsx +++ b/semcore/tag/__tests__/index.test.tsx @@ -1,3 +1,4 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { render, cleanup, userEvent } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi } from '@semcore/testing-utils/vitest'; @@ -12,6 +13,19 @@ describe('tag Dependency imports', () => { describe('Tag', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const tag = ( + + + + Tag + + ); + + const { container } = render(tag); + expect(extractUIName(container)).toMatchSnapshot(); + }); + test('Verify works as Button from keyboard', async () => { const onClick = vi.fn(); const { getByTestId } = render( @@ -54,6 +68,24 @@ describe('Tag', () => { describe('TagContainer', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const tagContainer = ( + + + + + + + Tag + + + + ); + + const { container } = render(tagContainer); + expect(extractUIName(container)).toMatchSnapshot(); + }); + test.sequential('Verify calls onClick', async () => { const onClick = vi.fn(); const { getByTestId } = render( diff --git a/semcore/textarea/__tests__/__snapshots__/index.test.tsx.snap b/semcore/textarea/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..7f3eb44d91 --- /dev/null +++ b/semcore/textarea/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,13 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Textarea > Verify data-ui-name 1`] = ` +{ + "children": [ + { + "children": [], + "uiName": "Textarea", + }, + ], + "uiName": null, +} +`; diff --git a/semcore/textarea/__tests__/index.test.tsx b/semcore/textarea/__tests__/index.test.tsx index 429910dd5c..4e3c6e8840 100644 --- a/semcore/textarea/__tests__/index.test.tsx +++ b/semcore/textarea/__tests__/index.test.tsx @@ -1,3 +1,4 @@ +import { extractUIName } from '@semcore/testing-utils/shared/extractUINameTree.ts'; import { runDependencyCheckTests } from '@semcore/testing-utils/shared-tests'; import { cleanup, render, userEvent } from '@semcore/testing-utils/testing-library'; import { expect, test, describe, beforeEach, vi } from '@semcore/testing-utils/vitest'; @@ -12,6 +13,11 @@ describe('textarea Dependency imports', () => { describe('Textarea', () => { beforeEach(cleanup); + test('Verify data-ui-name', () => { + const { container } = render(