Skip to content

Commit 3149b13

Browse files
petrapazkresimir-coko
authored andcommitted
3610 - fix test imports
1 parent 9ef43cf commit 3149b13

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

client/src/components/Switch/Switch.test.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
/// <reference types="@testing-library/jest-dom" />
21
import {render, screen} from '@testing-library/react';
3-
import React from 'react';
42
import {describe, expect, it, vi} from 'vitest';
53

64
import Switch from './Switch';
@@ -64,9 +62,7 @@ describe('Switch - Variants', () => {
6462
render(<Switch checked={false} variant="default" />);
6563

6664
const switchElement = screen.getByRole('switch');
67-
// Check for arbitrary variant classes that style the thumb
68-
expect(switchElement.className).toMatch(/\[&>span\]:h-4/);
69-
expect(switchElement.className).toMatch(/\[&>span\]:w-4/);
65+
expect(switchElement).toHaveClass('[&>span]:size-4');
7066
});
7167

7268
it('should render small variant with correct track dimensions', () => {
@@ -84,9 +80,7 @@ describe('Switch - Variants', () => {
8480
render(<Switch checked={false} variant="small" />);
8581

8682
const switchElement = screen.getByRole('switch');
87-
// Check for arbitrary variant classes for small thumb
88-
expect(switchElement.className).toMatch(/\[&>span\]:h-3/);
89-
expect(switchElement.className).toMatch(/\[&>span\]:w-3/);
83+
expect(switchElement).toHaveClass('[&>span]:size-3');
9084
});
9185

9286
it('should render box variant with correct track dimensions', () => {
@@ -260,7 +254,6 @@ describe('Switch - Focus', () => {
260254
render(<Switch checked={false} />);
261255

262256
const switchElement = screen.getByRole('switch');
263-
expect(switchElement).toHaveClass('focus-visible:outline-none');
264257
expect(switchElement).toHaveClass('focus-visible:ring-2');
265258
expect(switchElement).toHaveClass('focus-visible:ring-stroke-brand-focus');
266259
expect(switchElement).toHaveClass('focus-visible:ring-offset-0');

0 commit comments

Comments
 (0)