Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pleroma-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pleroma
pleroma-fe
Commits
836cb817
Commit
836cb817
authored
5 years ago
by
HJ
Browse files
Options
Downloads
Patches
Plain Diff
fix tests
parent
a3305799
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!1028
`master` refresh with `develop`
,
!895
Emoji selector update
Pipeline
#17642
passed
5 years ago
Stage: lint
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/unit/specs/components/emoji_input.spec.js
+17
-8
17 additions, 8 deletions
test/unit/specs/components/emoji_input.spec.js
with
17 additions
and
8 deletions
test/unit/specs/components/emoji_input.spec.js
+
17
−
8
View file @
836cb817
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
import
EmojiInput
from
'
src/components/emoji_input/emoji_input.vue
'
const
generateInput
=
(
value
)
=>
{
const
generateInput
=
(
value
,
padEmoji
=
true
)
=>
{
const
localVue
=
createLocalVue
()
localVue
.
directive
(
'
click-outside
'
,
()
=>
{})
const
wrapper
=
shallowMount
(
EmojiInput
,
{
...
...
@@ -10,6 +10,15 @@ const generateInput = (value) => {
enableEmojiPicker
:
true
,
value
},
mocks
:
{
$store
:
{
state
:
{
config
:
{
padEmoji
}
}
}
},
slots
:
{
default
:
'
<input />
'
},
...
...
@@ -70,13 +79,13 @@ describe('EmojiInput', () => {
expect
(
wrapper
.
emitted
().
input
[
0
][
0
]).
to
.
eql
(
'
Spurdo :ebin: Sparde
'
)
})
it
(
'
inserts string without any padding i
n spam mod
e
'
,
()
=>
{
it
(
'
inserts string without any padding i
f padEmoji setting is set to fals
e
'
,
()
=>
{
const
initialString
=
'
Eat some spam!
'
const
[
wrapper
]
=
generateInput
(
initialString
)
const
[
wrapper
]
=
generateInput
(
initialString
,
false
)
const
input
=
wrapper
.
find
(
'
input
'
)
input
.
setValue
(
initialString
)
wrapper
.
setData
({
caret
:
initialString
.
length
})
wrapper
.
vm
.
insert
({
insertion
:
'
:spam:
'
,
keepOpen
:
true
})
wrapper
.
setData
({
caret
:
initialString
.
length
,
keepOpen
:
false
})
wrapper
.
vm
.
insert
({
insertion
:
'
:spam:
'
})
expect
(
wrapper
.
emitted
().
input
[
0
][
0
]).
to
.
eql
(
'
Eat some spam!:spam:
'
)
})
...
...
@@ -106,13 +115,13 @@ describe('EmojiInput', () => {
})
})
it
(
'
correctly sets caret after insertion i
n spam mod
e
'
,
(
done
)
=>
{
it
(
'
correctly sets caret after insertion i
f padEmoji setting is set to fals
e
'
,
(
done
)
=>
{
const
initialString
=
'
1234
'
const
[
wrapper
,
vue
]
=
generateInput
(
initialString
)
const
[
wrapper
,
vue
]
=
generateInput
(
initialString
,
false
)
const
input
=
wrapper
.
find
(
'
input
'
)
input
.
setValue
(
initialString
)
wrapper
.
setData
({
caret
:
initialString
.
length
})
wrapper
.
vm
.
insert
({
insertion
:
'
1234
'
,
keepOpen
:
tru
e
})
wrapper
.
vm
.
insert
({
insertion
:
'
1234
'
,
keepOpen
:
fals
e
})
vue
.
nextTick
(()
=>
{
expect
(
wrapper
.
vm
.
caret
).
to
.
eql
(
8
)
done
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment