Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@viamrobotics/prime-core

Package Overview
Dependencies
Maintainers
0
Versions
167
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@viamrobotics/prime-core - npm Package Compare versions

Comparing version 0.0.139 to 0.0.140

dist/__tests__/tabs-bar-with-slots.svelte

58

dist/__tests__/tabs.spec.js

@@ -1,36 +0,30 @@

import { describe, it, expect, vi } from 'vitest';
import { render, screen, fireEvent } from '@testing-library/svelte';
import { Tabs } from '..';
import { cxTestArguments, cxTestResults } from './cx-test';
describe('Tabs', () => {
it('Renders tabs correctly', () => {
render(Tabs, { tabs: ['Tab 1', 'Tab 2', 'Tab 3'], selected: 'Tab 1' });
expect(screen.getByText('Tab 1')).toBeVisible();
expect(screen.getByText('Tab 2')).toBeVisible();
expect(screen.getByText('Tab 3')).toBeVisible();
import { describe, it, expect } from 'vitest';
import { render, screen } from '@testing-library/svelte';
import { TabsBar } from '..';
import TabsBarWithSlots from './tabs-bar-with-slots.svelte';
describe('TabsBar renders correctly', () => {
it('Renders rest props and default variant', () => {
render(TabsBar, { 'aria-label': 'Tab example one' });
expect(screen.getByRole('navigation')).toHaveAccessibleName('Tab example one');
expect(screen.getByRole('navigation')).toHaveClass('h-10 bg-medium tracking-wide sm:px-2 flex items-center font-roboto-mono');
});
it('Marks the selected tab correctly', () => {
render(Tabs, { tabs: ['Tab 1', 'Tab 2', 'Tab 3'], selected: 'Tab 1' });
expect(screen.getByRole('button', { name: 'Tab 1' })).toHaveClass('bg-white border border-x-border-2 border-t-border-2 border-b-white font-semibold');
it('Renders secondary variant', () => {
render(TabsBar, { variant: 'secondary' });
expect(screen.getByRole('navigation')).toHaveClass('flex items-center font-roboto-mono');
});
it('Switches to another tab on click', async () => {
const { component } = render(Tabs, {
tabs: ['Tab 1', 'Tab 2', 'Tab 3'],
selected: 'Tab 1',
});
const onInput = vi.fn();
component.$on('input', onInput);
await fireEvent.click(screen.getByText('Tab 2'));
expect(onInput).toHaveBeenCalledOnce();
await fireEvent.click(screen.getByText('Tab 2'));
expect(onInput).toHaveBeenCalledWith(expect.objectContaining({ detail: { value: 'Tab 2' } }));
it('Renders TabsBar with Tab components in slots', () => {
render(TabsBarWithSlots);
expect(screen.getByText('The first tab')).toBeInTheDocument();
expect(screen.getByText('The second tab')).toBeInTheDocument();
expect(screen.getByText('The third tab')).toBeInTheDocument();
const firstTab = screen.getByText('The first tab');
const secondTab = screen.getByText('The second tab');
const thirdTab = screen.getByText('The third tab');
expect(firstTab.closest('a')).toHaveAttribute('href', '#first');
expect(secondTab.closest('a')).toHaveAttribute('href', '#second');
expect(thirdTab.closest('a')).toHaveAttribute('href', '#third');
expect(firstTab).toHaveAttribute('aria-current', 'page');
expect(secondTab).toHaveAttribute('aria-current', 'false');
expect(thirdTab).toHaveAttribute('aria-current', 'false');
});
it('Renders with the passed cx classes', () => {
render(Tabs, {
tabs: ['Tab 1', 'Tab 2', 'Tab 3'],
selected: 'Tab 1',
cx: cxTestArguments,
});
expect(screen.getByText('Tab 1').parentElement?.parentElement).toHaveClass(cxTestResults);
});
});

@@ -29,3 +29,4 @@ export { default as Badge } from './badge.svelte';

export { default as TableCell } from './table/table-cell.svelte';
export { default as Tabs } from './tabs.svelte';
export { default as TabsBar } from './tabs-bar.svelte';
export { default as Tab } from './tab.svelte';
export { default as ToggleButtons } from './toggle-buttons.svelte';

@@ -32,0 +33,0 @@ export { Tooltip, TooltipContainer, TooltipTarget, TooltipText, type TooltipVisibility, } from './tooltip';

@@ -29,3 +29,4 @@ export { default as Badge } from './badge.svelte';

export { default as TableCell } from './table/table-cell.svelte';
export { default as Tabs } from './tabs.svelte';
export { default as TabsBar } from './tabs-bar.svelte';
export { default as Tab } from './tab.svelte';
export { default as ToggleButtons } from './toggle-buttons.svelte';

@@ -32,0 +33,0 @@ export { Tooltip, TooltipContainer, TooltipTarget, TooltipText, } from './tooltip';

{
"name": "@viamrobotics/prime-core",
"version": "0.0.139",
"version": "0.0.140",
"publishConfig": {

@@ -5,0 +5,0 @@ "access": "public"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc