fix wildcard error for class on select dropdown (#9909)

This commit is contained in:
Angel Garbarino 2020-09-08 14:24:27 -06:00 committed by GitHub
parent 790715719b
commit b2b7626956
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -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('*');

View File

@ -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);
});
});