@ncds/ui-admin 1.8.27 → 1.8.28-alpha.0

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.
@@ -22,7 +22,18 @@ export default defineConfig({
22
22
  // 'lcov' 대신 'lcovonly' — 'lcov' 는 HTML 리포트까지 생성한다.
23
23
  reporter: ['text-summary', ['lcovonly', {
24
24
  projectRoot: REPO_ROOT
25
- }]]
25
+ }]],
26
+ // 회귀 방지 하한선 — 실측에서 약 2%p 낮춘 값 (ui-admin-mcp 와 같은 여유폭).
27
+ // 실측 기준: 2026-10-12, 25cb4d96 — stmts 54.91 / branch 44.63 / funcs 55.20 / lines 55.80
28
+ // 최종 목표: 93 / 88 (lines 95 · branches 90). 테스트 보강 단계마다 실측 −2 로 인상한다.
29
+ // autoUpdate: false — 값은 실측을 확인하고 사람이 직접 올린다.
30
+ thresholds: {
31
+ autoUpdate: false,
32
+ statements: 53,
33
+ branches: 43,
34
+ functions: 53,
35
+ lines: 54
36
+ }
26
37
  }
27
38
  }
28
39
  });
@@ -16,4 +16,4 @@ type BadgeProps = {
16
16
  };
17
17
  declare const Badge: ({ label, type, color, className, leadingIcon, trailingIcon, size, }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
18
18
  export { Badge };
19
- export type { BadgeType, BadgeColor, BadgeSize, BadgeProps };
19
+ export type { BadgeColor, BadgeProps, BadgeSize, BadgeType };
@@ -7,7 +7,7 @@ import { sideSlotRender } from './utils';
7
7
  */
8
8
  const BADGE_ICON_SIZE = 12;
9
9
  /** new-badge 박스 안에 들어가는 'N' 아이콘 크기. 박스는 sm 16px / md 20px 이며 아이콘은 그보다 작다(패딩 포함). */
10
- const NEW_BADGE_ICON_SIZE = { sm: 12, md: 16 };
10
+ const NEW_BADGE_ICON_SIZE = { sm: 12, md: 14 };
11
11
  const Badge = ({ label, type = 'pill-outline', color = 'neutral', className, leadingIcon, trailingIcon, size = 'xs', }) => {
12
12
  // new-badge: 신규 콘텐츠 'N' 마크 전용 타입. label·color·leadingIcon·trailingIcon은 무시되고
13
13
  // 색은 --pink-600 으로 고정된다. (디자이너 명세: Icon/FeaturedIcon/Badge로 대체 불가한 전용 표시)
@@ -0,0 +1,94 @@
1
+ import path from 'node:path';
2
+ import { compile as compileSass } from 'sass';
3
+ import { describe, expect, it } from 'vitest';
4
+ // 배경·그림자·패딩은 jsdom 에서 계산되지 않으므로, 컴파일된 CSS 에서 variant 별 규칙을 검사한다.
5
+ // (input-base/__tests__/inputAutofill.test.ts 와 같은 방식 — 컴포넌트 SCSS 엔트리를 직접 컴파일)
6
+ const PAGE_TITLE_SCSS_PATH = path.resolve(__dirname, '../../../../../assets/styles/components/page-title/_index.scss');
7
+ const compiledPageTitleCss = compileSass(PAGE_TITLE_SCSS_PATH).css;
8
+ /** 선택자 → 선언 목록. 같은 선택자가 여러 규칙에 나오면 선언을 이어 붙인다. */
9
+ const parseRules = (css) => {
10
+ const rules = new Map();
11
+ for (const [, selectorList, body] of css.matchAll(/([^{}]+)\{([^{}]*)\}/g)) {
12
+ const declarations = body
13
+ .split(';')
14
+ .map((declaration) => declaration.trim().replace(/\s+/g, ' '))
15
+ .filter(Boolean);
16
+ for (const selector of selectorList.split(',').map((selector) => selector.trim().replace(/\s+/g, ' '))) {
17
+ rules.set(selector, [...(rules.get(selector) ?? []), ...declarations]);
18
+ }
19
+ }
20
+ return rules;
21
+ };
22
+ const rules = parseRules(compiledPageTitleCss);
23
+ const declarationsOf = (selector) => rules.get(selector) ?? [];
24
+ const propertiesOf = (selector) => declarationsOf(selector).map((declaration) => declaration.split(':')[0].trim());
25
+ const ROOT = '.ncua-page-title';
26
+ const FIXED = '.ncua-page-title--fixed';
27
+ const PAGE_HEADER = '.ncua-page-title__page-header';
28
+ const FIXED_PAGE_HEADER = '.ncua-page-title--fixed .ncua-page-title__page-header';
29
+ describe('PageTitle 스타일 — Default (·Detail)', () => {
30
+ it('.ncua-page-title 에 background·box-shadow 가 없다 (투명, 그림자 없음)', () => {
31
+ // Given: 컴파일된 PageTitle CSS 에서
32
+ // When: 루트 규칙의 속성을 모으면
33
+ const properties = propertiesOf(ROOT);
34
+ // Then: 루트 규칙은 존재하지만 배경·그림자를 지정하지 않는다
35
+ expect(properties.length).toBeGreaterThan(0);
36
+ expect(properties).not.toContain('background');
37
+ expect(properties).not.toContain('background-color');
38
+ expect(properties).not.toContain('box-shadow');
39
+ });
40
+ it('.ncua-page-title__page-header 패딩은 32px 40px 0 이다', () => {
41
+ // Given: 컴파일된 PageTitle CSS 에서
42
+ // When: page-header 규칙을 찾으면
43
+ const declarations = declarationsOf(PAGE_HEADER);
44
+ // Then: 위 32px · 좌우 40px · 아래 0 이다
45
+ expect(declarations).toContain('padding: 32px 40px 0');
46
+ expect(declarations).not.toContain('padding: 24px 40px');
47
+ });
48
+ });
49
+ describe('PageTitle 스타일 — Fixed (·Fixed Detail)', () => {
50
+ it('.ncua-page-title--fixed 배경은 --gray-50 이다', () => {
51
+ // Given: 컴파일된 PageTitle CSS 에서
52
+ // When: fixed modifier 규칙을 찾으면
53
+ const declarations = declarationsOf(FIXED);
54
+ // Then: sticky 로 콘텐츠 위에 겹치므로 배경 Gray/50 을 가진다
55
+ expect(declarations).toContain('background: var(--gray-50)');
56
+ });
57
+ it('.ncua-page-title--fixed 하단 border 는 1px solid --gray-100 이다', () => {
58
+ // Given/When: fixed modifier 규칙을 찾으면
59
+ const declarations = declarationsOf(FIXED);
60
+ // Then: 기존 Gray/300 이 아니라 Gray/100 border 를 쓴다
61
+ expect(declarations).toContain('border-bottom: 1px solid var(--gray-100)');
62
+ expect(declarations).not.toContain('border-bottom: 1px solid var(--gray-300)');
63
+ });
64
+ it('.ncua-page-title--fixed 에 box-shadow 가 없다', () => {
65
+ // Given/When: fixed modifier 규칙의 속성을 모으면
66
+ // Then: 그림자를 지정하지 않는다
67
+ expect(propertiesOf(FIXED)).not.toContain('box-shadow');
68
+ });
69
+ it('Fixed 의 page-header 패딩은 12px 40px 로 유지된다', () => {
70
+ // Given/When: fixed 하위 page-header 규칙을 찾으면
71
+ // Then: 기존 Fixed 패딩이 그대로다 (범위 밖)
72
+ expect(declarationsOf(FIXED_PAGE_HEADER)).toContain('padding: 12px 40px');
73
+ });
74
+ it('Fixed sticky 동작(position·top·z-index)은 유지된다', () => {
75
+ // Given/When: fixed modifier 규칙을 찾으면
76
+ const declarations = declarationsOf(FIXED);
77
+ // Then: 기존 sticky 선언이 그대로다
78
+ expect(declarations).toContain('position: sticky');
79
+ expect(declarations).toContain('top: 0');
80
+ expect(declarations).toContain('z-index: 999');
81
+ });
82
+ });
83
+ describe('PageTitle 스타일 — 토큰 사용', () => {
84
+ it('배경·border 색상에 하드코딩 값 없이 CSS 변수만 쓴다 (ADR-4)', () => {
85
+ // Given/When: 루트·fixed 규칙의 배경·border 선언을 모으면
86
+ const colorDeclarations = [...declarationsOf(ROOT), ...declarationsOf(FIXED)].filter((declaration) => /^(background|border-bottom)/.test(declaration));
87
+ // Then: hex·rgb·색 이름 대신 var(--*) 만 쓴다
88
+ expect(colorDeclarations.length).toBeGreaterThan(0);
89
+ for (const declaration of colorDeclarations) {
90
+ expect(declaration).not.toMatch(/#[0-9a-f]{3,8}\b|rgba?\(|(?<![-\w])white\b/i);
91
+ expect(declaration).toMatch(/var\(--[a-z0-9-]+\)/);
92
+ }
93
+ });
94
+ });