Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
editoria
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yannis Barlas
editoria
Commits
1b455824
Commit
1b455824
authored
8 years ago
by
Alexandros Georgantas
Committed by
john
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Added render test for the Chapter
parent
16c5a843
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/components/BookBuilder/test/Chapter.spec.js
+26
-25
26 additions, 25 deletions
app/components/BookBuilder/test/Chapter.spec.js
with
26 additions
and
25 deletions
app/components/BookBuilder/test/Chapter.spec.js
+
26
−
25
View file @
1b455824
...
@@ -3,6 +3,8 @@ import {
...
@@ -3,6 +3,8 @@ import {
// mount,
// mount,
shallow
shallow
}
from
'
enzyme
'
}
from
'
enzyme
'
import
{
shallowToJson
}
from
'
enzyme-to-json
'
import
sinon
from
'
sinon
'
// import { DropdownButton } from 'react-bootstrap'
// import { DropdownButton } from 'react-bootstrap'
// import { DragDropContext } from 'react-dnd'
// import { DragDropContext } from 'react-dnd'
...
@@ -13,39 +15,37 @@ import {
...
@@ -13,39 +15,37 @@ import {
// // grab the undecorated by dnd react component
// // grab the undecorated by dnd react component
import
Chapter
from
'
../Chapter
'
import
Chapter
from
'
../Chapter
'
const
OriginalChapter
=
Chapter
.
DecoratedComponent
.
DecoratedComponent
const
OriginalChapter
=
Chapter
.
DecoratedComponent
// import ProgressIndicator from '../ProgressIndicator'
// import ProgressIndicator from '../ProgressIndicator'
// import TextInput from '../../../components/TextInput'
// import TextInput from '../../../components/TextInput'
// const identity = function (el) { return el }
// const identity = function (el) { return el }
const
identity
=
el
=>
el
const
{
data
}
=
global
.
mock
const
{
data
}
=
global
.
mock
const
type
=
'
front
'
const
chapters
=
data
.
chapters
.
filter
((
chapter
)
=>
{
return
chapter
.
division
===
type
})
const
firstChapter
=
chapters
[
0
]
let
props
=
{
let
props
=
{
book
:
data
.
book
,
book
:
data
.
book
,
chapter
:
data
.
chapters
[
0
]
chapter
:
firstChapter
,
// connectDragSource: identity,
id
:
firstChapter
.
id
,
// connectDropTarget: identity,
ink
:
sinon
.
spy
(),
// isDragging: false,
key
:
firstChapter
.
index
,
//
move
:
sinon
.
spy
(),
// title: 'This title',
no
:
0
,
// type: 'chapter',
outerContainer
:
{},
// chapter: {
remove
:
sinon
.
spy
(),
// id: '123',
roles
:
[],
// alignment: {},
title
:
firstChapter
.
title
,
// division: 'front',
type
:
firstChapter
.
subCategory
,
// progress: {
update
:
sinon
.
spy
(),
// style: 0,
connectDragSource
:
identity
,
// edit: 0,
connectDropTarget
:
identity
,
// review: 0,
isDragging
:
false
// clean: 0
// }
// },
// remove: sinon.spy(),
// update: sinon.spy(),
// roles: [],
// outerContainer: {}
}
}
// function wrapInTestContext (Chapter) {
// function wrapInTestContext (Chapter) {
...
@@ -64,7 +64,8 @@ const getWrapper = () => {
...
@@ -64,7 +64,8 @@ const getWrapper = () => {
test
(
'
should render correctly
'
,
()
=>
{
test
(
'
should render correctly
'
,
()
=>
{
const
wrapper
=
getWrapper
()
const
wrapper
=
getWrapper
()
expect
(
wrapper
).
toMatchSnapshot
()
const
tree
=
shallowToJson
(
wrapper
)
expect
(
tree
).
toMatchSnapshot
()
})
})
// describe('Chapter', () => {
// describe('Chapter', () => {
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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