mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 11:11:53 +08:00
25 lines
1.0 KiB
TypeScript
25 lines
1.0 KiB
TypeScript
import { defaultTitleSlot } from './Title';
|
|
|
|
describe('defaultTitleSlot', () => {
|
|
it('showRoots', () => {
|
|
const parameters = {
|
|
options: { showRoots: true },
|
|
};
|
|
expect(defaultTitleSlot({ selectedKind: 'a/b/c', parameters })).toBe('c');
|
|
expect(defaultTitleSlot({ selectedKind: 'a|b', parameters })).toBe('a|b');
|
|
expect(defaultTitleSlot({ selectedKind: 'a/b/c.d', parameters })).toBe('c.d');
|
|
});
|
|
it('no showRoots', () => {
|
|
const parameters = {};
|
|
expect(defaultTitleSlot({ selectedKind: 'a/b/c', parameters })).toBe('c');
|
|
expect(defaultTitleSlot({ selectedKind: 'a|b', parameters })).toBe('b');
|
|
expect(defaultTitleSlot({ selectedKind: 'a/b/c.d', parameters })).toBe('d');
|
|
});
|
|
it('empty options', () => {
|
|
const parameters = { options: {} };
|
|
expect(defaultTitleSlot({ selectedKind: 'a/b/c', parameters })).toBe('c');
|
|
expect(defaultTitleSlot({ selectedKind: 'a|b', parameters })).toBe('b');
|
|
expect(defaultTitleSlot({ selectedKind: 'a/b/c.d', parameters })).toBe('d');
|
|
});
|
|
});
|