Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Commit

Permalink
Makes Toast SSR compatible #66
Browse files Browse the repository at this point in the history
  • Loading branch information
zenorocha committed Feb 20, 2018
1 parent 8f8ab68 commit 13b624b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/marble-topbar/src/Topbar.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {isServerSide} from 'metal';
import Component from 'metal-component';
import Soy from 'metal-soy';
import Toggler from 'metal-toggler';
Expand All @@ -10,6 +11,10 @@ import templates from './Topbar.soy.js';
*/
class Topbar extends Component {
attached() {
if (isServerSide()) {
return;
}

this.toggler = new Toggler({
content: '.topbar-list',
header: '.topbar-toggle',
Expand Down
13 changes: 13 additions & 0 deletions packages/marble-topbar/test/Topbar.node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* @jest-environment node
*/

import Component from 'metal-component';
import Topbar from '../src/Topbar';

describe('Topbar.node', () => {
it('should not fail on the server side', () => {
const topbar = Component.renderToString(Topbar);
expect(topbar).not.toBeNull();
});
});

0 comments on commit 13b624b

Please sign in to comment.