2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-23 20:40:34 +03:00

feat(react): update to react 18 and testing-library (#138)

This commit is contained in:
Nikolay Kost
2022-05-24 01:50:45 +02:00
committed by GitHub
parent d3c9cba8d3
commit 502362cc8c
3 changed files with 1293 additions and 994 deletions
+1096 -799
View File
File diff suppressed because it is too large Load Diff
+5 -6
View File
@@ -15,15 +15,14 @@
},
"peerDependencies": {
"prop-types": "15.x",
"react": "15.x"
"react": "18.x"
},
"devDependencies": {
"@bbob/preset-react": "^2.8.0",
"enzyme": "^3.9.0",
"enzyme-adapter-react-15": "^1.0.6",
"react": "15.x",
"react-dom": "^15.6.2",
"react-test-renderer": "^15.6.2"
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "13.x",
"react": "18.x",
"react-dom": "18.x"
},
"main": "lib/index.js",
"module": "es/index.js",
+9 -6
View File
@@ -1,15 +1,18 @@
/**
* @jest-environment jsdom
*/
import React from 'react';
import preset from '@bbob/preset-react';
import '@testing-library/jest-dom'
import Enzyme, { shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';
import { render } from '@testing-library/react'
import BBCode from '../src';
Enzyme.configure({ adapter: new Adapter() });
const renderBBCode = (input, options) => shallow(
const renderBBCode = (input, options) => render(
<BBCode plugins={[preset()]} options={options}>{input}</BBCode>
).html();
).container.innerHTML;
describe('@bbob/react', () => {
test('[b]bolded text[/b]', () => {
@@ -45,7 +48,7 @@ describe('@bbob/react', () => {
test('[b]Testing[/b][hr]', () => {
const html = renderBBCode('[b]Testing[/b][hr]');
expect(html).toBe('<span><span style="font-weight:bold;">Testing</span><hr/></span>')
expect(html).toBe('<span><span style="font-weight: bold;">Testing</span><hr></span>')
});
describe('options.onlyAllowTags', () => {