Fix skipping of user rendering for none and any
This commit is contained in:
parent
9023cf710c
commit
c8a5db349b
2 changed files with 28 additions and 6 deletions
|
@ -13,9 +13,9 @@ export default class VisualTokenValue {
|
||||||
}
|
}
|
||||||
|
|
||||||
render(tokenValueContainer, tokenValueElement) {
|
render(tokenValueContainer, tokenValueElement) {
|
||||||
const { tokenType } = this;
|
const { tokenType, tokenValue } = this;
|
||||||
|
|
||||||
if (['none', 'any'].includes(tokenType)) {
|
if (['none', 'any'].includes(tokenValue.toLowerCase())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -317,7 +317,18 @@ describe('Filtered Search Visual Tokens', () => {
|
||||||
it('does not update user token appearance for `none` filter', () => {
|
it('does not update user token appearance for `none` filter', () => {
|
||||||
const { subject, tokenValueContainer, tokenValueElement } = findElements(authorToken);
|
const { subject, tokenValueContainer, tokenValueElement } = findElements(authorToken);
|
||||||
|
|
||||||
subject.tokenType = 'none';
|
subject.tokenValue = 'none';
|
||||||
|
|
||||||
|
const { updateUserTokenAppearanceSpy } = setupSpies(subject);
|
||||||
|
subject.render(tokenValueContainer, tokenValueElement);
|
||||||
|
|
||||||
|
expect(updateUserTokenAppearanceSpy.calls.count()).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('does not update user token appearance for `None` filter', () => {
|
||||||
|
const { subject, tokenValueContainer, tokenValueElement } = findElements(authorToken);
|
||||||
|
|
||||||
|
subject.tokenValue = 'None';
|
||||||
|
|
||||||
const { updateUserTokenAppearanceSpy } = setupSpies(subject);
|
const { updateUserTokenAppearanceSpy } = setupSpies(subject);
|
||||||
subject.render(tokenValueContainer, tokenValueElement);
|
subject.render(tokenValueContainer, tokenValueElement);
|
||||||
|
@ -328,7 +339,7 @@ describe('Filtered Search Visual Tokens', () => {
|
||||||
it('does not update user token appearance for `any` filter', () => {
|
it('does not update user token appearance for `any` filter', () => {
|
||||||
const { subject, tokenValueContainer, tokenValueElement } = findElements(authorToken);
|
const { subject, tokenValueContainer, tokenValueElement } = findElements(authorToken);
|
||||||
|
|
||||||
subject.tokenType = 'any';
|
subject.tokenValue = 'any';
|
||||||
|
|
||||||
const { updateUserTokenAppearanceSpy } = setupSpies(subject);
|
const { updateUserTokenAppearanceSpy } = setupSpies(subject);
|
||||||
subject.render(tokenValueContainer, tokenValueElement);
|
subject.render(tokenValueContainer, tokenValueElement);
|
||||||
|
@ -336,10 +347,21 @@ describe('Filtered Search Visual Tokens', () => {
|
||||||
expect(updateUserTokenAppearanceSpy.calls.count()).toBe(0);
|
expect(updateUserTokenAppearanceSpy.calls.count()).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('does not update label token color for `None` filter', () => {
|
||||||
|
const { subject, tokenValueContainer, tokenValueElement } = findElements(bugLabelToken);
|
||||||
|
|
||||||
|
subject.tokenValue = 'None';
|
||||||
|
|
||||||
|
const { updateLabelTokenColorSpy } = setupSpies(subject);
|
||||||
|
subject.render(tokenValueContainer, tokenValueElement);
|
||||||
|
|
||||||
|
expect(updateLabelTokenColorSpy.calls.count()).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
it('does not update label token color for `none` filter', () => {
|
it('does not update label token color for `none` filter', () => {
|
||||||
const { subject, tokenValueContainer, tokenValueElement } = findElements(bugLabelToken);
|
const { subject, tokenValueContainer, tokenValueElement } = findElements(bugLabelToken);
|
||||||
|
|
||||||
subject.tokenType = 'none';
|
subject.tokenValue = 'none';
|
||||||
|
|
||||||
const { updateLabelTokenColorSpy } = setupSpies(subject);
|
const { updateLabelTokenColorSpy } = setupSpies(subject);
|
||||||
subject.render(tokenValueContainer, tokenValueElement);
|
subject.render(tokenValueContainer, tokenValueElement);
|
||||||
|
@ -350,7 +372,7 @@ describe('Filtered Search Visual Tokens', () => {
|
||||||
it('does not update label token color for `any` filter', () => {
|
it('does not update label token color for `any` filter', () => {
|
||||||
const { subject, tokenValueContainer, tokenValueElement } = findElements(bugLabelToken);
|
const { subject, tokenValueContainer, tokenValueElement } = findElements(bugLabelToken);
|
||||||
|
|
||||||
subject.tokenType = 'any';
|
subject.tokenValue = 'any';
|
||||||
|
|
||||||
const { updateLabelTokenColorSpy } = setupSpies(subject);
|
const { updateLabelTokenColorSpy } = setupSpies(subject);
|
||||||
subject.render(tokenValueContainer, tokenValueElement);
|
subject.render(tokenValueContainer, tokenValueElement);
|
||||||
|
|
Loading…
Reference in a new issue