Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paragon
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
paragon
Commits
eaa10656
Commit
eaa10656
authored
Jul 05, 2017
by
Ari Rizzitano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test some utils
parent
25ab5286
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
2 deletions
+20
-2
src/asInput/asInput.test.jsx
+9
-1
src/asInput/index.jsx
+2
-1
src/utils/utils.test.js
+9
-0
No files found.
src/asInput/asInput.test.jsx
View file @
eaa10656
...
...
@@ -3,7 +3,7 @@
import
React
from
'react'
;
import
{
mount
}
from
'enzyme'
;
import
asInput
from
'./index'
;
import
asInput
,
{
getDisplayName
}
from
'./index'
;
function
testComponent
(
props
)
{
return
(
...
...
@@ -23,6 +23,14 @@ const baseProps = {
description
:
'i am a test component'
,
};
describe
(
'getDisplayName'
,
()
=>
{
it
(
'returns the proper display name'
,
()
=>
{
expect
(
getDisplayName
({
displayName
:
'foo'
})).
toEqual
(
'foo'
);
expect
(
getDisplayName
({
name
:
'bar'
})).
toEqual
(
'bar'
);
expect
(
getDisplayName
({})).
toEqual
(
'Component'
);
});
});
describe
(
'asInput()'
,
()
=>
{
it
(
'renders'
,
()
=>
{
const
props
=
{
...
...
src/asInput/index.jsx
View file @
eaa10656
...
...
@@ -5,7 +5,8 @@ import { FormGroup, FormFeedback, FormText } from 'reactstrap';
import
newId
from
'../utils/newId'
;
const
getDisplayName
=
WrappedComponent
=>
WrappedComponent
.
displayName
||
WrappedComponent
.
name
||
'Component'
;
export
const
getDisplayName
=
WrappedComponent
=>
WrappedComponent
.
displayName
||
WrappedComponent
.
name
||
'Component'
;
export
const
inputProps
=
{
label
:
PropTypes
.
string
.
isRequired
,
...
...
src/utils/utils.test.js
0 → 100644
View file @
eaa10656
import
newId
from
'./newId'
;
describe
(
'newId'
,
()
=>
{
it
(
'increments on each call'
,
()
=>
{
expect
(
newId
()).
toEqual
(
'id1'
);
expect
(
newId
(
'foo-'
)).
toEqual
(
'foo-2'
);
expect
(
newId
(
'bar-'
)).
toEqual
(
'bar-3'
);
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment