mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
feat(site): generated multipart component api reference (#468)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { kebabToPascal, sortProps } from '../utils.js';
|
||||
import { kebabToPascal, partKebabFromSource, sortProps } from '../utils.js';
|
||||
|
||||
describe('kebabToPascal', () => {
|
||||
it("converts 'play-button' to 'PlayButton'", () => {
|
||||
@@ -15,6 +15,24 @@ describe('kebabToPascal', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('partKebabFromSource', () => {
|
||||
it("derives 'value' from './time-value' with component 'time'", () => {
|
||||
expect(partKebabFromSource('./time-value', 'time')).toBe('value');
|
||||
});
|
||||
|
||||
it("derives 'group' from './time-group' with component 'time'", () => {
|
||||
expect(partKebabFromSource('./time-group', 'time')).toBe('group');
|
||||
});
|
||||
|
||||
it("derives 'separator' from './time-separator' with component 'time'", () => {
|
||||
expect(partKebabFromSource('./time-separator', 'time')).toBe('separator');
|
||||
});
|
||||
|
||||
it("handles multi-segment component names like 'play-button'", () => {
|
||||
expect(partKebabFromSource('./play-button-icon', 'play-button')).toBe('icon');
|
||||
});
|
||||
});
|
||||
|
||||
describe('sortProps', () => {
|
||||
it('sorts required props before optional props', () => {
|
||||
const props = {
|
||||
|
||||
Reference in New Issue
Block a user