diff --git a/packages/marble-autocomplete/src/Autocomplete.js b/packages/marble-autocomplete/src/Autocomplete.js index 6f6264c..2549026 100644 --- a/packages/marble-autocomplete/src/Autocomplete.js +++ b/packages/marble-autocomplete/src/Autocomplete.js @@ -1,4 +1,4 @@ -import core from 'metal'; +import {core, isServerSide} from 'metal'; import debounce from 'metal-debounce'; import dom from 'metal-dom'; import {CancellablePromise as Promise} from 'metal-promise'; @@ -23,6 +23,11 @@ class Autocomplete extends AutocompleteBase { */ attached() { super.attached(); + + if (isServerSide()) { + return; + } + this.setAriaAttributes_(); this.eventHandler_.add( dom.on(this.inputElement, 'focus', this.handleInputFocus_.bind(this)) diff --git a/packages/marble-autocomplete/test/Autocomplete.node.js b/packages/marble-autocomplete/test/Autocomplete.node.js new file mode 100644 index 0000000..e7c7cd0 --- /dev/null +++ b/packages/marble-autocomplete/test/Autocomplete.node.js @@ -0,0 +1,13 @@ +/** + * @jest-environment node + */ + +import Component from 'metal-component'; +import Autocomplete from '../src/Autocomplete'; + +describe('Autocomplete.node', () => { + it('should not fail on the server side', () => { + const autocomplete = Component.renderToString(Autocomplete); + expect(autocomplete).not.toBeNull(); + }); +});