This repository was archived by the owner on Mar 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.test.js
More file actions
74 lines (61 loc) · 1.77 KB
/
index.test.js
File metadata and controls
74 lines (61 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* @flow */
/*
import React from 'react';
import { shallow } from 'enzyme';
import PasswordInput from './';
import type { InputProps } from '../types';
describe('<PasswordInput />', () => {
let wrapper;
const defaultProps = {
name: 'INPUT_NAME',
id: 'INPUT_ID',
};
const shallowWithProps = (props: InputProps) => {
wrapper = shallow(
<PasswordInput {...props} />
);
};
describe('html element', () => {
describe('just name and inputId', () => {
beforeEach(() => {
shallowWithProps(defaultProps);
});
it('should be input', () => {
expect(wrapper.name()).toBe('input');
});
it('should have [type=password]', () => {
expect(wrapper.props().type).toEqual('password');
});
it('should have [name=INPUT_NAME]', () => {
expect(wrapper.props().name).toEqual('INPUT_NAME');
});
it('should have default .textfield class', () => {
expect(wrapper.hasClass('textfield')).toBe(true);
});
it('should not have [placeholder]', () => {
expect(wrapper.props.placeholder).not.toBeDefined();
});
it('should not have [placeholder]', () => {
expect(wrapper.props.placeholder).not.toBeDefined();
});
});
});
describe('more params', () => {
it('should use className from props', () => {
shallowWithProps({
...defaultProps,
className: 'CSS_CLASS',
});
expect(wrapper.hasClass('CSS_CLASS')).toBe(true);
expect(wrapper.hasClass('textfield')).toBe(false);
});
it('should use placeholder from props', () => {
shallowWithProps({
...defaultProps,
placeholder: 'PLACEHOLDER',
});
expect(wrapper.props().placeholder).toEqual('PLACEHOLDER');
});
});
});
*/