Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.editor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.editor
Commits
27485df4
Commit
27485df4
authored
6 years ago
by
Jaden DIEFENBAUGH
Browse files
Options
Downloads
Patches
Plain Diff
[js] add basic test for ParameterCreate
parent
72608a5c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!29
Fix issues for plotter editor and added unit tests
,
!23
Fix issues plotter editor
Pipeline
#24221
failed
6 years ago
Stage: build
Stage: browser-tests
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
conda/js/src/components/ParameterCreate.spec.jsx
+69
-0
69 additions, 0 deletions
conda/js/src/components/ParameterCreate.spec.jsx
with
69 additions
and
0 deletions
conda/js/src/components/ParameterCreate.spec.jsx
0 → 100644
+
69
−
0
View file @
27485df4
// @flow
import
React
from
'
react
'
;
import
{
expect
}
from
'
chai
'
;
import
{
mount
}
from
'
enzyme
'
;
import
sinon
from
'
sinon
'
;
import
{
spies
}
from
'
@test
'
;
import
C
from
'
./ParameterCreate.jsx
'
;
describe
.
only
(
'
<ParameterCreate />
'
,
()
=>
{
let
wrapper
;
const
name
=
'
parameter
'
;
// shortcut for a func to update just the parameter obj, not the name
const
_updateParameter
=
(
name
,
p
,
oldName
)
=>
{
wrapper
.
setProps
({
param
:
p
,
});
};
const
params
=
[];
afterEach
(()
=>
{
if
(
wrapper
&&
wrapper
.
unmount
)
wrapper
.
unmount
();
});
it
(
`saves the default value of a boolean parameter`
,
()
=>
{
let
param
=
{
type
:
''
,
default
:
''
,
description
:
''
,
};
const
updateParameter
=
sinon
.
spy
(
_updateParameter
);
wrapper
=
mount
(
<
C
name
=
{
name
}
param
=
{
param
}
params
=
{
params
}
updateParameter
=
{
updateParameter
}
/>
);
// sanity checks
expect
(
wrapper
.
find
(
'
TypedField
'
)).
to
.
have
.
prop
(
'
name
'
,
name
);
wrapper
.
find
(
'
Input.custom-select
'
).
prop
(
'
onChange
'
)(
{
target
:
{
value
:
'
bool
'
}});
wrapper
.
update
();
console
.
log
(
wrapper
.
props
().
param
);
expect
(
wrapper
.
props
().
param
).
to
.
deep
.
equal
(
{
type
:
'
bool
'
,
default
:
''
,
description
:
''
,
}
);
// wrapper.find('input[type="radio"]').at(0).simulate('change', { target: { checked: 'true' }});;
wrapper
.
find
(
'
input[type="radio"]
'
).
at
(
0
).
simulate
(
'
change
'
,
{
target
:
{
value
:
'
true
'
}});;
wrapper
.
update
();
expect
(
updateParameter
.
args
[
0
]).
to
.
deep
.
equal
([
name
,
{
type
:
'
bool
'
,
default
:
'
true
'
,
description
:
''
,
}
]);
});
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment