-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add VIcon vitest file(#20517)
- Loading branch information
1 parent
89c58dd
commit 2cdef0f
Showing
2 changed files
with
59 additions
and
126 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
packages/vuetify/src/components/VIcon/__tests__/VIcon.spec.browser.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { VIcon } from '../VIcon' | ||
|
||
// Utilities | ||
import { render, screen } from '@test' | ||
|
||
describe('VIcon', () => { | ||
describe('icon prop', () => { | ||
it('should render icon from default set', () => { | ||
render(() => <VIcon icon="mdi-home" />) | ||
|
||
const icon = screen.getByText('', { selector: '.mdi-home' }) | ||
expect(icon).toHaveClass('mdi-home') | ||
expect(icon).toHaveClass('mdi') | ||
}) | ||
}) | ||
|
||
describe('default slot', () => { | ||
it('should render icon from default set', () => { | ||
render(() => <VIcon>mdi-home</VIcon>) | ||
|
||
const icon = screen.getByText('', { selector: '.mdi-home' }) | ||
expect(icon).toHaveClass('mdi-home') | ||
expect(icon).toHaveClass('mdi') | ||
}) | ||
|
||
it('should render default slot if no icon value is found', () => { | ||
const Foo = () => ( | ||
<svg style="width: 100%; height: 100%;" class="foo"> | ||
<path d="M7,10L12,15L17,10H7Z" /> | ||
</svg> | ||
) | ||
|
||
render(() => ( | ||
<VIcon> | ||
<Foo /> | ||
</VIcon> | ||
)) | ||
|
||
const svg = screen.getByText('', { selector: '.foo' }) | ||
expect(svg).toBeInTheDocument() | ||
}) | ||
}) | ||
|
||
it('should render svg icon', () => { | ||
render(() => <VIcon icon="svg:M7,10L12,15L17,10H7Z" />) | ||
|
||
const svg = screen.getByText('', { selector: 'svg' }) | ||
expect(svg).toBeInTheDocument() | ||
const path = svg.querySelector('path') | ||
expect(path).toHaveAttribute('d', 'M7,10L12,15L17,10H7Z') | ||
}) | ||
|
||
it('should render class icon', () => { | ||
render(() => <VIcon icon="class:foo" />) | ||
|
||
const icon = screen.getByText('', { selector: '.foo' }) | ||
expect(icon).toHaveClass('foo') | ||
}) | ||
}) |
126 changes: 0 additions & 126 deletions
126
packages/vuetify/src/components/VIcon/__tests__/VIcon.spec.cy.tsx
This file was deleted.
Oops, something went wrong.