Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save flyerhzm/90977c87b2d52f01953b71093bf9022d to your computer and use it in GitHub Desktop.
Save flyerhzm/90977c87b2d52f01953b71093bf9022d to your computer and use it in GitHub Desktop.
const snippet = "react/html-elements-to-react-bootstrap-components"
require(`../../lib/${snippet}`);
const dedent = require('dedent');
const { assertConvert } = require("../utils");
describe(snippet, () => {
describe("simple", () => {
const input = dedent(`
import React from 'react';
<div className="container-fluid">
<div />
</div>
`)
const output = dedent(`
import React from 'react';
import { Container } from 'react-bootstrap';
<Container fluid>
<div />
</Container>
`)
assertConvert({
input,
output,
snippet,
path: "code.jsx",
});
});
describe("complex", () => {
const input = dedent(`
import React from 'react';
<div className="container-fluid container-pagination" style={{ display: 'none' }}>
<div />
</div>
`)
const output = dedent(`
import React from 'react';
import { Container } from 'react-bootstrap';
<Container fluid className="container-pagination" style={{ display: 'none' }}>
<div />
</Container>
`)
assertConvert({
input,
output,
snippet,
path: "code.jsx",
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment