Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pubsweet
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
Giorgio Sironi
pubsweet
Commits
a2a2c585
Commit
a2a2c585
authored
7 years ago
by
Aanand Prasad
Committed by
Jure
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
test(ui): add snapshot test for when Menu is open
parent
5059b3b9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/ui/test/Menu.test.js
+8
-0
8 additions, 0 deletions
packages/ui/test/Menu.test.js
packages/ui/test/__snapshots__/Menu.test.js.snap
+58
-0
58 additions, 0 deletions
packages/ui/test/__snapshots__/Menu.test.js.snap
with
66 additions
and
0 deletions
packages/ui/test/Menu.test.js
+
8
−
0
View file @
a2a2c585
import
React
from
'
react
'
import
React
from
'
react
'
import
renderer
from
'
react-test-renderer
'
import
renderer
from
'
react-test-renderer
'
import
'
jest-styled-components
'
import
Menu
from
'
../src/atoms/Menu
'
import
Menu
from
'
../src/atoms/Menu
'
...
@@ -13,4 +14,11 @@ describe('Menu', () => {
...
@@ -13,4 +14,11 @@ describe('Menu', () => {
const
tree
=
renderer
.
create
(
<
Menu
{...
props
}
/>
)
.toJSON
(
)
const
tree
=
renderer
.
create
(
<
Menu
{...
props
}
/>
)
.toJSON
(
)
expect
(
tree
).
toMatchSnapshot
()
expect
(
tree
).
toMatchSnapshot
()
})
})
test
(
'
is rendered correctly when open
'
,
()
=>
{
const
menu
=
renderer
.
create
(
<
Menu
{...
props
}
/>
)
menu
.
getInstance
().
toggleMenu
()
const
tree
=
menu
.
toJSON
()
expect
(
tree
).
toMatchSnapshot
()
})
})
})
This diff is collapsed.
Click to expand it.
packages/ui/test/__snapshots__/Menu.test.js.snap
+
58
−
0
View file @
a2a2c585
...
@@ -32,3 +32,61 @@ exports[`Menu is rendered correctly 1`] = `
...
@@ -32,3 +32,61 @@ exports[`Menu is rendered correctly 1`] = `
</div>
</div>
</div>
</div>
`;
`;
exports[`Menu is rendered correctly when open 1`] = `
<div
className="root open"
>
<div
className="main"
role="listbox"
>
<div
className="openerContainer"
>
<button
className="opener"
onClick={[Function]}
type="button"
>
<span>
Foo
</span>
<span
className="arrow"
>
▼
</span>
</button>
</div>
<div
className="optionsContainer"
>
<div
className="options"
>
<div
aria-selected={true}
className="option active"
onClick={[Function]}
onKeyPress={[Function]}
role="option"
tabIndex="0"
>
Foo
</div>
<div
aria-selected={false}
className="option"
onClick={[Function]}
onKeyPress={[Function]}
role="option"
tabIndex="0"
>
Bar
</div>
</div>
</div>
</div>
</div>
`;
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