@loword/loword-design-system 0.7.8 → 0.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/dist/components/LDTable/TableRowDnd.test.d.ts +0 -2
- package/dist/components/LDTable/TableRowDnd.test.d.ts.map +0 -1
- package/dist/components/LDTable/TableRowDnd.test.js +0 -29
- package/dist/components/RenderIcon/RenderIcon.test.d.ts +0 -2
- package/dist/components/RenderIcon/RenderIcon.test.d.ts.map +0 -1
- package/dist/components/RenderIcon/RenderIcon.test.js +0 -38
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TableRowDnd.test.d.ts","sourceRoot":"","sources":["../../../src/components/LDTable/TableRowDnd.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { act } from 'react';
|
|
3
|
-
import { hydrateRoot } from 'react-dom/client';
|
|
4
|
-
import { renderToString } from 'react-dom/server';
|
|
5
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
6
|
-
import { LDRowDragHandle, RowDndProvider, RowSortableProvider, SortableRow, } from '../../components/LDTable/TableRowDnd.js';
|
|
7
|
-
const ROW_IDS = ['a', 'b'];
|
|
8
|
-
const DraggableRows = () => (_jsx(RowDndProvider, { onRowDragEnd: () => { }, children: _jsx(RowSortableProvider, { rowIds: ROW_IDS, children: _jsx("table", { children: _jsx("tbody", { children: ROW_IDS.map((id) => (_jsx(SortableRow, { rowId: id, children: _jsx("td", { children: _jsx(LDRowDragHandle, {}) }) }, id))) }) }) }) }));
|
|
9
|
-
describe('<RowDndProvider />', () => {
|
|
10
|
-
it('SSR 마크업을 하이드레이션해도 드래그 핸들 aria-describedby 가 어긋나지 않는다', async () => {
|
|
11
|
-
const container = document.createElement('div');
|
|
12
|
-
container.innerHTML = renderToString(_jsx(DraggableRows, {}));
|
|
13
|
-
document.body.append(container);
|
|
14
|
-
const reactGlobal = globalThis;
|
|
15
|
-
reactGlobal.IS_REACT_ACT_ENVIRONMENT = true;
|
|
16
|
-
// 속성 불일치는 onRecoverableError 가 아니라 console.error 로만 알린다.
|
|
17
|
-
const consoleError = vi
|
|
18
|
-
.spyOn(console, 'error')
|
|
19
|
-
.mockImplementation(() => { });
|
|
20
|
-
const root = await act(async () => hydrateRoot(container, _jsx(DraggableRows, {})));
|
|
21
|
-
expect(consoleError).not.toHaveBeenCalled();
|
|
22
|
-
consoleError.mockRestore();
|
|
23
|
-
expect(container
|
|
24
|
-
.querySelector('button[aria-label="순서 변경"]')
|
|
25
|
-
?.getAttribute('aria-describedby')).toBeTruthy();
|
|
26
|
-
act(() => root.unmount());
|
|
27
|
-
container.remove();
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RenderIcon.test.d.ts","sourceRoot":"","sources":["../../../src/components/RenderIcon/RenderIcon.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { renderToStaticMarkup } from 'react-dom/server';
|
|
3
|
-
import { describe, expect, it } from 'vitest';
|
|
4
|
-
import RenderIcon from '../../components/RenderIcon/RenderIcon.js';
|
|
5
|
-
describe('<RenderIcon />', () => {
|
|
6
|
-
it('children 이 null/undefined/false 면 아무것도 렌더하지 않는다', () => {
|
|
7
|
-
expect(renderToStaticMarkup(_jsx(RenderIcon, { children: null }))).toBe('');
|
|
8
|
-
expect(renderToStaticMarkup(_jsx(RenderIcon, { children: undefined }))).toBe('');
|
|
9
|
-
expect(renderToStaticMarkup(_jsx(RenderIcon, { children: false }))).toBe('');
|
|
10
|
-
});
|
|
11
|
-
it('className 을 안 주면 기본 프리셋(size-[1em] shrink-0 ld-transition)만 붙는다', () => {
|
|
12
|
-
const markup = renderToStaticMarkup(_jsx(RenderIcon, { children: _jsx("span", { children: "x" }) }));
|
|
13
|
-
expect(markup).toBe('<span class="size-[1em] shrink-0 ld-transition">x</span>');
|
|
14
|
-
});
|
|
15
|
-
it('전달 className 이 기본 사이즈를 이긴다 (기존 className 없음)', () => {
|
|
16
|
-
const markup = renderToStaticMarkup(_jsx(RenderIcon, { className: "size-4", children: _jsx("span", { children: "x" }) }));
|
|
17
|
-
expect(markup).toBe('<span class="shrink-0 ld-transition size-4">x</span>');
|
|
18
|
-
});
|
|
19
|
-
it('아이콘 자신의 className 이 전달 className 을 이긴다', () => {
|
|
20
|
-
const markup = renderToStaticMarkup(_jsx(RenderIcon, { className: "size-4", children: _jsx("span", { className: "size-6 text-red500", children: "x" }) }));
|
|
21
|
-
expect(markup).toBe('<span class="shrink-0 ld-transition size-6 text-red500">x</span>');
|
|
22
|
-
});
|
|
23
|
-
it('Fragment·중첩 Fragment·배열을 전부 평탄화해 각 아이콘에 className 이 붙는다', () => {
|
|
24
|
-
const markup = renderToStaticMarkup(_jsxs(RenderIcon, { className: "size-4", children: [_jsxs(_Fragment, { children: [_jsx("span", { className: "italic", children: "1" }), _jsx(_Fragment, { children: _jsx("span", { className: "underline", children: "2" }) })] }), [
|
|
25
|
-
_jsx("span", { className: "uppercase", children: "3" }, "3"),
|
|
26
|
-
], _jsx("span", { className: "lowercase", children: "4" })] }));
|
|
27
|
-
expect(markup).toBe('<span class="shrink-0 ld-transition size-4 italic">1</span>' +
|
|
28
|
-
'<span class="shrink-0 ld-transition size-4 underline">2</span>' +
|
|
29
|
-
'<span class="shrink-0 ld-transition size-4 uppercase">3</span>' +
|
|
30
|
-
'<span class="shrink-0 ld-transition size-4 lowercase">4</span>');
|
|
31
|
-
});
|
|
32
|
-
it('문자열·숫자 노드는 className 없이 그대로 렌더된다', () => {
|
|
33
|
-
expect(renderToStaticMarkup(_jsx(RenderIcon, { children: "\uC544\uC774\uCF58" }))).toBe('아이콘');
|
|
34
|
-
expect(renderToStaticMarkup(_jsx(RenderIcon, { children: 3 }))).toBe('3');
|
|
35
|
-
expect(renderToStaticMarkup(_jsx(RenderIcon, { children: 0 }))).toBe('0');
|
|
36
|
-
expect(renderToStaticMarkup(_jsx(RenderIcon, { children: '' }))).toBe('');
|
|
37
|
-
});
|
|
38
|
-
});
|