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
f6df1357
Commit
f6df1357
authored
May 02, 2017
by
Regis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test realtime changes and hit more branches
parent
290cba5b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
26 deletions
+37
-26
spec/javascripts/issue_show/issue_title_description_spec.js
spec/javascripts/issue_show/issue_title_description_spec.js
+21
-20
spec/javascripts/issue_show/mock_data.js
spec/javascripts/issue_show/mock_data.js
+16
-6
No files found.
spec/javascripts/issue_show/issue_title_description_spec.js
View file @
f6df1357
...
...
@@ -7,9 +7,12 @@ import issueShowData from './mock_data';
window
.
$
=
$
;
const
issueShowInterceptor
=
(
request
,
next
)
=>
{
next
(
request
.
respondWith
(
JSON
.
stringify
(
issueShowD
ata
),
{
const
issueShowInterceptor
=
data
=>
(
request
,
next
)
=>
{
next
(
request
.
respondWith
(
JSON
.
stringify
(
d
ata
),
{
status
:
200
,
headers
:
{
'
POLL-INTERVAL
'
:
1
,
},
}));
};
...
...
@@ -22,16 +25,15 @@ describe('Issue Title', () => {
beforeEach
(()
=>
{
comps
.
IssueTitleComponent
=
Vue
.
extend
(
issueTitle
);
Vue
.
http
.
interceptors
.
push
(
issueShowInterceptor
);
});
afterEach
(()
=>
{
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptors
,
issueShowInterceptor
,
);
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptors
,
issueShowInterceptor
);
});
it
(
'
should render a title
'
,
(
done
)
=>
{
it
(
'
should render a title/description and update title/description on update
'
,
(
done
)
=>
{
Vue
.
http
.
interceptors
.
push
(
issueShowInterceptor
(
issueShowData
.
initialRequest
));
const
issueShowComponent
=
new
comps
.
IssueTitleComponent
({
propsData
:
{
candescription
:
'
.css-stuff
'
,
...
...
@@ -41,22 +43,21 @@ describe('Issue Title', () => {
// need setTimeout because actual setTimeout in code :P
setTimeout
(()
=>
{
expect
(
document
.
querySelector
(
'
title
'
).
innerText
)
.
toContain
(
'
this is a title (#1)
'
);
expect
(
issueShowComponent
.
$el
.
querySelector
(
'
.title
'
).
innerHTML
)
.
toContain
(
'
<p>this is a title</p>
'
);
expect
(
issueShowComponent
.
$el
.
querySelector
(
'
.wiki
'
).
innerHTML
)
.
toContain
(
'
<p>this is a description!</p>
'
);
expect
(
document
.
querySelector
(
'
title
'
).
innerText
).
toContain
(
'
this is a title (#1)
'
);
expect
(
issueShowComponent
.
$el
.
querySelector
(
'
.title
'
).
innerHTML
).
toContain
(
'
<p>this is a title</p>
'
);
expect
(
issueShowComponent
.
$el
.
querySelector
(
'
.wiki
'
).
innerHTML
).
toContain
(
'
<p>this is a description!</p>
'
);
expect
(
issueShowComponent
.
$el
.
querySelector
(
'
.js-task-list-field
'
).
innerText
).
toContain
(
'
this is a description
'
);
const
hiddenText
=
issueShowComponent
.
$el
.
querySelector
(
'
.js-task-list-field
'
).
innerText
;
Vue
.
http
.
interceptors
.
push
(
issueShowInterceptor
(
issueShowData
.
secondRequest
));
expect
(
hiddenText
)
.
toContain
(
'
this is a description
'
);
setTimeout
(()
=>
{
expect
(
document
.
querySelector
(
'
title
'
).
innerText
).
toContain
(
'
2 (#1)
'
);
expect
(
issueShowComponent
.
$el
.
querySelector
(
'
.title
'
).
innerHTML
).
toContain
(
'
<p>2</p>
'
);
expect
(
issueShowComponent
.
$el
.
querySelector
(
'
.wiki
'
).
innerHTML
).
toContain
(
'
<p>42</p>
'
);
expect
(
issueShowComponent
.
$el
.
querySelector
(
'
.js-task-list-field
'
).
innerText
).
toContain
(
'
42
'
);
done
();
done
();
},
10
);
},
10
);
// 10ms is just long enough for the update hook to fire
});
...
...
spec/javascripts/issue_show/mock_data.js
View file @
f6df1357
export
default
{
title
:
'
<p>this is a title</p>
'
,
title_text
:
'
this is a title
'
,
description
:
'
<p>this is a description!</p>
'
,
description_text
:
'
this is a description
'
,
issue_number
:
1
,
task_status
:
'
2/4 completed
'
,
initialRequest
:
{
title
:
'
<p>this is a title</p>
'
,
title_text
:
'
this is a title
'
,
description
:
'
<p>this is a description!</p>
'
,
description_text
:
'
this is a description
'
,
issue_number
:
1
,
task_status
:
'
2 of 4 completed
'
,
},
secondRequest
:
{
title
:
'
<p>2</p>
'
,
title_text
:
'
2
'
,
description
:
'
<p>42</p>
'
,
description_text
:
'
42
'
,
issue_number
:
1
,
task_status
:
'
0 of 0 completed
'
,
},
};
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