mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
add additional merge params test, remove unnecessary span container from search chips
This commit is contained in:
parent
fd91c8e329
commit
697b0c634d
@ -187,13 +187,13 @@ class Search extends React.Component {
|
|||||||
queryParams[key].forEach(val =>
|
queryParams[key].forEach(val =>
|
||||||
queryParamsByKey[columnKey].chips.push({
|
queryParamsByKey[columnKey].chips.push({
|
||||||
key: `${key}:${val}`,
|
key: `${key}:${val}`,
|
||||||
node: <span>{getLabelFromValue(val, columnKey)}</span>,
|
node: getLabelFromValue(val, columnKey),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
queryParamsByKey[columnKey].chips.push({
|
queryParamsByKey[columnKey].chips.push({
|
||||||
key: `${key}:${queryParams[key]}`,
|
key: `${key}:${queryParams[key]}`,
|
||||||
node: <span>{getLabelFromValue(queryParams[key], columnKey)}</span>,
|
node: getLabelFromValue(queryParams[key], columnKey),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -652,6 +652,28 @@ describe('qs (qs.js)', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not remove empty string values', () => {
|
||||||
|
const oldParams = {
|
||||||
|
foo: '',
|
||||||
|
};
|
||||||
|
const newParams = {
|
||||||
|
foo: 'two',
|
||||||
|
};
|
||||||
|
expect(mergeParams(oldParams, newParams)).toEqual({
|
||||||
|
foo: ['', 'two'],
|
||||||
|
});
|
||||||
|
|
||||||
|
const oldParams2 = {
|
||||||
|
foo: 'one',
|
||||||
|
};
|
||||||
|
const newParams2 = {
|
||||||
|
foo: '',
|
||||||
|
};
|
||||||
|
expect(mergeParams(oldParams2, newParams2)).toEqual({
|
||||||
|
foo: ['one', ''],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should retain unaltered params', () => {
|
it('should retain unaltered params', () => {
|
||||||
const oldParams = {
|
const oldParams = {
|
||||||
foo: 'one',
|
foo: 'one',
|
||||||
|
Loading…
Reference in New Issue
Block a user