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
Léo-Paul Géneau
gitlab-ce
Commits
10cc5d1a
Commit
10cc5d1a
authored
Feb 02, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed task list spec
parent
fc53a115
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
15 deletions
+37
-15
spec/javascripts/merge_request_spec.js
spec/javascripts/merge_request_spec.js
+20
-8
spec/javascripts/notes_spec.js
spec/javascripts/notes_spec.js
+17
-7
No files found.
spec/javascripts/merge_request_spec.js
View file @
10cc5d1a
/* eslint-disable space-before-function-paren, no-return-assign */
/* eslint-disable space-before-function-paren, no-return-assign */
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
MergeRequest
from
'
~/merge_request
'
;
import
MergeRequest
from
'
~/merge_request
'
;
import
CloseReopenReportToggle
from
'
~/close_reopen_report_toggle
'
;
import
CloseReopenReportToggle
from
'
~/close_reopen_report_toggle
'
;
...
@@ -8,11 +8,24 @@ import IssuablesHelper from '~/helpers/issuables_helper';
...
@@ -8,11 +8,24 @@ import IssuablesHelper from '~/helpers/issuables_helper';
(
function
()
{
(
function
()
{
describe
(
'
MergeRequest
'
,
function
()
{
describe
(
'
MergeRequest
'
,
function
()
{
describe
(
'
task lists
'
,
function
()
{
describe
(
'
task lists
'
,
function
()
{
let
mock
;
preloadFixtures
(
'
merge_requests/merge_request_with_task_list.html.raw
'
);
preloadFixtures
(
'
merge_requests/merge_request_with_task_list.html.raw
'
);
beforeEach
(
function
()
{
beforeEach
(
function
()
{
loadFixtures
(
'
merge_requests/merge_request_with_task_list.html.raw
'
);
loadFixtures
(
'
merge_requests/merge_request_with_task_list.html.raw
'
);
spyOn
(
axios
,
'
patch
'
).
and
.
callThrough
();
mock
=
new
MockAdapter
(
axios
);
mock
.
onPatch
(
`
${
gl
.
TEST_HOST
}
/frontend-fixtures/merge-requests-project/merge_requests/1.json`
).
reply
(
200
,
{});
return
this
.
merge
=
new
MergeRequest
();
return
this
.
merge
=
new
MergeRequest
();
});
});
afterEach
(()
=>
{
mock
.
restore
();
});
it
(
'
modifies the Markdown field
'
,
function
()
{
it
(
'
modifies the Markdown field
'
,
function
()
{
spyOn
(
jQuery
,
'
ajax
'
).
and
.
stub
();
spyOn
(
jQuery
,
'
ajax
'
).
and
.
stub
();
const
changeEvent
=
document
.
createEvent
(
'
HTMLEvents
'
);
const
changeEvent
=
document
.
createEvent
(
'
HTMLEvents
'
);
...
@@ -22,15 +35,14 @@ import IssuablesHelper from '~/helpers/issuables_helper';
...
@@ -22,15 +35,14 @@ import IssuablesHelper from '~/helpers/issuables_helper';
});
});
it
(
'
submits an ajax request on tasklist:changed
'
,
(
done
)
=>
{
it
(
'
submits an ajax request on tasklist:changed
'
,
(
done
)
=>
{
spyOn
(
axios
,
'
patch
'
).
and
.
callFake
((
url
,
data
)
=>
{
$
(
'
.js-task-list-field
'
).
trigger
(
'
tasklist:changed
'
);
expect
(
url
).
toBe
(
`
${
gl
.
TEST_HOST
}
/frontend-fixtures/merge-requests-project/merge_requests/1.json`
);
expect
(
data
.
merge_request
.
description
).
not
.
toBe
(
null
);
done
();
return
Promise
.
resolve
({
data
:
{}
});
setTimeout
(()
=>
{
expect
(
axios
.
patch
).
toHaveBeenCalledWith
(
`
${
gl
.
TEST_HOST
}
/frontend-fixtures/merge-requests-project/merge_requests/1.json`
,
{
merge_request
:
{
description
:
'
- [ ] Task List Item
'
},
});
done
();
});
});
$
(
'
.js-task-list-field
'
).
trigger
(
'
tasklist:changed
'
);
});
});
});
});
...
...
spec/javascripts/notes_spec.js
View file @
10cc5d1a
...
@@ -50,13 +50,24 @@ import timeoutPromise from './helpers/set_timeout_promise_helper';
...
@@ -50,13 +50,24 @@ import timeoutPromise from './helpers/set_timeout_promise_helper';
});
});
describe
(
'
task lists
'
,
function
()
{
describe
(
'
task lists
'
,
function
()
{
let
mock
;
beforeEach
(
function
()
{
beforeEach
(
function
()
{
spyOn
(
axios
,
'
patch
'
).
and
.
callThrough
();
mock
=
new
MockAdapter
(
axios
);
mock
.
onPatch
(
`
${
gl
.
TEST_HOST
}
/frontend-fixtures/merge-requests-project/merge_requests/1.json`
).
reply
(
200
,
{});
$
(
'
.js-comment-button
'
).
on
(
'
click
'
,
function
(
e
)
{
$
(
'
.js-comment-button
'
).
on
(
'
click
'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
});
});
this
.
notes
=
new
Notes
(
''
,
[]);
this
.
notes
=
new
Notes
(
''
,
[]);
});
});
afterEach
(()
=>
{
mock
.
restore
();
});
it
(
'
modifies the Markdown field
'
,
function
()
{
it
(
'
modifies the Markdown field
'
,
function
()
{
const
changeEvent
=
document
.
createEvent
(
'
HTMLEvents
'
);
const
changeEvent
=
document
.
createEvent
(
'
HTMLEvents
'
);
changeEvent
.
initEvent
(
'
change
'
,
true
,
true
);
changeEvent
.
initEvent
(
'
change
'
,
true
,
true
);
...
@@ -66,15 +77,14 @@ import timeoutPromise from './helpers/set_timeout_promise_helper';
...
@@ -66,15 +77,14 @@ import timeoutPromise from './helpers/set_timeout_promise_helper';
});
});
it
(
'
submits an ajax request on tasklist:changed
'
,
function
(
done
)
{
it
(
'
submits an ajax request on tasklist:changed
'
,
function
(
done
)
{
spyOn
(
axios
,
'
patch
'
).
and
.
callFake
((
url
,
data
)
=>
{
$
(
'
.js-task-list-container
'
).
trigger
(
'
tasklist:changed
'
);
expect
(
url
).
toBe
(
`
${
gl
.
TEST_HOST
}
/frontend-fixtures/merge-requests-project/merge_requests/1.json`
);
expect
(
data
.
note
).
not
.
toBe
(
null
);
done
();
return
Promise
.
resolve
({
data
:
{}
});
setTimeout
(()
=>
{
expect
(
axios
.
patch
).
toHaveBeenCalledWith
(
`
${
gl
.
TEST_HOST
}
/frontend-fixtures/merge-requests-project/merge_requests/1.json`
,
{
note
:
{
note
:
''
},
});
done
();
});
});
$
(
'
.js-task-list-container
'
).
trigger
(
'
tasklist:changed
'
);
});
});
});
});
...
...
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