BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
ed49a8e3
Commit
ed49a8e3
authored
Mar 08, 2017
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-edit-last-visual-token' into 'master'
Fix edit last visual token See merge request !9791
parents
b87d5c88
dfd0e100
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
5 deletions
+18
-5
filtered_search_visual_tokens.js
...ascripts/filtered_search/filtered_search_visual_tokens.js
+1
-1
filtered_search_visual_tokens_spec.js
...pts/filtered_search/filtered_search_visual_tokens_spec.js
+15
-2
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 @
ed49a8e3
...
@@ -178,9 +178,9 @@ class FilteredSearchVisualTokens {
...
@@ -178,9 +178,9 @@ class FilteredSearchVisualTokens {
const
inputLi
=
input
.
parentElement
;
const
inputLi
=
input
.
parentElement
;
const
tokenContainer
=
document
.
querySelector
(
'.tokens-container'
);
const
tokenContainer
=
document
.
querySelector
(
'.tokens-container'
);
if
(
!
tokenContainer
.
lastElementChild
.
isEqualNode
(
inputLi
))
{
FilteredSearchVisualTokens
.
tokenizeInput
();
FilteredSearchVisualTokens
.
tokenizeInput
();
if
(
!
tokenContainer
.
lastElementChild
.
isEqualNode
(
inputLi
))
{
const
{
isLastVisualTokenValid
}
=
const
{
isLastVisualTokenValid
}
=
gl
.
FilteredSearchVisualTokens
.
getLastVisualTokenBeforeInput
();
gl
.
FilteredSearchVisualTokens
.
getLastVisualTokenBeforeInput
();
...
...
spec/javascripts/filtered_search/filtered_search_visual_tokens_spec.js
View file @
ed49a8e3
...
@@ -533,12 +533,12 @@ describe('Filtered Search Visual Tokens', () => {
...
@@ -533,12 +533,12 @@ describe('Filtered Search Visual Tokens', () => {
FilteredSearchSpecHelper
.
createFilterVisualTokenHTML
(
'label'
,
'none'
),
FilteredSearchSpecHelper
.
createFilterVisualTokenHTML
(
'label'
,
'none'
),
);
);
spyOn
(
gl
.
FilteredSearchVisualTokens
,
'tokenizeInput'
).
and
.
call
Through
(
);
spyOn
(
gl
.
FilteredSearchVisualTokens
,
'tokenizeInput'
).
and
.
call
Fake
(()
=>
{}
);
spyOn
(
gl
.
FilteredSearchVisualTokens
,
'getLastVisualTokenBeforeInput'
).
and
.
callThrough
();
spyOn
(
gl
.
FilteredSearchVisualTokens
,
'getLastVisualTokenBeforeInput'
).
and
.
callThrough
();
gl
.
FilteredSearchVisualTokens
.
moveInputToTheRight
();
gl
.
FilteredSearchVisualTokens
.
moveInputToTheRight
();
expect
(
gl
.
FilteredSearchVisualTokens
.
tokenizeInput
).
not
.
toHaveBeenCalled
();
expect
(
gl
.
FilteredSearchVisualTokens
.
tokenizeInput
).
toHaveBeenCalled
();
expect
(
gl
.
FilteredSearchVisualTokens
.
getLastVisualTokenBeforeInput
).
not
.
toHaveBeenCalled
();
expect
(
gl
.
FilteredSearchVisualTokens
.
getLastVisualTokenBeforeInput
).
not
.
toHaveBeenCalled
();
});
});
...
@@ -583,5 +583,18 @@ describe('Filtered Search Visual Tokens', () => {
...
@@ -583,5 +583,18 @@ describe('Filtered Search Visual Tokens', () => {
expect
(
tokensContainer
.
children
[
2
].
querySelector
(
'.filtered-search'
)).
not
.
toEqual
(
null
);
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 @
ed49a8e3
...
@@ -33,10 +33,10 @@ class FilteredSearchSpecHelper {
...
@@ -33,10 +33,10 @@ class FilteredSearchSpecHelper {
`
;
`
;
}
}
static
createInputHTML
(
placeholder
=
''
)
{
static
createInputHTML
(
placeholder
=
''
,
value
=
''
)
{
return
`
return
`
<li class="input-token">
<li class="input-token">
<input type='text' class='filtered-search' placeholder='
${
placeholder
}
' />
<input type='text' class='filtered-search' placeholder='
${
placeholder
}
'
value='
${
value
}
'
/>
</li>
</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