Skip to content

Commit

Permalink
fix bug with traceId not showing in dropdown (#481)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Bulicek authored and ashishagg committed Apr 23, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 29bf3d0 commit c5dc496
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/components/universalSearch/searchBar/autosuggest.jsx
Original file line number Diff line number Diff line change
@@ -132,6 +132,7 @@ export default class Autocomplete extends React.Component {
componentDidMount() {
this.props.options.serviceName = {isRangeQuery: false, values: this.props.serviceStore.services};
this.props.options.operationName = {isRangeQuery: false, values: []};
this.props.options.traceId = {isRangeQuery: false, values: []};

// Automatically checks for operations when a user supplies a new serviceName
when(() => this.props.serviceStore.services.length,
17 changes: 9 additions & 8 deletions test/src/components/universalSearch/universalSearch.spec.jsx
Original file line number Diff line number Diff line change
@@ -47,7 +47,8 @@ const stubHistory = {
const stubOptions = {
error: {values: ['true, false'], isRangeQuery: false},
serviceName: {values: ['test-a', 'test-b', 'test-c', 'whitespace test'], isRangeQuery: false},
operationName: {values: [], isRangeQuery: false}
operationName: {values: [], isRangeQuery: false},
traceId: {values: [], isRangeQuery: false}
};


@@ -300,7 +301,7 @@ describe('<Autosuggest />', () => {
expect(wrapper.instance().state.suggestionStrings.length).to.equal(0);
const input = wrapper.find('.usb-searchbar__input');
input.prop('onFocus')({target: {value: ''}});
expect(wrapper.instance().state.suggestionStrings.length).to.equal(3);
expect(wrapper.instance().state.suggestionStrings.length).to.equal(4);
});

it('update suggestion string index on suggestion mouseover', () => {
@@ -312,7 +313,7 @@ describe('<Autosuggest />', () => {
const firstSuggestion = wrapper.find('.usb-suggestions__field').last();
firstSuggestion.simulate('mouseEnter');

expect(wrapper.instance().state.suggestionIndex).to.equal(2);
expect(wrapper.instance().state.suggestionIndex).to.equal(3);
});

it('update suggestion string index on suggestion mouseover', () => {
@@ -375,7 +376,7 @@ describe('<Autosuggest />', () => {
expect(wrapper.instance().state.suggestedOnType).to.equal('Keys');

input.prop('onKeyDown')({keyCode: 38, preventDefault: () => {}});
expect(wrapper.instance().state.suggestionIndex).to.equal(2);
expect(wrapper.instance().state.suggestionIndex).to.equal(3);
expect(wrapper.instance().state.suggestedOnType).to.equal('Keys');

input.prop('onKeyDown')({keyCode: 13, preventDefault: () => {}});
@@ -429,16 +430,16 @@ describe('<Autosuggest />', () => {
const input = wrapper.find('.usb-searchbar__input');
input.prop('onFocus')({target: {value: ''}});
input.prop('onKeyDown')({keyCode: 38, preventDefault: () => {}});
expect(wrapper.instance().state.suggestionIndex).to.equal(2);
expect(wrapper.instance().state.suggestionIndex).to.equal(3);
input.prop('onKeyDown')({keyCode: 38, preventDefault: () => {}});
expect(wrapper.instance().state.suggestionIndex).to.equal(1);
expect(wrapper.instance().state.suggestionIndex).to.equal(2);
input.prop('onKeyDown')({keyCode: 38, preventDefault: () => {}});
expect(wrapper.instance().state.suggestionIndex).to.equal(0);
input.prop('onKeyDown')({keyCode: 40, preventDefault: () => {}});
expect(wrapper.instance().state.suggestionIndex).to.equal(1);
input.prop('onKeyDown')({keyCode: 40, preventDefault: () => {}});
expect(wrapper.instance().state.suggestionIndex).to.equal(2);
input.prop('onKeyDown')({keyCode: 40, preventDefault: () => {}});
expect(wrapper.instance().state.suggestionIndex).to.equal(3);
input.prop('onKeyDown')({keyCode: 40, preventDefault: () => {}});
expect(wrapper.instance().state.suggestionIndex).to.equal(0);
});

0 comments on commit c5dc496

Please sign in to comment.