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
Boxiang Sun
gitlab-ce
Commits
d323bb79
Commit
d323bb79
authored
Aug 10, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change fixtures of old tests
parent
3008e995
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
80 additions
and
80 deletions
+80
-80
app/assets/javascripts/notes/components/issue_notes_app.vue
app/assets/javascripts/notes/components/issue_notes_app.vue
+6
-5
spec/features/issues/note_polling_spec.rb
spec/features/issues/note_polling_spec.rb
+0
-2
spec/javascripts/awards_handler_spec.js
spec/javascripts/awards_handler_spec.js
+4
-4
spec/javascripts/fixtures/merge_requests.rb
spec/javascripts/fixtures/merge_requests.rb
+5
-0
spec/javascripts/notes_spec.js
spec/javascripts/notes_spec.js
+4
-4
spec/javascripts/shortcuts_issuable_spec.js
spec/javascripts/shortcuts_issuable_spec.js
+60
-64
spec/javascripts/shortcuts_spec.js
spec/javascripts/shortcuts_spec.js
+1
-1
No files found.
app/assets/javascripts/notes/components/issue_notes_app.vue
View file @
d323bb79
...
@@ -79,16 +79,18 @@
...
@@ -79,16 +79,18 @@
return
note
.
individual_note
?
note
.
notes
[
0
]
:
note
;
return
note
.
individual_note
?
note
.
notes
[
0
]
:
note
;
},
},
fetchNotes
()
{
fetchNotes
()
{
this
.
actionFetchNotes
(
this
.
getNotesDataByProp
(
'
discussionsPath
'
))
return
this
.
actionFetchNotes
(
this
.
getNotesDataByProp
(
'
discussionsPath
'
))
.
then
(()
=>
{
.
then
(()
=>
{
this
.
isLoading
=
false
;
// Scroll to note if we have hash fragment in the page URL
// Scroll to note if we have hash fragment in the page URL
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
checkLocationHash
();
this
.
checkLocationHash
();
});
});
})
})
.
catch
(()
=>
Flash
(
'
Something went wrong while fetching issue comments. Please try again.
'
));
.
catch
(()
=>
Flash
(
'
Something went wrong while fetching issue comments. Please try again.
'
))
.
then
(()
=>
{
this
.
isLoading
=
false
;
this
.
initPolling
();
});
},
},
initPolling
()
{
initPolling
()
{
this
.
setLastFetchedAt
(
this
.
getNotesDataByProp
(
'
lastFetchedAt
'
));
this
.
setLastFetchedAt
(
this
.
getNotesDataByProp
(
'
lastFetchedAt
'
));
...
@@ -112,7 +114,6 @@
...
@@ -112,7 +114,6 @@
},
},
mounted
()
{
mounted
()
{
this
.
fetchNotes
();
this
.
fetchNotes
();
this
.
initPolling
();
const
parentElement
=
this
.
$el
.
parentElement
;
const
parentElement
=
this
.
$el
.
parentElement
;
if
(
parentElement
&&
if
(
parentElement
&&
...
...
spec/features/issues/note_polling_spec.rb
View file @
d323bb79
...
@@ -13,7 +13,6 @@ feature 'Issue notes polling', :js do
...
@@ -13,7 +13,6 @@ feature 'Issue notes polling', :js do
it
'displays the new comment'
do
it
'displays the new comment'
do
note
=
create
(
:note
,
noteable:
issue
,
project:
project
,
note:
'Looks good!'
)
note
=
create
(
:note
,
noteable:
issue
,
project:
project
,
note:
'Looks good!'
)
page
.
execute_script
(
'issueNotes.refresh();'
)
wait_for_requests
wait_for_requests
expect
(
page
).
to
have_selector
(
"#note_
#{
note
.
id
}
"
,
text:
'Looks good!'
)
expect
(
page
).
to
have_selector
(
"#note_
#{
note
.
id
}
"
,
text:
'Looks good!'
)
...
@@ -115,7 +114,6 @@ feature 'Issue notes polling', :js do
...
@@ -115,7 +114,6 @@ feature 'Issue notes polling', :js do
def
update_note
(
note
,
new_text
)
def
update_note
(
note
,
new_text
)
note
.
update
(
note:
new_text
)
note
.
update
(
note:
new_text
)
page
.
execute_script
(
'issueNotes.refresh();'
)
wait_for_requests
wait_for_requests
end
end
...
...
spec/javascripts/awards_handler_spec.js
View file @
d323bb79
...
@@ -25,10 +25,10 @@ import '~/lib/utils/common_utils';
...
@@ -25,10 +25,10 @@ import '~/lib/utils/common_utils';
};
};
describe
(
'
AwardsHandler
'
,
function
()
{
describe
(
'
AwardsHandler
'
,
function
()
{
preloadFixtures
(
'
issues/issue_with
_comment.html.raw
'
);
preloadFixtures
(
'
merge_requests/diff
_comment.html.raw
'
);
beforeEach
(
function
(
done
)
{
beforeEach
(
function
(
done
)
{
loadFixtures
(
'
issues/issue_with
_comment.html.raw
'
);
loadFixtures
(
'
merge_requests/diff
_comment.html.raw
'
);
$
(
'
body
'
).
data
(
'
page
'
,
'
projects:
issue
s:show
'
);
$
(
'
body
'
).
data
(
'
page
'
,
'
projects:
merge_request
s:show
'
);
loadAwardsHandler
(
true
).
then
((
obj
)
=>
{
loadAwardsHandler
(
true
).
then
((
obj
)
=>
{
awardsHandler
=
obj
;
awardsHandler
=
obj
;
spyOn
(
awardsHandler
,
'
postEmoji
'
).
and
.
callFake
((
button
,
url
,
emoji
,
cb
)
=>
cb
());
spyOn
(
awardsHandler
,
'
postEmoji
'
).
and
.
callFake
((
button
,
url
,
emoji
,
cb
)
=>
cb
());
...
@@ -140,7 +140,7 @@ import '~/lib/utils/common_utils';
...
@@ -140,7 +140,7 @@ import '~/lib/utils/common_utils';
});
});
describe
(
'
::getAwardUrl
'
,
function
()
{
describe
(
'
::getAwardUrl
'
,
function
()
{
return
it
(
'
returns the url for request
'
,
function
()
{
return
it
(
'
returns the url for request
'
,
function
()
{
return
expect
(
awardsHandler
.
getAwardUrl
()).
toBe
(
'
http://test.host/frontend-fixtures/
issues-project/issue
s/1/toggle_award_emoji
'
);
return
expect
(
awardsHandler
.
getAwardUrl
()).
toBe
(
'
http://test.host/frontend-fixtures/
merge-requests-project/merge_request
s/1/toggle_award_emoji
'
);
});
});
});
});
describe
(
'
::addAward and ::checkMutuality
'
,
function
()
{
describe
(
'
::addAward and ::checkMutuality
'
,
function
()
{
...
...
spec/javascripts/fixtures/merge_requests.rb
View file @
d323bb79
...
@@ -55,6 +55,11 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont
...
@@ -55,6 +55,11 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont
render_merge_request
(
example
.
description
,
merge_request
)
render_merge_request
(
example
.
description
,
merge_request
)
end
end
it
'merge_requests/merge_request_with_comment.html.raw'
do
|
example
|
create
(
:note_on_merge_request
,
author:
admin
,
project:
project
,
noteable:
merge_request
,
note:
'- [ ] Task List Item'
)
render_merge_request
(
example
.
description
,
merge_request
)
end
private
private
def
render_merge_request
(
fixture_file_name
,
merge_request
)
def
render_merge_request
(
fixture_file_name
,
merge_request
)
...
...
spec/javascripts/notes_spec.js
View file @
d323bb79
...
@@ -30,16 +30,16 @@ import '~/notes';
...
@@ -30,16 +30,16 @@ import '~/notes';
return
escapedString
;
return
escapedString
;
};
};
describe
(
'
Notes
'
,
function
()
{
f
describe
(
'
Notes
'
,
function
()
{
const
FLASH_TYPE_ALERT
=
'
alert
'
;
const
FLASH_TYPE_ALERT
=
'
alert
'
;
var
commentsTemplate
=
'
issues/issue
_with_comment.html.raw
'
;
var
commentsTemplate
=
'
merge_requests/merge_request
_with_comment.html.raw
'
;
preloadFixtures
(
commentsTemplate
);
preloadFixtures
(
commentsTemplate
);
beforeEach
(
function
()
{
beforeEach
(
function
()
{
loadFixtures
(
commentsTemplate
);
loadFixtures
(
commentsTemplate
);
gl
.
utils
.
disableButtonIfEmptyField
=
_
.
noop
;
gl
.
utils
.
disableButtonIfEmptyField
=
_
.
noop
;
window
.
project_uploads_path
=
'
http://test.host/uploads
'
;
window
.
project_uploads_path
=
'
http://test.host/uploads
'
;
$
(
'
body
'
).
data
(
'
page
'
,
'
projects:
issue
s:show
'
);
$
(
'
body
'
).
data
(
'
page
'
,
'
projects:
merge_requet
s:show
'
);
});
});
describe
(
'
task lists
'
,
function
()
{
describe
(
'
task lists
'
,
function
()
{
...
@@ -60,7 +60,7 @@ import '~/notes';
...
@@ -60,7 +60,7 @@ import '~/notes';
it
(
'
submits an ajax request on tasklist:changed
'
,
function
()
{
it
(
'
submits an ajax request on tasklist:changed
'
,
function
()
{
spyOn
(
jQuery
,
'
ajax
'
).
and
.
callFake
(
function
(
req
)
{
spyOn
(
jQuery
,
'
ajax
'
).
and
.
callFake
(
function
(
req
)
{
expect
(
req
.
type
).
toBe
(
'
PATCH
'
);
expect
(
req
.
type
).
toBe
(
'
PATCH
'
);
expect
(
req
.
url
).
toBe
(
'
http://test.host/frontend-fixtures/
issues-project/notes/1
'
);
expect
(
req
.
url
).
toBe
(
'
http://test.host/frontend-fixtures/
merge-requests-project/notes/3
'
);
return
expect
(
req
.
data
.
note
).
not
.
toBe
(
null
);
return
expect
(
req
.
data
.
note
).
not
.
toBe
(
null
);
});
});
$
(
'
.js-task-list-field
'
).
trigger
(
'
tasklist:changed
'
);
$
(
'
.js-task-list-field
'
).
trigger
(
'
tasklist:changed
'
);
...
...
spec/javascripts/shortcuts_issuable_spec.js
View file @
d323bb79
/* eslint-disable space-before-function-paren, no-return-assign, no-var, quotes */
/* global ShortcutsIssuable */
/* global ShortcutsIssuable */
import
'
~/copy_as_gfm
'
;
import
'
~/copy_as_gfm
'
;
import
'
~/shortcuts_issuable
'
;
import
'
~/shortcuts_issuable
'
;
(
function
()
{
describe
(
'
ShortcutsIssuable
'
,
()
=>
{
describe
(
'
ShortcutsIssuable
'
,
function
()
{
const
fixtureName
=
'
merge_requests/diff_comment.html.raw
'
;
var
fixtureName
=
'
issues/open-issue.html.raw
'
;
preloadFixtures
(
fixtureName
);
preloadFixtures
(
fixtureName
);
beforeEach
(()
=>
{
beforeEach
(
function
()
{
loadFixtures
(
fixtureName
);
loadFixtures
(
fixtureName
);
document
.
querySelector
(
'
.js-new-note-form
'
).
classList
.
add
(
'
js-main-target-form
'
);
document
.
querySelector
(
'
.js-new-note-form
'
).
classList
.
add
(
'
js-main-target-form
'
);
this
.
shortcut
=
new
ShortcutsIssuable
();
this
.
shortcut
=
new
ShortcutsIssuable
();
});
});
describe
(
'
replyWithSelectedText
'
,
()
=>
{
describe
(
'
replyWithSelectedText
'
,
function
()
{
// Stub window.gl.utils.getSelectedFragment to return a node with the provided HTML.
var
stubSelection
;
const
stubSelection
=
(
html
)
=>
{
// Stub window.gl.utils.getSelectedFragment to return a node with the provided HTML.
window
.
gl
.
utils
.
getSelectedFragment
=
()
=>
{
stubSelection
=
function
(
html
)
{
const
node
=
document
.
createElement
(
'
div
'
);
window
.
gl
.
utils
.
getSelectedFragment
=
function
()
{
node
.
innerHTML
=
html
;
var
node
=
document
.
createElement
(
'
div
'
);
return
node
;
node
.
innerHTML
=
html
;
return
node
;
};
};
};
beforeEach
(
function
()
{
};
this
.
selector
=
'
form.js-main-target-form textarea#note-body
'
;
beforeEach
(()
=>
{
this
.
selector
=
'
form.js-main-target-form textarea#note-body
'
;
});
describe
(
'
with empty selection
'
,
()
=>
{
it
(
'
does not return an error
'
,
()
=>
{
this
.
shortcut
.
replyWithSelectedText
();
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
''
);
});
});
describe
(
'
with empty selection
'
,
function
()
{
it
(
'
triggers `focus`
'
,
()
=>
{
it
(
'
does not return an error
'
,
function
()
{
this
.
shortcut
.
replyWithSelectedText
();
this
.
shortcut
.
replyWithSelectedText
();
expect
(
document
.
activeElement
).
toBe
(
document
.
querySelector
(
this
.
selector
));
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
''
);
});
it
(
'
triggers `focus`
'
,
function
()
{
this
.
shortcut
.
replyWithSelectedText
();
expect
(
document
.
activeElement
).
toBe
(
document
.
querySelector
(
this
.
selector
));
});
});
});
describe
(
'
with any selection
'
,
function
()
{
});
beforeEach
(
function
()
{
describe
(
'
with any selection
'
,
()
=>
{
stubSelection
(
'
<p>Selected text.</p>
'
);
beforeEach
(()
=>
{
});
stubSelection
(
'
<p>Selected text.</p>
'
);
it
(
'
leaves existing input intact
'
,
function
()
{
$
(
this
.
selector
).
val
(
'
This text was already here.
'
);
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
'
This text was already here.
'
);
this
.
shortcut
.
replyWithSelectedText
();
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
"
This text was already here.
\n\n
> Selected text.
\n\n
"
);
});
it
(
'
triggers `input`
'
,
function
()
{
var
triggered
=
false
;
$
(
this
.
selector
).
on
(
'
input
'
,
function
()
{
triggered
=
true
;
});
this
.
shortcut
.
replyWithSelectedText
();
expect
(
triggered
).
toBe
(
true
);
});
it
(
'
triggers `focus`
'
,
function
()
{
this
.
shortcut
.
replyWithSelectedText
();
expect
(
document
.
activeElement
).
toBe
(
document
.
querySelector
(
this
.
selector
));
});
});
});
describe
(
'
with a one-line selection
'
,
function
()
{
it
(
'
leaves existing input intact
'
,
()
=>
{
it
(
'
quotes the selection
'
,
function
()
{
$
(
this
.
selector
).
val
(
'
This text was already here.
'
);
stubSelection
(
'
<p>This text has been selected.</p>
'
);
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
'
This text was already here.
'
);
this
.
shortcut
.
replyWithSelectedText
();
this
.
shortcut
.
replyWithSelectedText
();
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
"
> This text has been selected.
\n\n
"
);
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
'
This text was already here.
\n\n
> Selected text.
\n\n
'
);
});
});
});
describe
(
'
with a multi-line selection
'
,
function
()
{
it
(
'
triggers `input`
'
,
()
=>
{
it
(
'
quotes the selected lines as a group
'
,
function
()
{
let
triggered
=
false
;
stubSelection
(
"
<p>Selected line one.</p>
\n\n
<p>Selected line two.</p>
\n\n
<p>Selected line three.</p>
"
);
$
(
this
.
selector
).
on
(
'
input
'
,
()
=>
{
this
.
shortcut
.
replyWithSelectedText
();
triggered
=
true
;
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
"
> Selected line one.
\n
>
\n
> Selected line two.
\n
>
\n
> Selected line three.
\n\n
"
);
});
});
this
.
shortcut
.
replyWithSelectedText
();
expect
(
triggered
).
toBe
(
true
);
});
it
(
'
triggers `focus`
'
,
()
=>
{
this
.
shortcut
.
replyWithSelectedText
();
expect
(
document
.
activeElement
).
toBe
(
document
.
querySelector
(
this
.
selector
));
});
});
describe
(
'
with a one-line selection
'
,
()
=>
{
it
(
'
quotes the selection
'
,
()
=>
{
stubSelection
(
'
<p>This text has been selected.</p>
'
);
this
.
shortcut
.
replyWithSelectedText
();
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
'
> This text has been selected.
\n\n
'
);
});
});
describe
(
'
with a multi-line selection
'
,
()
=>
{
it
(
'
quotes the selected lines as a group
'
,
()
=>
{
stubSelection
(
'
<p>Selected line one.</p>
\n\n
<p>Selected line two.</p>
\n\n
<p>Selected line three.</p>
'
);
this
.
shortcut
.
replyWithSelectedText
();
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
'
> Selected line one.
\n
>
\n
> Selected line two.
\n
>
\n
> Selected line three.
\n\n
'
);
});
});
});
});
});
});
})
.
call
(
window
)
;
});
spec/javascripts/shortcuts_spec.js
View file @
d323bb79
/* global Shortcuts */
/* global Shortcuts */
describe
(
'
Shortcuts
'
,
()
=>
{
describe
(
'
Shortcuts
'
,
()
=>
{
const
fixtureName
=
'
issues/issue_with
_comment.html.raw
'
;
const
fixtureName
=
'
merge_requests/diff
_comment.html.raw
'
;
const
createEvent
=
(
type
,
target
)
=>
$
.
Event
(
type
,
{
const
createEvent
=
(
type
,
target
)
=>
$
.
Event
(
type
,
{
target
,
target
,
});
});
...
...
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