Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing #18

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions packages/core/__tests__/DreifussWysiwygEditor-test.js

This file was deleted.

19 changes: 15 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
"rollup": "rollup -c=../../rollup.config.js",
"clean": "rimraf dist tsconfig.tsbuildinfo",
"watch": "webpack serve --mode development",
"test": "BABEL_JEST_STAGE=0 jest",
"testtt": "BABEL_JEST_STAGE=0 jest",
"test": "jest --env=jsdom",
"prepublish": "npm run build",
"lint": "eslint 'src/**/*.{ts,tsx,js}' '__tests__/**/*.{ts,tsx,js}'",
"fix": "eslint 'src/**/*.{ts,tsx,js}' '__tests__/**/*.{ts,tsx,js}' --fix",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
"build-storybook": "build-storybook",
"test:generate-output": "jest --json --outputFile=.jest-test-results.json"
},
"keywords": [
"rich-text",
Expand All @@ -38,13 +40,16 @@
"url": "https://github.com"
},
"jest": {
"roots": [
"<rootDir>/src"
],
"unmockedModulePathPatterns": [
"<rootDir>/node_modules/react",
"<rootDir>/node_modules/react-dom",
"<rootDir>/node_modules/react-addons-test-utils"
],
"transform": {
"^.+\\.(js|jsx|ts|tsx)$": "babel-jest"
"^.+\\.(ts|tsx|js|jsx)$": "ts-jest"
},
"moduleFileExtensions": [
"js",
Expand All @@ -59,6 +64,7 @@
"react-dom": "^17.0.2"
},
"devDependencies": {
"ts-jest": "^27.0.5",
"@hot-loader/react-dom": "16.12.0",
"@types/emoji-mart": "^3.0.4",
"@types/flux": "^3.1.9",
Expand All @@ -80,7 +86,12 @@
"@storybook/addon-actions": "^6.3.6",
"@storybook/addon-essentials": "^6.3.6",
"@storybook/addon-links": "^6.3.6",
"@storybook/react": "^6.3.6"
"@storybook/react": "^6.3.6",
"@storybook/testing-react": "0.0.22",
"@testing-library/react": "12.0.0",
"@testing-library/jest-dom": "5.14.1",
"@storybook/addon-jest": "^6.3.7",
"jest": "^27.0.6"
},
"dependencies": {
"@babel/runtime": "^7.13.10",
Expand Down
15 changes: 2 additions & 13 deletions packages/core/src/stories/BasicExample.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,11 @@ const Template = args => <BasicExample {...args} />
export const Primary = Template.bind({})
Primary.args = {
primary: true,
label: 'Button'
label: 'Editor',
count: BasicExample.charCount
}

export const Secondary = Template.bind({})
Secondary.args = {
label: 'Button'
}

export const Large = Template.bind({})
Large.args = {
size: 'large',
label: 'Button'
}

export const Small = Template.bind({})
Small.args = {
size: 'small',
label: 'Button'
}
16 changes: 16 additions & 0 deletions packages/core/src/stories/BasicExample.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react'
import {render} from '@testing-library/react'
import '@testing-library/jest-dom/extend-expect'

import {Primary} from './BasicExample.stories'

test('renders the button in the primary state', () => {
render(<Primary {...Primary.args} />)
// expect(screen.getByRole('button')).toHaveTextContent('Button');
expect(Primary.args.label).toBe('Editor')
})

test('shows the correct character count', () => {
render(<Primary {...Primary.args} />);
expect(Primary.args.count).toBe(4);
});
2 changes: 2 additions & 0 deletions packages/core/src/stories/BasicExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export const BasicExample = () => {
)
}

BasicExample.charCount = value.length

BasicExample.propTypes = {
/**
* BasicExample contents
Expand Down
211 changes: 0 additions & 211 deletions packages/core/src/stories/Introduction.stories.mdx

This file was deleted.

Loading