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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
03cd536b
Commit
03cd536b
authored
Oct 06, 2017
by
Eric Eastwood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup data-page attribute after each Karma test
Fix
https://gitlab.com/gitlab-org/gitlab-ce/issues/38871
parent
fe11c5fd
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
61 additions
and
22 deletions
+61
-22
app/assets/javascripts/labels_select.js
app/assets/javascripts/labels_select.js
+2
-2
app/assets/javascripts/lib/utils/common_utils.js
app/assets/javascripts/lib/utils/common_utils.js
+1
-1
app/assets/javascripts/milestone_select.js
app/assets/javascripts/milestone_select.js
+1
-1
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+1
-1
app/assets/javascripts/users_select.js
app/assets/javascripts/users_select.js
+1
-1
changelogs/unreleased/38871-cleanup-data-page-attribute-after-karma-test.yml
...ed/38871-cleanup-data-page-attribute-after-karma-test.yml
+5
-0
spec/javascripts/awards_handler_spec.js
spec/javascripts/awards_handler_spec.js
+4
-1
spec/javascripts/behaviors/quick_submit_spec.js
spec/javascripts/behaviors/quick_submit_spec.js
+5
-0
spec/javascripts/merge_request_notes_spec.js
spec/javascripts/merge_request_notes_spec.js
+12
-2
spec/javascripts/merge_request_tabs_spec.js
spec/javascripts/merge_request_tabs_spec.js
+4
-1
spec/javascripts/notes_spec.js
spec/javascripts/notes_spec.js
+6
-1
spec/javascripts/search_autocomplete_spec.js
spec/javascripts/search_autocomplete_spec.js
+19
-11
No files found.
app/assets/javascripts/labels_select.js
View file @
03cd536b
...
...
@@ -285,7 +285,7 @@ import CreateLabelDropdown from './create_label';
},
hidden
:
function
()
{
var
isIssueIndex
,
isMRIndex
,
page
,
selectedLabels
;
page
=
$
(
'
body
'
).
data
(
'
page
'
);
page
=
$
(
'
body
'
).
attr
(
'
data-
page
'
);
isIssueIndex
=
page
===
'
projects:issues:index
'
;
isMRIndex
=
page
===
'
projects:merge_requests:index
'
;
$selectbox
.
hide
();
...
...
@@ -325,7 +325,7 @@ import CreateLabelDropdown from './create_label';
$loading
.
fadeOut
();
};
page
=
$
(
'
body
'
).
data
(
'
page
'
);
page
=
$
(
'
body
'
).
attr
(
'
data-
page
'
);
isIssueIndex
=
page
===
'
projects:issues:index
'
;
isMRIndex
=
page
===
'
projects:merge_requests:index
'
;
...
...
app/assets/javascripts/lib/utils/common_utils.js
View file @
03cd536b
export
const
getPagePath
=
(
index
=
0
)
=>
$
(
'
body
'
).
data
(
'
page
'
).
split
(
'
:
'
)[
index
];
export
const
getPagePath
=
(
index
=
0
)
=>
$
(
'
body
'
).
attr
(
'
data-
page
'
).
split
(
'
:
'
)[
index
];
export
const
isInGroupsPage
=
()
=>
getPagePath
()
===
'
groups
'
;
...
...
app/assets/javascripts/milestone_select.js
View file @
03cd536b
...
...
@@ -147,7 +147,7 @@ import _ from 'underscore';
const
{
$el
,
e
}
=
options
;
let
selected
=
options
.
selectedObj
;
var
data
,
isIssueIndex
,
isMRIndex
,
isSelecting
,
page
,
boardsStore
;
page
=
$
(
'
body
'
).
data
(
'
page
'
);
page
=
$
(
'
body
'
).
attr
(
'
data-
page
'
);
isIssueIndex
=
page
===
'
projects:issues:index
'
;
isMRIndex
=
(
page
===
page
&&
page
===
'
projects:merge_requests:index
'
);
isSelecting
=
(
selected
.
name
!==
selectedMilestone
);
...
...
app/assets/javascripts/notes.js
View file @
03cd536b
...
...
@@ -1257,7 +1257,7 @@ export default class Notes {
}
static
checkMergeRequestStatus
()
{
if
(
getPagePath
(
1
)
===
'
merge_requests
'
)
{
if
(
getPagePath
(
1
)
===
'
merge_requests
'
&&
gl
.
mrWidget
)
{
gl
.
mrWidget
.
checkStatus
();
}
}
...
...
app/assets/javascripts/users_select.js
View file @
03cd536b
...
...
@@ -424,7 +424,7 @@ function UsersSelect(currentUser, els) {
}
var
isIssueIndex
,
isMRIndex
,
page
,
selected
;
page
=
$
(
'
body
'
).
data
(
'
page
'
);
page
=
$
(
'
body
'
).
attr
(
'
data-
page
'
);
isIssueIndex
=
page
===
'
projects:issues:index
'
;
isMRIndex
=
(
page
===
page
&&
page
===
'
projects:merge_requests:index
'
);
if
(
$dropdown
.
hasClass
(
'
js-filter-bulk-update
'
)
||
$dropdown
.
hasClass
(
'
js-issuable-form-dropdown
'
))
{
...
...
changelogs/unreleased/38871-cleanup-data-page-attribute-after-karma-test.yml
0 → 100644
View file @
03cd536b
---
title
:
Cleanup data-page attribute after each Karma test
merge_request
:
14742
author
:
type
:
fixed
spec/javascripts/awards_handler_spec.js
View file @
03cd536b
...
...
@@ -28,7 +28,7 @@ import '~/lib/utils/common_utils';
preloadFixtures
(
'
merge_requests/diff_comment.html.raw
'
);
beforeEach
(
function
(
done
)
{
loadFixtures
(
'
merge_requests/diff_comment.html.raw
'
);
$
(
'
body
'
).
data
(
'
page
'
,
'
projects:merge_requests:show
'
);
$
(
'
body
'
).
attr
(
'
data-
page
'
,
'
projects:merge_requests:show
'
);
loadAwardsHandler
(
true
).
then
((
obj
)
=>
{
awardsHandler
=
obj
;
spyOn
(
awardsHandler
,
'
postEmoji
'
).
and
.
callFake
((
button
,
url
,
emoji
,
cb
)
=>
cb
());
...
...
@@ -55,6 +55,9 @@ import '~/lib/utils/common_utils';
// restore original url root value
gon
.
relative_url_root
=
urlRoot
;
// Undo what we did to the shared <body>
$
(
'
body
'
).
removeAttr
(
'
data-page
'
);
awardsHandler
.
destroy
();
});
describe
(
'
::showEmojiMenu
'
,
function
()
{
...
...
spec/javascripts/behaviors/quick_submit_spec.js
View file @
03cd536b
...
...
@@ -19,6 +19,11 @@ describe('Quick Submit behavior', () => {
this
.
textarea
=
$
(
'
.js-quick-submit textarea
'
).
first
();
});
afterEach
(()
=>
{
// Undo what we did to the shared <body>
$
(
'
body
'
).
removeAttr
(
'
data-page
'
);
});
it
(
'
does not respond to other keyCodes
'
,
()
=>
{
this
.
textarea
.
trigger
(
keydownEvent
({
keyCode
:
32
,
...
...
spec/javascripts/merge_request_notes_spec.js
View file @
03cd536b
...
...
@@ -23,12 +23,17 @@ describe('Merge request notes', () => {
loadFixtures
(
discussionTabFixture
);
gl
.
utils
.
disableButtonIfEmptyField
=
_
.
noop
;
window
.
project_uploads_path
=
'
http://test.host/uploads
'
;
$
(
'
body
'
).
data
(
'
page
'
,
'
projects:merge_requests:show
'
);
$
(
'
body
'
).
attr
(
'
data-
page
'
,
'
projects:merge_requests:show
'
);
window
.
gon
.
current_user_id
=
$
(
'
.note:last
'
).
data
(
'
author-id
'
);
return
new
Notes
(
''
,
[]);
});
afterEach
(()
=>
{
// Undo what we did to the shared <body>
$
(
'
body
'
).
removeAttr
(
'
data-page
'
);
});
describe
(
'
up arrow
'
,
()
=>
{
it
(
'
edits last comment when triggered in main form
'
,
()
=>
{
const
upArrowEvent
=
$
.
Event
(
'
keydown
'
);
...
...
@@ -71,12 +76,17 @@ describe('Merge request notes', () => {
<textarea class="js-note-text"></textarea>
</form>`
;
setFixtures
(
diffsResponse
.
html
+
noteFormHtml
);
$
(
'
body
'
).
data
(
'
page
'
,
'
projects:merge_requests:show
'
);
$
(
'
body
'
).
attr
(
'
data-
page
'
,
'
projects:merge_requests:show
'
);
window
.
gon
.
current_user_id
=
$
(
'
.note:last
'
).
data
(
'
author-id
'
);
return
new
Notes
(
''
,
[]);
});
afterEach
(()
=>
{
// Undo what we did to the shared <body>
$
(
'
body
'
).
removeAttr
(
'
data-page
'
);
});
describe
(
'
up arrow
'
,
()
=>
{
it
(
'
edits last comment in discussion when triggered in discussion form
'
,
(
done
)
=>
{
const
upArrowEvent
=
$
.
Event
(
'
keydown
'
);
...
...
spec/javascripts/merge_request_tabs_spec.js
View file @
03cd536b
...
...
@@ -277,7 +277,7 @@ import 'vendor/jquery.scrollTo';
describe
(
'
loadDiff
'
,
function
()
{
beforeEach
(()
=>
{
loadFixtures
(
'
merge_requests/diff_comment.html.raw
'
);
spyOn
(
window
.
gl
.
utils
,
'
getPagePath
'
).
and
.
returnValue
(
'
merge_requests
'
);
$
(
'
body
'
).
attr
(
'
data-page
'
,
'
projects:merge_requests:show
'
);
window
.
gl
.
ImageFile
=
()
=>
{};
window
.
notes
=
new
Notes
(
''
,
[]);
spyOn
(
window
.
notes
,
'
toggleDiffNote
'
).
and
.
callThrough
();
...
...
@@ -286,6 +286,9 @@ import 'vendor/jquery.scrollTo';
afterEach
(()
=>
{
delete
window
.
gl
.
ImageFile
;
delete
window
.
notes
;
// Undo what we did to the shared <body>
$
(
'
body
'
).
removeAttr
(
'
data-page
'
);
});
it
(
'
requires an absolute pathname
'
,
function
()
{
...
...
spec/javascripts/notes_spec.js
View file @
03cd536b
...
...
@@ -39,7 +39,12 @@ import '~/notes';
loadFixtures
(
commentsTemplate
);
gl
.
utils
.
disableButtonIfEmptyField
=
_
.
noop
;
window
.
project_uploads_path
=
'
http://test.host/uploads
'
;
$
(
'
body
'
).
data
(
'
page
'
,
'
projects:merge_requets:show
'
);
$
(
'
body
'
).
attr
(
'
data-page
'
,
'
projects:merge_requets:show
'
);
});
afterEach
(()
=>
{
// Undo what we did to the shared <body>
$
(
'
body
'
).
removeAttr
(
'
data-page
'
);
});
describe
(
'
task lists
'
,
function
()
{
...
...
spec/javascripts/search_autocomplete_spec.js
View file @
03cd536b
...
...
@@ -6,7 +6,7 @@ import '~/lib/utils/common_utils';
import
'
vendor/fuzzaldrin-plus
'
;
(
function
()
{
var
a
ddBodyAttributes
,
a
ssertLinks
,
dashboardIssuesPath
,
dashboardMRsPath
,
groupIssuesPath
,
groupMRsPath
,
groupName
,
mockDashboardOptions
,
mockGroupOptions
,
mockProjectOptions
,
projectIssuesPath
,
projectMRsPath
,
projectName
,
userId
,
widget
;
var
assertLinks
,
dashboardIssuesPath
,
dashboardMRsPath
,
groupIssuesPath
,
groupMRsPath
,
groupName
,
mockDashboardOptions
,
mockGroupOptions
,
mockProjectOptions
,
projectIssuesPath
,
projectMRsPath
,
projectName
,
userId
,
widget
;
var
userName
=
'
root
'
;
widget
=
null
;
...
...
@@ -29,25 +29,31 @@ import 'vendor/fuzzaldrin-plus';
groupName
=
'
Gitlab Org
'
;
const
removeBodyAttributes
=
function
()
{
const
$body
=
$
(
'
body
'
);
$body
.
removeAttr
(
'
data-page
'
);
$body
.
removeAttr
(
'
data-project
'
);
$body
.
removeAttr
(
'
data-group
'
);
};
// Add required attributes to body before starting the test.
// section would be dashboard|group|project
addBodyAttributes
=
function
(
section
)
{
var
$body
;
const
addBodyAttributes
=
function
(
section
)
{
if
(
section
==
null
)
{
section
=
'
dashboard
'
;
}
$body
=
$
(
'
body
'
);
$body
.
removeAttr
(
'
data-page
'
);
$body
.
removeAttr
(
'
data-project
'
);
$body
.
removeAttr
(
'
data-group
'
);
const
$body
=
$
(
'
body
'
);
removeBodyAttributes
();
switch
(
section
)
{
case
'
dashboard
'
:
return
$body
.
data
(
'
page
'
,
'
root:index
'
);
return
$body
.
attr
(
'
data-
page
'
,
'
root:index
'
);
case
'
group
'
:
$body
.
data
(
'
page
'
,
'
groups:show
'
);
$body
.
attr
(
'
data-
page
'
,
'
groups:show
'
);
return
$body
.
data
(
'
group
'
,
'
gitlab-org
'
);
case
'
project
'
:
$body
.
data
(
'
page
'
,
'
projects:show
'
);
$body
.
attr
(
'
data-
page
'
,
'
projects:show
'
);
return
$body
.
data
(
'
project
'
,
'
gitlab-ce
'
);
}
};
...
...
@@ -108,7 +114,7 @@ import 'vendor/fuzzaldrin-plus';
preloadFixtures
(
'
static/search_autocomplete.html.raw
'
);
beforeEach
(
function
()
{
loadFixtures
(
'
static/search_autocomplete.html.raw
'
);
widget
=
new
gl
.
SearchAutocomplete
;
// Prevent turbolinks from triggering within gl_dropdown
spyOn
(
window
.
gl
.
utils
,
'
visitUrl
'
).
and
.
returnValue
(
true
);
...
...
@@ -120,6 +126,8 @@ import 'vendor/fuzzaldrin-plus';
});
afterEach
(
function
()
{
// Undo what we did to the shared <body>
removeBodyAttributes
();
window
.
gon
=
{};
});
it
(
'
should show Dashboard specific dropdown menu
'
,
function
()
{
...
...
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