-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
25 changed files
with
1,050 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/_index.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
@import 'config_panel'; | ||
@import 'dimension_popover'; | ||
@import 'layer_panel'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...ns/lens/public/indexpattern_datasource/operations/definitions/filters/filter_popover.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.lnsIndexPatternDimensionEditor__filtersEditor { | ||
width: $euiSize * 60; | ||
} |
81 changes: 81 additions & 0 deletions
81
...ens/public/indexpattern_datasource/operations/definitions/filters/filter_popover.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React, { MouseEventHandler } from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { act } from 'react-dom/test-utils'; | ||
import { EuiPopover, EuiLink } from '@elastic/eui'; | ||
import { createMockedIndexPattern } from '../../../mocks'; | ||
import { FilterPopover, QueryInput, LabelInput } from './filter_popover'; | ||
|
||
jest.mock('.', () => ({ | ||
isQueryValid: () => true, | ||
defaultLabel: 'label', | ||
})); | ||
|
||
const defaultProps = { | ||
filter: { | ||
input: { query: 'bytes >= 1', language: 'kuery' }, | ||
label: 'More than one', | ||
id: '1', | ||
}, | ||
setFilter: jest.fn(), | ||
indexPattern: createMockedIndexPattern(), | ||
Button: ({ onClick }: { onClick: MouseEventHandler }) => ( | ||
<EuiLink onClick={onClick}>trigger</EuiLink> | ||
), | ||
isOpenByCreation: true, | ||
setIsOpenByCreation: jest.fn(), | ||
}; | ||
|
||
describe('filter popover', () => { | ||
jest.mock('../../../../../../../../src/plugins/data/public', () => ({ | ||
QueryStringInput: () => { | ||
return 'QueryStringInput'; | ||
}, | ||
})); | ||
it('should be open if is open by creation', () => { | ||
const setIsOpenByCreation = jest.fn(); | ||
const instance = shallow( | ||
<FilterPopover {...defaultProps} setIsOpenByCreation={setIsOpenByCreation} /> | ||
); | ||
expect(instance.find(EuiPopover).prop('isOpen')).toEqual(true); | ||
act(() => { | ||
instance.find(EuiPopover).prop('closePopover')!(); | ||
}); | ||
instance.update(); | ||
expect(setIsOpenByCreation).toHaveBeenCalledWith(false); | ||
}); | ||
it('should call setFilter when modifying QueryInput', () => { | ||
const setFilter = jest.fn(); | ||
const instance = shallow(<FilterPopover {...defaultProps} setFilter={setFilter} />); | ||
instance.find(QueryInput).prop('onChange')!({ | ||
query: 'modified : query', | ||
language: 'lucene', | ||
}); | ||
expect(setFilter).toHaveBeenCalledWith({ | ||
input: { | ||
language: 'lucene', | ||
query: 'modified : query', | ||
}, | ||
label: 'More than one', | ||
id: '1', | ||
}); | ||
}); | ||
it('should call setFilter when modifying LabelInput', () => { | ||
const setFilter = jest.fn(); | ||
const instance = shallow(<FilterPopover {...defaultProps} setFilter={setFilter} />); | ||
instance.find(LabelInput).prop('onChange')!('Modified label'); | ||
expect(setFilter).toHaveBeenCalledWith({ | ||
input: { | ||
language: 'kuery', | ||
query: 'bytes >= 1', | ||
}, | ||
label: 'Modified label', | ||
id: '1', | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.