mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
parent
2f26f51748
commit
05f2ab5755
3 changed files with 49 additions and 1 deletions
|
@ -63,6 +63,31 @@ exports[`StepIndexPattern should disable the next step if the index pattern exis
|
|||
</EuiPanel>
|
||||
`;
|
||||
|
||||
exports[`StepIndexPattern should ensure we properly append a wildcard 1`] = `
|
||||
<EuiPanel
|
||||
grow={true}
|
||||
hasShadow={false}
|
||||
paddingSize="l"
|
||||
>
|
||||
<Header
|
||||
characterList="\\\\, /, ?, \\", <, >, |"
|
||||
errors={Array []}
|
||||
goToNextStep={[Function]}
|
||||
isInputInvalid={false}
|
||||
isNextStepDisabled={true}
|
||||
onQueryChanged={[Function]}
|
||||
query="k*"
|
||||
/>
|
||||
<EuiSpacer
|
||||
size="s"
|
||||
/>
|
||||
<LoadingIndices />
|
||||
<EuiSpacer
|
||||
size="s"
|
||||
/>
|
||||
</EuiPanel>
|
||||
`;
|
||||
|
||||
exports[`StepIndexPattern should properly fetch indices for the initial query 1`] = `
|
||||
<EuiPanel
|
||||
grow={true}
|
||||
|
|
|
@ -144,4 +144,27 @@ describe('StepIndexPattern', () => {
|
|||
|
||||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should ensure we properly append a wildcard', async () => {
|
||||
const component = shallow(
|
||||
<StepIndexPattern
|
||||
allIndices={allIndices}
|
||||
isIncludingSystemIndices={false}
|
||||
esService={esService}
|
||||
savedObjectsClient={{
|
||||
find: () => ({ savedObjects: [
|
||||
{ attributes: { title: 'k*' } }
|
||||
] })
|
||||
}}
|
||||
goToNextStep={goToNextStep}
|
||||
/>
|
||||
);
|
||||
|
||||
const instance = component.instance();
|
||||
|
||||
instance.onQueryChanged({ target: { value: 'k' } });
|
||||
await component.update();
|
||||
|
||||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -83,7 +83,7 @@ export class StepIndexPattern extends Component {
|
|||
const { target } = e;
|
||||
|
||||
let query = target.value;
|
||||
if (query.length === 1 && canAppendWildcard(e.nativeEvent.data)) {
|
||||
if (query.length === 1 && canAppendWildcard(query)) {
|
||||
query += '*';
|
||||
this.setState({ appendedWildcard: true });
|
||||
setTimeout(() => target.setSelectionRange(1, 1));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue