diff --git a/.eslintrc.js b/.eslintrc.js
index 69796a0..3de1a8e 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -46,5 +46,8 @@ module.exports = {
"error",
{ "ignoreRestSiblings": true }
]
+ },
+ "globals": {
+ "process": true
}
};
diff --git a/__tests__/src/sticker/__snapshots__/index.js.snap b/__tests__/src/sticker/__snapshots__/index.js.snap
new file mode 100644
index 0000000..e50e0a0
--- /dev/null
+++ b/__tests__/src/sticker/__snapshots__/index.js.snap
@@ -0,0 +1,14 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`StickerToolbar should not render when platform is mac 1`] = `
+
+
+
+`;
+
+exports[`StickerToolbar should render correct when platform is windows 1`] = `
+
+
+
+
+`;
diff --git a/__tests__/src/sticker/index.js b/__tests__/src/sticker/index.js
new file mode 100644
index 0000000..0774a4f
--- /dev/null
+++ b/__tests__/src/sticker/index.js
@@ -0,0 +1,33 @@
+// @flow
+import React from 'react';
+import { shallow } from 'enzyme';
+import { Sticker } from '../../../src/sticker/html';
+
+describe('StickerToolbar', () => {
+ let originalPlatform;
+
+ beforeAll(() => {
+ originalPlatform = process.platform;
+ });
+
+ afterAll(() => {
+ Object.defineProperty(process, 'platform', {
+ value: originalPlatform
+ });
+ });
+
+ it('should render correct when platform is windows', () => {
+ Object.defineProperty(process, 'platform', {
+ value: 'win32'
+ });
+ expect(shallow()).toMatchSnapshot();
+ });
+
+ it('should not render when platform is mac', () => {
+ Object.defineProperty(process, 'platform', {
+ value: 'darwin'
+ });
+ expect(shallow()).toMatchSnapshot();
+ });
+
+});
\ No newline at end of file
diff --git a/src/sticker/html/index.js b/src/sticker/html/index.js
index 9cdfa87..0f6a590 100644
--- a/src/sticker/html/index.js
+++ b/src/sticker/html/index.js
@@ -7,10 +7,20 @@ import StickerToolBar from '../../component/stickerToolbar';
const app = document.getElementById('app');
-const Sticker = () => {
+function renderToolBarIfOnWindows() {
+ console.log('process.platform', process.platform);
+
+ if (/^win/i.test(process.platform)) {
+ return (
+
+ );
+ }
+}
+
+export const Sticker = () => {
return (
-
+ {renderToolBarIfOnWindows()}
);