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
Léo-Paul Géneau
gitlab-ce
Commits
670e9772
Commit
670e9772
authored
Nov 14, 2018
by
Heinrich Lee Yu
Committed by
Clement Ho
Nov 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable updating appearance of filter tokens for special values
parent
51c09c38
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
17 deletions
+54
-17
app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js
...ascripts/filtered_search/filtered_search_visual_tokens.js
+5
-4
changelogs/unreleased/53636-fix-rendering-of-any-user-filter.yml
...ogs/unreleased/53636-fix-rendering-of-any-user-filter.yml
+5
-0
spec/javascripts/filtered_search/filtered_search_visual_tokens_spec.js
...pts/filtered_search/filtered_search_visual_tokens_spec.js
+44
-13
No files found.
app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js
View file @
670e9772
...
...
@@ -135,10 +135,6 @@ export default class FilteredSearchVisualTokens {
}
static
updateUserTokenAppearance
(
tokenValueContainer
,
tokenValueElement
,
tokenValue
)
{
if
(
tokenValue
===
'
none
'
)
{
return
Promise
.
resolve
();
}
const
username
=
tokenValue
.
replace
(
/^@/
,
''
);
return
(
UsersCache
.
retrieve
(
username
)
...
...
@@ -184,7 +180,12 @@ export default class FilteredSearchVisualTokens {
const
tokenValueElement
=
tokenValueContainer
.
querySelector
(
'
.value
'
);
tokenValueElement
.
innerText
=
tokenValue
;
if
(
tokenValue
===
'
none
'
||
tokenValue
===
'
any
'
)
{
return
;
}
const
tokenType
=
tokenName
.
toLowerCase
();
if
(
tokenType
===
'
label
'
)
{
FilteredSearchVisualTokens
.
updateLabelTokenColor
(
tokenValueContainer
,
tokenValue
);
}
else
if
(
tokenType
===
'
author
'
||
tokenType
===
'
assignee
'
)
{
...
...
changelogs/unreleased/53636-fix-rendering-of-any-user-filter.yml
0 → 100644
View file @
670e9772
---
title
:
Fix rendering of filter bar tokens for special values
merge_request
:
22865
author
:
Heinrich Lee Yu
type
:
fixed
spec/javascripts/filtered_search/filtered_search_visual_tokens_spec.js
View file @
670e9772
...
...
@@ -754,6 +754,50 @@ describe('Filtered Search Visual Tokens', () => {
expect
(
updateLabelTokenColorSpy
.
calls
.
count
()).
toBe
(
0
);
expect
(
updateUserTokenAppearanceSpy
.
calls
.
count
()).
toBe
(
0
);
});
it
(
'
does not update user token appearance for `none` filter
'
,
()
=>
{
const
{
tokenNameElement
}
=
findElements
(
authorToken
);
const
tokenName
=
tokenNameElement
.
innerText
;
const
tokenValue
=
'
none
'
;
subject
.
renderVisualTokenValue
(
authorToken
,
tokenName
,
tokenValue
);
expect
(
updateUserTokenAppearanceSpy
.
calls
.
count
()).
toBe
(
0
);
});
it
(
'
does not update user token appearance for `any` filter
'
,
()
=>
{
const
{
tokenNameElement
}
=
findElements
(
authorToken
);
const
tokenName
=
tokenNameElement
.
innerText
;
const
tokenValue
=
'
any
'
;
subject
.
renderVisualTokenValue
(
authorToken
,
tokenName
,
tokenValue
);
expect
(
updateUserTokenAppearanceSpy
.
calls
.
count
()).
toBe
(
0
);
});
it
(
'
does not update label token color for `none` filter
'
,
()
=>
{
const
{
tokenNameElement
}
=
findElements
(
bugLabelToken
);
const
tokenName
=
tokenNameElement
.
innerText
;
const
tokenValue
=
'
none
'
;
subject
.
renderVisualTokenValue
(
bugLabelToken
,
tokenName
,
tokenValue
);
expect
(
updateLabelTokenColorSpy
.
calls
.
count
()).
toBe
(
0
);
});
it
(
'
does not update label token color for `any` filter
'
,
()
=>
{
const
{
tokenNameElement
}
=
findElements
(
bugLabelToken
);
const
tokenName
=
tokenNameElement
.
innerText
;
const
tokenValue
=
'
any
'
;
subject
.
renderVisualTokenValue
(
bugLabelToken
,
tokenName
,
tokenValue
);
expect
(
updateLabelTokenColorSpy
.
calls
.
count
()).
toBe
(
0
);
});
});
describe
(
'
updateUserTokenAppearance
'
,
()
=>
{
...
...
@@ -763,19 +807,6 @@ describe('Filtered Search Visual Tokens', () => {
spyOn
(
UsersCache
,
'
retrieve
'
).
and
.
callFake
(
username
=>
usersCacheSpy
(
username
));
});
it
(
'
ignores special value "none"
'
,
done
=>
{
usersCacheSpy
=
username
=>
{
expect
(
username
).
toBe
(
'
none
'
);
done
.
fail
(
'
Should not resolve "none"!
'
);
};
const
{
tokenValueContainer
,
tokenValueElement
}
=
findElements
(
authorToken
);
subject
.
updateUserTokenAppearance
(
tokenValueContainer
,
tokenValueElement
,
'
none
'
)
.
then
(
done
)
.
catch
(
done
.
fail
);
});
it
(
'
ignores error if UsersCache throws
'
,
done
=>
{
spyOn
(
window
,
'
Flash
'
);
const
dummyError
=
new
Error
(
'
Earth rotated backwards
'
);
...
...
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