Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: removed tooltip.time #110

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions apps/docs/src/stories/Tooltip/Hover.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,17 @@ const meta: Meta<TooltipHoverProps> = {
},
type: { name: 'boolean', required: false },
},
closeTime: {
control: 'number',
description: 'Define o tempo em milissegundos para fechar o conteúdo do Tooltip.',
table: {
type: { summary: 'number' },
},
type: { name: 'number', required: false },
},
delayDuration: {
control: 'number',
description:
'Define o tempo de delay em milissegundos para exibir o conteúdo do Tooltip.',
description: 'Define o tempo de delay em milissegundos para exibir o conteúdo do Tooltip.',
table: {
type: { summary: 'number' },
defaultValue: { summary: '300' },
Expand All @@ -53,8 +60,7 @@ const meta: Meta<TooltipHoverProps> = {
},
side: {
control: { type: 'inline-radio' },
description:
'Define o local em que o componente irá aparecer, relativo ao trigger.',
description: 'Define o local em que o componente irá aparecer, relativo ao trigger.',
options: ['bottom', 'left', 'right', 'top'],
table: {
type: {
Expand All @@ -80,8 +86,7 @@ const meta: Meta<TooltipHoverProps> = {
text: {
control: 'none',
name: 'text (deprecated)',
description:
'<s>Define o valor em texto do componente.</s> (deprecated) - Use a propriedade `content`.',
description: '<s>Define o valor em texto do componente.</s> (deprecated) - Use a propriedade `content`.',
table: {
type: { summary: 'text' },
},
Expand Down
140 changes: 0 additions & 140 deletions apps/docs/src/stories/Tooltip/Time.stories.tsx

This file was deleted.

22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.1",
"eslint": "^8.33.0",
"eslint-config-next": "^13.4.7",
"eslint-config-next": "^13.4.19",
"eslint-config-prettier": "^8.8.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.27.5",
Expand All @@ -39,9 +39,9 @@
"eslint-plugin-unused-imports": "^3.0.0",
"glob": "^7.2.3",
"husky": "^8.0.3",
"lint-staged": "^13.1.0",
"lint-staged": "^13.1.4",
"phosphor-react": "latest",
"prettier": "2.8.3",
"prettier": "2.8.8",
"prettier-plugin-tailwindcss": "^0.4.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
5 changes: 2 additions & 3 deletions packages/visu/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ function App() {
<LayoutDefault asChild terminal={[watch(), test]} buttons={[{ icon: <Eraser />, onClick: clearState }]}>
<form onSubmit={handleSubmit(onSubmit)}>
{/* ================================= TEST AREA ================================= */}
<Tooltip.Time content="Copiado!" closeTime={2000} side="top">
<Tooltip.Hover content="Copiado!" closeTime={1000} side="top">
<span>Time</span>
</Tooltip.Time>

</Tooltip.Hover>
{/* ================================= TEST AREA ================================= */}
</form>
</LayoutDefault>
Expand Down
20 changes: 20 additions & 0 deletions packages/visu/src/__tests__/Tooltip/Hover.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,24 @@ describe('TooltipHover tests', () => {
expect(screen.getByRole('tooltip')).toHaveTextContent('Text1')
})
})

it('Should close the tooltip after the specified closeTime', async () => {
const closeTime = 2500

render(
<Tooltip.Hover content="Text" closeTime={closeTime}>
<div data-testid="element">Hello</div>
</Tooltip.Hover>,
)

const element = screen.getByTestId('element')
fireEvent.click(element)

await waitFor(() => {
expect(screen.getByRole('tooltip')).toContainHTML('Text')
setTimeout(() => {
expect(screen.queryByRole('tooltip')).toBeNull()
}, closeTime + 100)
})
})
})
Loading