BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
1429e5b5
Commit
1429e5b5
authored
7 years ago
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Test for Back Button Behaviour
parent
45b8266b
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
repo_sidebar_spec.js
spec/javascripts/repo/components/repo_sidebar_spec.js
+32
-0
No files found.
spec/javascripts/repo/components/repo_sidebar_spec.js
View file @
1429e5b5
...
...
@@ -121,5 +121,37 @@ describe('RepoSidebar', () => {
expect
(
RepoService
.
url
).
toEqual
(
prevUrl
);
});
});
describe
(
'back button'
,
()
=>
{
const
file1
=
{
id
:
1
,
url
:
'file1'
,
};
const
file2
=
{
id
:
2
,
url
:
'file2'
,
};
RepoStore
.
files
=
[
file1
,
file2
];
RepoStore
.
openedFiles
=
[
file1
,
file2
];
RepoStore
.
isRoot
=
true
;
const
vm
=
createComponent
();
vm
.
fileClicked
(
file1
);
it
(
'render previous file when using back button'
,
()
=>
{
spyOn
(
Helper
,
'getContent'
).
and
.
callThrough
();
vm
.
fileClicked
(
file2
);
expect
(
Helper
.
getContent
).
toHaveBeenCalledWith
(
file2
);
history
.
pushState
({
key
:
Math
.
random
(),
},
''
,
file1
.
url
);
const
popEvent
=
document
.
createEvent
(
'Event'
);
popEvent
.
initEvent
(
'popstate'
,
true
,
true
);
window
.
dispatchEvent
(
popEvent
);
expect
(
Helper
.
getContent
).
toHaveBeenCalledWith
(
file1
);
});
});
});
});
This diff is collapsed.
Click to expand it.
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