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
c50c5e92
Commit
c50c5e92
authored
May 02, 2017
by
Regis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issue_spec - getting closer
parent
f6df1357
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
9 deletions
+57
-9
spec/javascripts/issue_show/issue_title_description_spec.js
spec/javascripts/issue_show/issue_title_description_spec.js
+2
-4
spec/javascripts/issue_show/mock_data.js
spec/javascripts/issue_show/mock_data.js
+8
-0
spec/javascripts/issue_spec.js
spec/javascripts/issue_spec.js
+47
-5
No files found.
spec/javascripts/issue_show/issue_title_description_spec.js
View file @
c50c5e92
...
@@ -11,14 +11,12 @@ const issueShowInterceptor = data => (request, next) => {
...
@@ -11,14 +11,12 @@ const issueShowInterceptor = data => (request, next) => {
next
(
request
.
respondWith
(
JSON
.
stringify
(
data
),
{
next
(
request
.
respondWith
(
JSON
.
stringify
(
data
),
{
status
:
200
,
status
:
200
,
headers
:
{
headers
:
{
'
POLL-INTERVAL
'
:
1
,
'
POLL-INTERVAL
'
:
1
0
,
},
},
}));
}));
};
};
describe
(
'
Issue Title
'
,
()
=>
{
describe
(
'
Issue Title
'
,
()
=>
{
document
.
body
.
innerHTML
=
'
<span id="task_status"></span>
'
;
const
comps
=
{
const
comps
=
{
IssueTitleComponent
:
{},
IssueTitleComponent
:
{},
};
};
...
@@ -57,7 +55,7 @@ describe('Issue Title', () => {
...
@@ -57,7 +55,7 @@ describe('Issue Title', () => {
expect
(
issueShowComponent
.
$el
.
querySelector
(
'
.js-task-list-field
'
).
innerText
).
toContain
(
'
42
'
);
expect
(
issueShowComponent
.
$el
.
querySelector
(
'
.js-task-list-field
'
).
innerText
).
toContain
(
'
42
'
);
done
();
done
();
},
1
0
);
},
2
0
);
},
10
);
},
10
);
// 10ms is just long enough for the update hook to fire
// 10ms is just long enough for the update hook to fire
});
});
...
...
spec/javascripts/issue_show/mock_data.js
View file @
c50c5e92
...
@@ -15,4 +15,12 @@ export default {
...
@@ -15,4 +15,12 @@ export default {
issue_number
:
1
,
issue_number
:
1
,
task_status
:
'
0 of 0 completed
'
,
task_status
:
'
0 of 0 completed
'
,
},
},
issueSpecRequest
:
{
title
:
'
<p>this is a title</p>
'
,
title_text
:
'
this is a title
'
,
description
:
'
<li class="task-list-item enabled"><input type="checkbox" class="task-list-item-checkbox">Task List Item</li>
'
,
description_text
:
'
- [ ] Task List Item
'
,
issue_number
:
1
,
task_status
:
'
0 of 1 completed
'
,
},
};
};
spec/javascripts/issue_spec.js
View file @
c50c5e92
/* eslint-disable space-before-function-paren, one-var, one-var-declaration-per-line, no-use-before-define, comma-dangle, max-len */
/* eslint-disable space-before-function-paren, one-var, one-var-declaration-per-line, no-use-before-define, comma-dangle, max-len */
import
Issue
from
'
~/issue
'
;
import
Issue
from
'
~/issue
'
;
import
Vue
from
'
vue
'
;
import
'
~/render_math
'
;
import
'
~/render_gfm
'
;
import
IssueTitle
from
'
~/issue_show/issue_title_description.vue
'
;
import
issueShowData
from
'
./issue_show/mock_data
'
;
require
(
'
~/lib/utils/text_utility
'
);
require
(
'
~/lib/utils/text_utility
'
);
...
@@ -75,16 +80,53 @@ describe('Issue', function() {
...
@@ -75,16 +80,53 @@ describe('Issue', function() {
expect
(
$btnReopen
).
toHaveText
(
'
Reopen issue
'
);
expect
(
$btnReopen
).
toHaveText
(
'
Reopen issue
'
);
}
}
describe
(
'
task lists
'
,
function
()
{
fdescribe
(
'
task lists
'
,
function
()
{
const
issueShowInterceptor
=
data
=>
(
request
,
next
)
=>
{
next
(
request
.
respondWith
(
JSON
.
stringify
(
data
),
{
status
:
200
,
}));
};
beforeEach
(
function
()
{
beforeEach
(
function
()
{
loadFixtures
(
'
issues/issue-with-task-list.html.raw
'
);
loadFixtures
(
'
issues/issue-with-task-list.html.raw
'
);
this
.
issue
=
new
Issue
();
this
.
issue
=
new
Issue
();
Vue
.
http
.
interceptors
.
push
(
issueShowInterceptor
(
issueShowData
.
issueSpecRequest
));
});
afterEach
(
function
()
{
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptors
,
issueShowInterceptor
);
});
});
it
(
'
modifies the Markdown field
'
,
function
()
{
it
(
'
modifies the Markdown field
'
,
function
(
done
)
{
spyOn
(
jQuery
,
'
ajax
'
).
and
.
stub
();
// gotta actually render it for jquery to find elements
$
(
'
input[type=checkbox]
'
).
attr
(
'
checked
'
,
true
).
trigger
(
'
change
'
);
const
vm
=
new
Vue
({
expect
(
$
(
'
.js-task-list-field
'
).
val
()).
toBe
(
'
- [x] Task List Item
'
);
el
:
document
.
querySelector
(
'
.issue-title-entrypoint
'
),
components
:
{
IssueTitle
,
},
render
:
createElement
=>
createElement
(
IssueTitle
,
{
props
:
{
candescription
:
'
.js-task-list-container
'
,
endpoint
:
'
/gitlab-org/gitlab-shell/issues/9/rendered_title
'
,
},
}),
});
setTimeout
(()
=>
{
spyOn
(
jQuery
,
'
ajax
'
).
and
.
stub
();
const
description
=
'
<li class="task-list-item enabled"><input type="checkbox" class="task-list-item-checkbox"> Task List Item</li>
'
;
expect
(
document
.
querySelector
(
'
title
'
).
innerText
).
toContain
(
'
this is a title (#1)
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.title
'
).
innerHTML
).
toContain
(
'
<p>this is a title</p>
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.wiki
'
).
innerHTML
).
toContain
(
description
);
expect
(
vm
.
$el
.
querySelector
(
'
.js-task-list-field
'
).
value
).
toContain
(
'
- [ ] Task List Item
'
);
// somehow the dom does not have a closest `.js-task-list.field` to the `.task-list-item-checkbox`
$
(
'
input[type=checkbox]
'
).
attr
(
'
checked
'
,
true
).
trigger
(
'
change
'
);
expect
(
$
(
'
.js-task-list-field
'
).
val
()).
toBe
(
'
- [x] Task List Item
'
);
done
();
},
10
);
});
});
it
(
'
submits an ajax request on tasklist:changed
'
,
function
()
{
it
(
'
submits an ajax request on tasklist:changed
'
,
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