Skip to content

Commit

Permalink
fix: jest config and merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
weblancaster committed Apr 17, 2018
1 parent a861ec2 commit e492d6c
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 131 deletions.
55 changes: 0 additions & 55 deletions components/badge/badge.test.tsx

This file was deleted.

50 changes: 50 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
module.exports = {
"rootDir": ".",
"testPathIgnorePatterns": [
"/node_modules/",
"/dist/",
"scripts"
],
"coverageReporters": [
"json",
"text"
],
"projects": [
{
"displayName": "Jest",
"roots": [
"packages"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"setupTestFrameworkScriptFile": "<rootDir>/testHelper/setupTests.ts",
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"transform": {
"^.+\\.tsx?$": "ts-jest"
}
},
{
"displayName": "Prettier",
"runner": "jest-runner-prettier",
"moduleFileExtensions": [
"js",
"jsx",
"json",
"ts",
"tsx"
],
"testMatch": [
"<rootDir>/packages/**/*.{ts|tsx}",
"tslint.json",
"tsconfig.json",
"tsconfig.dist.json",
]
}
]
}
11 changes: 0 additions & 11 deletions jest.config.json

This file was deleted.

60 changes: 3 additions & 57 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,63 +30,9 @@
"test": "jest",
"test:watch": "jest --watch"
},
"files": ["dist"],
"jest": {
"coverageReporters": [
"json",
"text"
],
"projects": [{
"displayName": "Jest",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"setupTestFrameworkScriptFile": "<rootDir>/testHelper/setupTests.ts",
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"roots": [
"components"
]
}, {
"displayName": "Prettier",
"runner": "jest-runner-prettier",
"moduleFileExtensions": [
"js",
"jsx",
"json",
"ts",
"tsx",
"css",
"less",
"scss",
"graphql",
"md",
"markdown"
],
"testMatch": [
"**/*.js",
"**/*.jsx",
"tslint.json",
"tsconfig.json",
"tsconfig.dist.json",
"components/**/*.ts",
"components/**/*.tsx",
"**/*.css",
"**/*.less",
"**/*.scss",
"**/*.graphql",
"**/*.md",
"**/*.markdown"
]
}]
},
"files": [
"dist"
],
"typings": "dist/components/index",
"dependencies": {
"emotion": "9.0.2",
Expand Down
11 changes: 10 additions & 1 deletion packages/badge/components/badgeButton.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { css } from "emotion";
import * as React from "react";
import { badge as badgeButton } from "../style";

Expand Down Expand Up @@ -27,7 +28,15 @@ export class BadgeButton extends React.PureComponent<IBadgeButtonProps, {}> {

public render() {
const { appearance, children, onClick, tabIndex } = this.props;
const props = { onClick, tabIndex, className: badgeButton(appearance) };
const props = {
onClick,
tabIndex,
className: css`
outline: none;
cursor: pointer;
${badgeButton(appearance)};
`
};

return <button {...props}>{children}</button>;
}
Expand Down
7 changes: 7 additions & 0 deletions packages/badge/stories/badge.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,11 @@ storiesOf("Badge", module)
"Outline",
"Outline badges for when we want the density of the badge to be lighter e.g. when next to data in a table cell",
() => <Badge appearance="outline">Outline</Badge>
)
.addWithInfo(
"Button",
"Button badges for when we want add click event",
() => (
<BadgeButton onClick={action("badge button")}>badge button</BadgeButton>
)
);
14 changes: 7 additions & 7 deletions packages/badge/tests/__snapshots__/badgeButton.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`BadgeButton accept jsx as children 1`] = `
<button
className="css-i4ctwy"
className="css-y5qucr"
onClick={[Function]}
tabIndex={-1}
>
Expand All @@ -14,7 +14,7 @@ exports[`BadgeButton accept jsx as children 1`] = `

exports[`BadgeButton danger 1`] = `
<button
className="css-o307zd"
className="css-aqlru0"
onClick={[Function]}
tabIndex={-1}
>
Expand All @@ -24,7 +24,7 @@ exports[`BadgeButton danger 1`] = `

exports[`BadgeButton default 1`] = `
<button
className="css-i4ctwy"
className="css-y5qucr"
onClick={[Function]}
tabIndex={-1}
>
Expand All @@ -34,7 +34,7 @@ exports[`BadgeButton default 1`] = `

exports[`BadgeButton outline 1`] = `
<button
className="css-ml4yrq"
className="css-j343ve"
onClick={[Function]}
tabIndex={-1}
>
Expand All @@ -44,7 +44,7 @@ exports[`BadgeButton outline 1`] = `

exports[`BadgeButton primary 1`] = `
<button
className="css-361qnz"
className="css-q2731u"
onClick={[Function]}
tabIndex={-1}
>
Expand All @@ -54,7 +54,7 @@ exports[`BadgeButton primary 1`] = `

exports[`BadgeButton success 1`] = `
<button
className="css-xr9z4s"
className="css-10v0ttp"
onClick={[Function]}
tabIndex={-1}
>
Expand All @@ -64,7 +64,7 @@ exports[`BadgeButton success 1`] = `

exports[`BadgeButton warning 1`] = `
<button
className="css-19otvs4"
className="css-1qzzy6w"
onClick={[Function]}
tabIndex={-1}
>
Expand Down

0 comments on commit e492d6c

Please sign in to comment.