Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1429e5b5
Commit
1429e5b5
authored
Oct 02, 2017
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Test for Back Button Behaviour
parent
45b8266b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
spec/javascripts/repo/components/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', () => {
...
@@ -121,5 +121,37 @@ describe('RepoSidebar', () => {
expect
(
RepoService
.
url
).
toEqual
(
prevUrl
);
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
);
});
});
});
});
});
});
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