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
Boxiang Sun
gitlab-ce
Commits
dfd0e100
Commit
dfd0e100
authored
Mar 07, 2017
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix edit last visual token
parent
f44fb5cf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
6 deletions
+19
-6
app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js
...ascripts/filtered_search/filtered_search_visual_tokens.js
+2
-2
spec/javascripts/filtered_search/filtered_search_visual_tokens_spec.js
...pts/filtered_search/filtered_search_visual_tokens_spec.js
+15
-2
spec/javascripts/helpers/filtered_search_spec_helper.js
spec/javascripts/helpers/filtered_search_spec_helper.js
+2
-2
No files found.
app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js
View file @
dfd0e100
...
...
@@ -178,9 +178,9 @@ class FilteredSearchVisualTokens {
const
inputLi
=
input
.
parentElement
;
const
tokenContainer
=
document
.
querySelector
(
'
.tokens-container
'
);
if
(
!
tokenContainer
.
lastElementChild
.
isEqualNode
(
inputLi
))
{
FilteredSearchVisualTokens
.
tokenizeInput
();
FilteredSearchVisualTokens
.
tokenizeInput
();
if
(
!
tokenContainer
.
lastElementChild
.
isEqualNode
(
inputLi
))
{
const
{
isLastVisualTokenValid
}
=
gl
.
FilteredSearchVisualTokens
.
getLastVisualTokenBeforeInput
();
...
...
spec/javascripts/filtered_search/filtered_search_visual_tokens_spec.js
View file @
dfd0e100
...
...
@@ -533,12 +533,12 @@ describe('Filtered Search Visual Tokens', () => {
FilteredSearchSpecHelper
.
createFilterVisualTokenHTML
(
'
label
'
,
'
none
'
),
);
spyOn
(
gl
.
FilteredSearchVisualTokens
,
'
tokenizeInput
'
).
and
.
call
Through
(
);
spyOn
(
gl
.
FilteredSearchVisualTokens
,
'
tokenizeInput
'
).
and
.
call
Fake
(()
=>
{}
);
spyOn
(
gl
.
FilteredSearchVisualTokens
,
'
getLastVisualTokenBeforeInput
'
).
and
.
callThrough
();
gl
.
FilteredSearchVisualTokens
.
moveInputToTheRight
();
expect
(
gl
.
FilteredSearchVisualTokens
.
tokenizeInput
).
not
.
toHaveBeenCalled
();
expect
(
gl
.
FilteredSearchVisualTokens
.
tokenizeInput
).
toHaveBeenCalled
();
expect
(
gl
.
FilteredSearchVisualTokens
.
getLastVisualTokenBeforeInput
).
not
.
toHaveBeenCalled
();
});
...
...
@@ -583,5 +583,18 @@ describe('Filtered Search Visual Tokens', () => {
expect
(
tokensContainer
.
children
[
2
].
querySelector
(
'
.filtered-search
'
)).
not
.
toEqual
(
null
);
});
it
(
'
tokenizes input even if input is the right most element
'
,
()
=>
{
tokensContainer
.
innerHTML
=
`
${
FilteredSearchSpecHelper
.
createFilterVisualTokenHTML
(
'
label
'
,
'
none
'
)}
${
FilteredSearchSpecHelper
.
createNameFilterVisualTokenHTML
(
'
label
'
)}
${
FilteredSearchSpecHelper
.
createInputHTML
(
''
,
'
~bug
'
)}
`
;
gl
.
FilteredSearchVisualTokens
.
moveInputToTheRight
();
const
token
=
tokensContainer
.
children
[
1
];
expect
(
token
.
querySelector
(
'
.value
'
).
innerText
).
toEqual
(
'
~bug
'
);
});
});
});
spec/javascripts/helpers/filtered_search_spec_helper.js
View file @
dfd0e100
...
...
@@ -33,10 +33,10 @@ class FilteredSearchSpecHelper {
`
;
}
static
createInputHTML
(
placeholder
=
''
)
{
static
createInputHTML
(
placeholder
=
''
,
value
=
''
)
{
return
`
<li class="input-token">
<input type='text' class='filtered-search' placeholder='
${
placeholder
}
' />
<input type='text' class='filtered-search' placeholder='
${
placeholder
}
'
value='
${
value
}
'
/>
</li>
`
;
}
...
...
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