diff --git a/packages/marble-dropdown/src/Dropdown.js b/packages/marble-dropdown/src/Dropdown.js index e9b6008..81357ae 100644 --- a/packages/marble-dropdown/src/Dropdown.js +++ b/packages/marble-dropdown/src/Dropdown.js @@ -1,4 +1,4 @@ -import {core, object} from 'metal'; +import {core, object, isServerSide} from 'metal'; import dom from 'metal-dom'; import {Align} from 'metal-position'; import Component from 'metal-component'; @@ -16,6 +16,11 @@ class Dropdown extends Component { */ attached() { super.attached(); + + if (isServerSide()) { + return; + } + this.eventHandler_.add( dom.on(document, 'click', this.handleDocClick_.bind(this)) ); diff --git a/packages/marble-dropdown/test/Dropdown.node.js b/packages/marble-dropdown/test/Dropdown.node.js new file mode 100644 index 0000000..6bebcb5 --- /dev/null +++ b/packages/marble-dropdown/test/Dropdown.node.js @@ -0,0 +1,13 @@ +/** + * @jest-environment node + */ + +import Component from 'metal-component'; +import Dropdown from '../src/Dropdown'; + +describe('Dropdown.node', () => { + it('should not fail on the server side', () => { + const dropdown = Component.renderToString(Dropdown); + expect(dropdown).not.toBeNull(); + }); +});