Skip to content

Commit

Permalink
Fix name collision with Jest's global object
Browse files Browse the repository at this point in the history
Jest uses a object called `global` that proxies the `window` object.
This conflicts with the `global` object of Nord Docs theme.
This commit renames the object to `globals`.

GH-53
  • Loading branch information
arcticicestudio committed Dec 3, 2018
1 parent eeb4e96 commit dda9edd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions src/components/containers/core/Root/Root.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import React, { Fragment } from "react";
import PropTypes from "prop-types";
import { ThemeProvider, createGlobalStyle } from "styled-components";
import modernNormalize from "styled-modern-normalize";

import theme, { global, normalize } from "styles/theme";
import theme, { globals, normalize } from "styles/theme";

/* eslint-disable import/extensions */
import "inter-ui";
Expand All @@ -28,7 +27,7 @@ import "typeface-source-code-pro";
*/
const GlobalStyle = createGlobalStyle`
${modernNormalize};
${global};
${globals};
${normalize};
`;

Expand Down
4 changes: 2 additions & 2 deletions src/styles/theme/global.js → src/styles/theme/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { css } from "styled-components";

import typography from "./typography";

const global = css`
const globals = css`
html {
font-size: ${typography.sizes.root}px;
}
Expand All @@ -32,4 +32,4 @@ const global = css`
}
`;

export default global;
export default globals;
4 changes: 2 additions & 2 deletions src/styles/theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* @since 0.2.0
*/

import global from "./global";
import globals from "./globals";
import normalize from "./normalize";
import typography from "./typography";

const theme = { typography };

export { global, normalize, typography };
export { globals, normalize, typography };

export default theme;

0 comments on commit dda9edd

Please sign in to comment.