diff --git a/ui/app/helpers/is-wildcard-string.js b/ui/app/helpers/is-wildcard-string.js index 4e4f667432..f103574146 100644 --- a/ui/app/helpers/is-wildcard-string.js +++ b/ui/app/helpers/is-wildcard-string.js @@ -6,7 +6,11 @@ export function isWildcardString([string]) { } // string is actually an object which is what comes in in the searchSelect component if (typeof string === 'object') { - string = Object.values(string)[0]; + // if the dropdown is used the object is a class which cannot be converted into a string + if (Object.prototype.hasOwnProperty.call(string, 'store')) { + return false; + } + string = Object.values(string).toString(); } return string.includes('*'); diff --git a/ui/tests/unit/helpers/is-wildcard-string-test.js b/ui/tests/unit/helpers/is-wildcard-string-test.js index a2257f652a..8cfee21da9 100644 --- a/ui/tests/unit/helpers/is-wildcard-string-test.js +++ b/ui/tests/unit/helpers/is-wildcard-string-test.js @@ -26,9 +26,15 @@ module('Unit | Helpers | is-wildcard-string', function() { assert.equal(result, true); }); - test('it returns true if string object has name and id with with at least one wildcard', function(assert) { + test('it returns true if string object has name and id with at least one wildcard', function(assert) { let string = { id: '7*', name: 'seven' }; let result = isWildcardString([string]); assert.equal(result, true); }); + + test('it returns true if string object has name and id with wildcard in name not id', function(assert) { + let string = { id: '7', name: 'sev*n' }; + let result = isWildcardString([string]); + assert.equal(result, true); + }); });