-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into plexus-zoom-manager
- Loading branch information
Showing
31 changed files
with
4,331 additions
and
172 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
135 changes: 0 additions & 135 deletions
135
packages/jaeger-ui/src/components/DeepDependencyGraph/Header.tsx
This file was deleted.
Oops, something went wrong.
76 changes: 76 additions & 0 deletions
76
packages/jaeger-ui/src/components/DeepDependencyGraph/Header/NameSelector.css
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,76 @@ | ||
/* | ||
Copyright (c) 2019 Uber Technologies, Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
.NameSelector { | ||
border-bottom: 1px solid transparent; | ||
color: var(--tx-color-muted); | ||
cursor: pointer; | ||
font-size: 1.5em; | ||
margin: 0 1.3em 0 0; | ||
outline: 4px solid transparent; | ||
} | ||
|
||
.NameSelector.is-invalid { | ||
background: #fff2e888; | ||
border-color: #ffbb96; | ||
outline-color: #fff2e888; | ||
} | ||
|
||
.NameSelector.is-invalid:hover { | ||
background: #fff2e8; | ||
border-color: #ff9c6e; | ||
outline-color: #fff2e8; | ||
} | ||
|
||
.NameSelector:hover { | ||
background: #f4f4f4; | ||
border-color: #ccc; | ||
color: var(--tx-color-body); | ||
outline-color: #f4f4f4; | ||
} | ||
|
||
.NameSelector.is-active { | ||
background: #ddd; | ||
border-color: #bbb; | ||
color: var(--tx-color-body); | ||
outline-color: #ddd; | ||
} | ||
|
||
.NameSelector--label { | ||
font-weight: 400; | ||
padding-right: 0.5em; | ||
} | ||
|
||
.NameSelector--value { | ||
color: var(--tx-color-title); | ||
} | ||
|
||
.NameSelector--chevron { | ||
font-size: 0.6em; | ||
margin-left: 0.8em; | ||
position: relative; | ||
} | ||
|
||
.NameSelector--overlay .ant-popover-arrow { | ||
border: 1px solid #999; | ||
z-index: -1; | ||
background: #bbb; | ||
} | ||
|
||
.NameSelector--overlay .ant-popover-inner { | ||
border: 1px solid #ccc; | ||
overflow: hidden; | ||
} |
105 changes: 105 additions & 0 deletions
105
packages/jaeger-ui/src/components/DeepDependencyGraph/Header/NameSelector.test.js
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,105 @@ | ||
// Copyright (c) 2019 Uber Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import React from 'react'; | ||
import { Popover } from 'antd'; | ||
import { shallow } from 'enzyme'; | ||
|
||
import BreakableText from '../../common/BreakableText'; | ||
import NameSelector, { DEFAULT_PLACEHOLDER } from './NameSelector'; | ||
|
||
describe('<NameSelector>', () => { | ||
const placeholder = 'This is the placeholder'; | ||
let props; | ||
let wrapper; | ||
|
||
beforeEach(() => { | ||
props = { | ||
placeholder, | ||
label: 'a-label', | ||
options: ['a', 'b', 'c'], | ||
value: null, | ||
required: true, | ||
setValue: jest.fn(), | ||
}; | ||
wrapper = shallow(<NameSelector {...props} />); | ||
}); | ||
|
||
it('renders without exploding', () => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders with is-invalid when required and without a value', () => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders without is-invalid when not required and without a value', () => { | ||
wrapper.setProps({ required: false }); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
|
||
describe('placeholder prop', () => { | ||
it('renders the placeholder when it is a string and value == null', () => { | ||
wrapper.setProps({ placeholder, value: null }); | ||
expect(wrapper.find(BreakableText).prop('text')).toBe(placeholder); | ||
}); | ||
|
||
it('renders the default placeholder when the prop is true and value == null', () => { | ||
wrapper.setProps({ placeholder: true, value: null }); | ||
expect(wrapper.find(BreakableText).prop('text')).toBe(DEFAULT_PLACEHOLDER); | ||
}); | ||
|
||
it('does not render a placeholder if there is a value', () => { | ||
const value = 'some-value'; | ||
wrapper.setProps({ placeholder, value }); | ||
expect(wrapper.find(BreakableText).prop('text')).toBe(value); | ||
wrapper.setProps({ placeholder: true, value }); | ||
expect(wrapper.find(BreakableText).prop('text')).toBe(value); | ||
}); | ||
}); | ||
|
||
it('allows the filtered list to set values', () => { | ||
const v = 'test-value'; | ||
const popover = wrapper.find(Popover); | ||
const list = popover.prop('content'); | ||
list.props.setValue(v); | ||
expect(props.setValue.mock.calls).toEqual([[v]]); | ||
}); | ||
|
||
it('hides the popover when the filter calls cancel', () => { | ||
wrapper.setState({ popoverVisible: true }); | ||
const popover = wrapper.find(Popover); | ||
const list = popover.prop('content'); | ||
list.props.cancel(); | ||
expect(wrapper.state('popoverVisible')).toBe(false); | ||
}); | ||
|
||
it('controls the visibility of the popover', () => { | ||
expect(wrapper.state('popoverVisible')).toBe(false); | ||
const popover = wrapper.find(Popover); | ||
popover.prop('onVisibleChange')(true); | ||
expect(wrapper.state('popoverVisible')).toBe(true); | ||
}); | ||
|
||
it('attempts to focus the filter input when the component updates', () => { | ||
const fn = jest.fn(); | ||
wrapper.instance().listRef = { | ||
current: { | ||
focusInput: fn, | ||
}, | ||
}; | ||
wrapper.setProps({ required: false }); | ||
expect(fn.mock.calls.length).toBe(1); | ||
}); | ||
}); |
Oops, something went wrong.