From c5dc496e5bbd1fd8f3c26f604e87fb79b4e2f68e Mon Sep 17 00:00:00 2001 From: Jason Bulicek Date: Wed, 24 Apr 2019 02:46:34 +0900 Subject: [PATCH] fix bug with traceId not showing in dropdown (#481) --- .../universalSearch/searchBar/autosuggest.jsx | 1 + .../universalSearch/universalSearch.spec.jsx | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/components/universalSearch/searchBar/autosuggest.jsx b/src/components/universalSearch/searchBar/autosuggest.jsx index 756ee8cc..3463da3e 100644 --- a/src/components/universalSearch/searchBar/autosuggest.jsx +++ b/src/components/universalSearch/searchBar/autosuggest.jsx @@ -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, diff --git a/test/src/components/universalSearch/universalSearch.spec.jsx b/test/src/components/universalSearch/universalSearch.spec.jsx index 85c08231..2ae6599c 100644 --- a/test/src/components/universalSearch/universalSearch.spec.jsx +++ b/test/src/components/universalSearch/universalSearch.spec.jsx @@ -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('', () => { 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('', () => { 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('', () => { 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('', () => { 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); });