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
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
Show 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';
...
@@ -7,9 +7,12 @@ import issueShowData from './mock_data';
window
.
$
=
$
;
window
.
$
=
$
;
const
issueShowInterceptor
=
(
request
,
next
)
=>
{
const
issueShowInterceptor
=
data
=>
(
request
,
next
)
=>
{
next
(
request
.
respondWith
(
JSON
.
stringify
(
issueShowD
ata
),
{
next
(
request
.
respondWith
(
JSON
.
stringify
(
d
ata
),
{
status
:
200
,
status
:
200
,
headers
:
{
'
POLL-INTERVAL
'
:
1
,
},
}));
}));
};
};
...
@@ -22,16 +25,15 @@ describe('Issue Title', () => {
...
@@ -22,16 +25,15 @@ describe('Issue Title', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
comps
.
IssueTitleComponent
=
Vue
.
extend
(
issueTitle
);
comps
.
IssueTitleComponent
=
Vue
.
extend
(
issueTitle
);
Vue
.
http
.
interceptors
.
push
(
issueShowInterceptor
);
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptors
,
issueShowInterceptor
);
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
({
const
issueShowComponent
=
new
comps
.
IssueTitleComponent
({
propsData
:
{
propsData
:
{
candescription
:
'
.css-stuff
'
,
candescription
:
'
.css-stuff
'
,
...
@@ -41,23 +43,22 @@ describe('Issue Title', () => {
...
@@ -41,23 +43,22 @@ describe('Issue Title', () => {
// need setTimeout because actual setTimeout in code :P
// need setTimeout because actual setTimeout in code :P
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
document
.
querySelector
(
'
title
'
).
innerText
)
expect
(
document
.
querySelector
(
'
title
'
).
innerText
).
toContain
(
'
this is a title (#1)
'
);
.
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
(
'
.title
'
).
innerHTML
)
expect
(
issueShowComponent
.
$el
.
querySelector
(
'
.js-task-list-field
'
).
innerText
).
toContain
(
'
this is a description
'
);
.
toContain
(
'
<p>this is a title</p>
'
);
expect
(
issueShowComponent
.
$el
.
querySelector
(
'
.wiki
'
).
innerHTML
)
Vue
.
http
.
interceptors
.
push
(
issueShowInterceptor
(
issueShowData
.
secondRequest
));
.
toContain
(
'
<p>this is a description!</p>
'
);
const
hiddenText
=
issueShowComponent
.
$el
setTimeout
(()
=>
{
.
querySelector
(
'
.js-task-list-field
'
).
innerText
;
expect
(
document
.
querySelector
(
'
title
'
).
innerText
).
toContain
(
'
2 (#1)
'
)
;
expect
(
issueShowComponent
.
$el
.
querySelector
(
'
.title
'
).
innerHTML
).
toContain
(
'
<p>2</p>
'
);
expect
(
hiddenText
)
expect
(
issueShowComponent
.
$el
.
querySelector
(
'
.wiki
'
).
innerHTML
).
toContain
(
'
<p>42</p>
'
);
.
toContain
(
'
this is a description
'
);
expect
(
issueShowComponent
.
$el
.
querySelector
(
'
.js-task-list-field
'
).
innerText
).
toContain
(
'
42
'
);
done
();
done
();
},
10
);
},
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 @
f6df1357
export
default
{
export
default
{
initialRequest
:
{
title
:
'
<p>this is a title</p>
'
,
title
:
'
<p>this is a title</p>
'
,
title_text
:
'
this is a title
'
,
title_text
:
'
this is a title
'
,
description
:
'
<p>this is a description!</p>
'
,
description
:
'
<p>this is a description!</p>
'
,
description_text
:
'
this is a description
'
,
description_text
:
'
this is a description
'
,
issue_number
:
1
,
issue_number
:
1
,
task_status
:
'
2/4 completed
'
,
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