Skip to content

Commit

Permalink
feat(@vtmn/svelte): add property for ol attributes VtmnBreadcrumb (
Browse files Browse the repository at this point in the history
  • Loading branch information
Tlahey committed Feb 12, 2024
1 parent 288b2c4 commit 97f3245
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@
*/
export let className = undefined;
/**
* Properties applied on the `ol` node
* @type {object}
*/
export let orderedListAttributes = {};
$: componentClass = cn('vtmn-breadcrumb', className);
</script>

<nav class={componentClass} {...$$restProps}>
<ol>
<ol {...orderedListAttributes}>
<slot />
</ol>
</nav>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ describe('VtmnBreadcrumbWithSlot', () => {
expect(container.querySelector('ol').children.length).toEqual(3);
});

test('Should apply property on the ol node', () => {
const { getByTestId } = render(VtmnBreadcrumbWithSlot, {
orderedListAttributes: {
'data-testid': 'foo',
},
});
expect(getByTestId('foo')).toBeVisible();
});

test('Should apply a custom class on the breadcrumb', () => {
const { container } = render(VtmnBreadcrumbWithSlot, {
class: 'custom-class',
Expand Down

0 comments on commit 97f3245

Please sign in to comment.