Submit
Path:
~
/
/
usr
/
share
/
grafana
/
public
/
app
/
core
/
components
/
PasswordField
/
File Content:
PasswordField.test.tsx
import { fireEvent, render, screen } from '@testing-library/react'; import React from 'react'; import { Field } from '@grafana/ui'; import { PasswordField } from './PasswordField'; describe('PasswordField', () => { it('should render correctly', () => { render( <Field label="Password"> <PasswordField id="password" /> </Field> ); expect(screen.getByLabelText('Password')).toBeInTheDocument(); expect(screen.getByRole('switch', { name: 'Show password' })).toBeInTheDocument(); }); it('should able to show password value if clicked on password-reveal icon', () => { render( <Field label="Password"> <PasswordField id="password" /> </Field> ); expect(screen.getByLabelText('Password')).toHaveProperty('type', 'password'); fireEvent.click(screen.getByRole('switch', { name: 'Show password' })); expect(screen.getByLabelText('Password')).toHaveProperty('type', 'text'); }); });
Edit
Rename
Chmod
Delete
FILE
FOLDER
INFO
Name
Size
Permission
Action
PasswordField.test.tsx
963 bytes
0644
PasswordField.tsx
996 bytes
0644
N4ST4R_ID | Naxtarrr