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
c372787e
Commit
c372787e
authored
Nov 22, 2017
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add karma specs
parent
01c73980
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
40 deletions
+74
-40
spec/javascripts/issue_show/components/app_spec.js
spec/javascripts/issue_show/components/app_spec.js
+13
-2
spec/javascripts/issue_show/components/description_spec.js
spec/javascripts/issue_show/components/description_spec.js
+61
-38
No files found.
spec/javascripts/issue_show/components/app_spec.js
View file @
c372787e
...
@@ -38,8 +38,8 @@ describe('Issuable output', () => {
...
@@ -38,8 +38,8 @@ describe('Issuable output', () => {
issuableRef
:
'
#1
'
,
issuableRef
:
'
#1
'
,
initialTitleHtml
:
''
,
initialTitleHtml
:
''
,
initialTitleText
:
''
,
initialTitleText
:
''
,
initialDescriptionHtml
:
''
,
initialDescriptionHtml
:
'
test
'
,
initialDescriptionText
:
''
,
initialDescriptionText
:
'
test
'
,
markdownPreviewPath
:
'
/
'
,
markdownPreviewPath
:
'
/
'
,
markdownDocsPath
:
'
/
'
,
markdownDocsPath
:
'
/
'
,
projectNamespace
:
'
/
'
,
projectNamespace
:
'
/
'
,
...
@@ -366,4 +366,15 @@ describe('Issuable output', () => {
...
@@ -366,4 +366,15 @@ describe('Issuable output', () => {
expect
(
vm
.
$el
.
querySelector
(
'
.title-container .note-action-button
'
)).
toBeDefined
();
expect
(
vm
.
$el
.
querySelector
(
'
.title-container .note-action-button
'
)).
toBeDefined
();
});
});
});
});
describe
(
'
update url
'
,
()
=>
{
it
(
'
sets update url in description textarea
'
,
(
done
)
=>
{
vm
.
showForm
=
true
;
vm
.
canUpdate
=
false
;
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-task-list-field
'
).
dataset
.
updateUrl
).
toEqual
(
`
${
vm
.
endpoint
}
.json`
);
done
();
});
});
});
});
});
spec/javascripts/issue_show/components/description_spec.js
View file @
c372787e
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
descriptionComponent
from
'
~/issue_show/components/description.vue
'
;
import
descriptionComponent
from
'
~/issue_show/components/description.vue
'
;
import
*
as
taskList
from
'
~/task_list
'
;
import
mountComponent
from
'
../../helpers/vue_mount_component_helper
'
;
describe
(
'
Description component
'
,
()
=>
{
describe
(
'
Description component
'
,
()
=>
{
let
vm
;
let
vm
;
let
DescriptionComponent
;
const
props
=
{
canUpdate
:
true
,
descriptionHtml
:
'
test
'
,
descriptionText
:
'
test
'
,
updatedAt
:
new
Date
().
toString
(),
taskStatus
:
''
,
updateUrl
:
gl
.
TEST_HOST
,
};
beforeEach
(()
=>
{
beforeEach
(()
=>
{
const
Component
=
Vue
.
extend
(
descriptionComponent
);
Description
Component
=
Vue
.
extend
(
descriptionComponent
);
if
(
!
document
.
querySelector
(
'
.issuable-meta
'
))
{
if
(
!
document
.
querySelector
(
'
.issuable-meta
'
))
{
const
metaData
=
document
.
createElement
(
'
div
'
);
const
metaData
=
document
.
createElement
(
'
div
'
);
...
@@ -15,15 +26,11 @@ describe('Description component', () => {
...
@@ -15,15 +26,11 @@ describe('Description component', () => {
document
.
body
.
appendChild
(
metaData
);
document
.
body
.
appendChild
(
metaData
);
}
}
vm
=
new
Component
({
vm
=
mountComponent
(
DescriptionComponent
,
props
);
propsData
:
{
});
canUpdate
:
true
,
descriptionHtml
:
'
test
'
,
afterEach
(()
=>
{
descriptionText
:
'
test
'
,
vm
.
$destroy
;
updatedAt
:
new
Date
().
toString
(),
taskStatus
:
''
,
},
}).
$mount
();
});
});
it
(
'
animates description changes
'
,
(
done
)
=>
{
it
(
'
animates description changes
'
,
(
done
)
=>
{
...
@@ -44,34 +51,46 @@ describe('Description component', () => {
...
@@ -44,34 +51,46 @@ describe('Description component', () => {
});
});
});
});
// TODO: gl.TaskList no longer exists. rewrite these tests once we have a way to rewire ES modules
describe
(
'
TaskList
'
,
()
=>
{
beforeEach
(()
=>
{
// it('re-inits the TaskList when description changed', (done) => {
vm
=
mountComponent
(
DescriptionComponent
,
Object
.
assign
({},
props
,
{
// spyOn(gl, 'TaskList');
issuableType
:
'
issuableType
'
,
// vm.descriptionHtml = 'changed';
}));
//
spyOn
(
taskList
,
'
default
'
);
// setTimeout(() => {
});
// expect(
// gl.TaskList,
it
(
'
re-inits the TaskList when description changed
'
,
(
done
)
=>
{
// ).toHaveBeenCalled();
vm
.
descriptionHtml
=
'
changed
'
;
//
// done();
setTimeout
(()
=>
{
// });
expect
(
taskList
.
default
).
toHaveBeenCalled
();
// });
done
();
});
// it('does not re-init the TaskList when canUpdate is false', (done) => {
});
// spyOn(gl, 'TaskList');
// vm.canUpdate = false;
it
(
'
does not re-init the TaskList when canUpdate is false
'
,
(
done
)
=>
{
// vm.descriptionHtml = 'changed';
vm
.
canUpdate
=
false
;
//
vm
.
descriptionHtml
=
'
changed
'
;
// setTimeout(() => {
// expect(
setTimeout
(()
=>
{
// gl.TaskList,
expect
(
taskList
.
default
).
not
.
toHaveBeenCalled
();
// ).not.toHaveBeenCalled();
done
();
//
});
// done();
});
// });
// });
it
(
'
calls with issuableType dataType
'
,
(
done
)
=>
{
vm
.
descriptionHtml
=
'
changed
'
;
setTimeout
(()
=>
{
expect
(
taskList
.
default
).
toHaveBeenCalledWith
({
dataType
:
'
issuableType
'
,
fieldName
:
'
description
'
,
selector
:
'
.detail-page-description
'
,
});
done
();
});
});
});
describe
(
'
taskStatus
'
,
()
=>
{
describe
(
'
taskStatus
'
,
()
=>
{
it
(
'
adds full taskStatus
'
,
(
done
)
=>
{
it
(
'
adds full taskStatus
'
,
(
done
)
=>
{
...
@@ -126,4 +145,8 @@ describe('Description component', () => {
...
@@ -126,4 +145,8 @@ describe('Description component', () => {
});
});
});
});
});
});
it
(
'
sets data-update-url
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
textarea
'
).
dataset
.
updateUrl
).
toEqual
(
gl
.
TEST_HOST
);
});
});
});
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