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
9ebfeebc
Commit
9ebfeebc
authored
Jan 25, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
f825dc59
f4386181
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
19 deletions
+43
-19
spec/javascripts/notes/components/note_actions_spec.js
spec/javascripts/notes/components/note_actions_spec.js
+33
-19
spec/javascripts/test_bundle.js
spec/javascripts/test_bundle.js
+10
-0
No files found.
spec/javascripts/notes/components/note_actions_spec.js
View file @
9ebfeebc
import
Vue
from
'
vue
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
createStore
from
'
~/notes/stores
'
;
import
noteActions
from
'
~/notes/components/note_actions.vue
'
;
import
{
userDataMock
}
from
'
../mock_data
'
;
describe
(
'
issue_note_actions component
'
,
()
=>
{
let
vm
;
describe
(
'
noteActions
'
,
()
=>
{
let
wrapper
;
let
store
;
let
Component
;
beforeEach
(()
=>
{
Component
=
Vue
.
extend
(
noteActions
);
store
=
createStore
();
});
afterEach
(()
=>
{
vm
.
$
destroy
();
wrapper
.
destroy
();
});
describe
(
'
user is logged in
'
,
()
=>
{
...
...
@@ -36,45 +35,57 @@ describe('issue_note_actions component', () => {
store
.
dispatch
(
'
setUserData
'
,
userDataMock
);
vm
=
new
Component
({
const
localVue
=
createLocalVue
();
wrapper
=
shallowMount
(
noteActions
,
{
store
,
propsData
:
props
,
}).
$mount
();
localVue
,
sync
:
false
,
});
});
it
(
'
should render access level badge
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.note-role
'
).
textContent
.
trim
()).
toEqual
(
props
.
accessLevel
);
expect
(
wrapper
.
find
(
'
.note-role
'
)
.
text
()
.
trim
(),
).
toEqual
(
props
.
accessLevel
);
});
it
(
'
should render emoji link
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-add-award
'
)).
toBeDefined
(
);
expect
(
wrapper
.
find
(
'
.js-add-award
'
).
exists
()).
toBe
(
true
);
});
describe
(
'
actions dropdown
'
,
()
=>
{
it
(
'
should be possible to edit the comment
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-note-edit
'
)).
toBeDefined
(
);
expect
(
wrapper
.
find
(
'
.js-note-edit
'
).
exists
()).
toBe
(
true
);
});
it
(
'
should be possible to report abuse to GitLab
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
`a[href="
${
props
.
reportAbusePath
}
"]`
)).
toBeDefined
(
);
expect
(
wrapper
.
find
(
`a[href="
${
props
.
reportAbusePath
}
"]`
).
exists
()).
toBe
(
true
);
});
it
(
'
should be possible to copy link to a note
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-btn-copy-note-link
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-btn-copy-note-link
'
).
exists
()).
toBe
(
true
);
});
it
(
'
should not show copy link action when `noteUrl` prop is empty
'
,
done
=>
{
vm
.
noteUrl
=
''
;
wrapper
.
setProps
({
...
props
,
noteUrl
:
''
,
});
Vue
.
nextTick
()
.
then
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-btn-copy-note-link
'
)).
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-btn-copy-note-link
'
).
exists
()).
toBe
(
false
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
it
(
'
should be possible to delete comment
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-note-delete
'
)).
toBeDefined
(
);
expect
(
wrapper
.
find
(
'
.js-note-delete
'
).
exists
()).
toBe
(
true
);
});
});
});
...
...
@@ -96,18 +107,21 @@ describe('issue_note_actions component', () => {
reportAbusePath
:
'
/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F7%23note_539&user_id=26
'
,
};
vm
=
new
Component
({
const
localVue
=
createLocalVue
();
wrapper
=
shallowMount
(
noteActions
,
{
store
,
propsData
:
props
,
}).
$mount
();
localVue
,
sync
:
false
,
});
});
it
(
'
should not render emoji link
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-add-award
'
)).
toEqual
(
null
);
expect
(
wrapper
.
find
(
'
.js-add-award
'
).
exists
()).
toBe
(
false
);
});
it
(
'
should not render actions dropdown
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.more-actions
'
)).
toEqual
(
null
);
expect
(
wrapper
.
find
(
'
.more-actions
'
).
exists
()).
toBe
(
false
);
});
});
});
spec/javascripts/test_bundle.js
View file @
9ebfeebc
...
...
@@ -21,6 +21,16 @@ Vue.config.productionTip = false;
let
hasVueWarnings
=
false
;
Vue
.
config
.
warnHandler
=
(
msg
,
vm
,
trace
)
=>
{
// The following workaround is necessary, so we are able to use setProps from Vue test utils
// see https://github.com/vuejs/vue-test-utils/issues/631#issuecomment-421108344
const
currentStack
=
new
Error
().
stack
;
const
isInVueTestUtils
=
currentStack
.
split
(
'
\n
'
)
.
some
(
line
=>
line
.
startsWith
(
'
at VueWrapper.setProps (
'
));
if
(
isInVueTestUtils
)
{
return
;
}
hasVueWarnings
=
true
;
fail
(
`
${
msg
}${
trace
}
`
);
};
...
...
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