Skip to content
Open
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
8 changes: 8 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "airbnb",
"plugins": [
"react",
"jsx-a11y",
"import"
]
}
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
"babel-preset-stage-1": "^6.24.1",
"babel-runtime": "^6.0.0",
"css-loader": "^0.18.0",
"eslint": "^4.9.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.4.0",
"extract-text-webpack-plugin": "^0.8.2",
"file-loader": "^0.8.4",
"flow-bin": "^0.56.0",
Expand All @@ -35,7 +40,8 @@
"webpack": "^1.12.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint ./src"
},
"repository": {
"type": "git",
Expand Down
48 changes: 24 additions & 24 deletions src/__tests__/Icon-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,62 +3,62 @@
*/

import React from 'react';
import {renderToString} from 'react-dom/server';
import { renderToString } from 'react-dom/server';
import Icon from '../Icon';

describe('Icon', function() {
it('renders Font Awesome className', function() {
let markup = renderToString(<Icon name="plus" />);
describe('Icon', function () {
it('renders Font Awesome className', function () {
const markup = renderToString(<Icon name="plus" />);
expect(/<span class="fa fa-plus"/.exec(markup)).toBeTruthy();
});

it('supports "size"', function() {
let markup = renderToString(<Icon size="lg" name="plus" />);
it('supports "size"', function () {
const markup = renderToString(<Icon size="lg" name="plus" />);
expect(/<span class="fa fa-plus fa-lg"/.exec(markup)).toBeTruthy();
});

it('supports "rotate"', function() {
let markup = renderToString(<Icon rotate="45" name="plus" />);
it('supports "rotate"', function () {
const markup = renderToString(<Icon rotate="45" name="plus" />);
expect(/<span class="fa fa-plus fa-rotate-45"/.exec(markup)).toBeTruthy();
});

it('supports "flip"', function() {
let markup = renderToString(<Icon flip="horizontal" name="plus" />);
it('supports "flip"', function () {
const markup = renderToString(<Icon flip="horizontal" name="plus" />);
expect(/<span class="fa fa-plus fa-flip-horizontal"/.exec(markup)).toBeTruthy();
});

it('supports "fixedWidth"', function() {
let markup = renderToString(<Icon fixedWidth name="plus" />);
it('supports "fixedWidth"', function () {
const markup = renderToString(<Icon fixedWidth name="plus" />);
expect(/<span class="fa fa-plus fa-fw"/.exec(markup)).toBeTruthy();
});

it('supports "spin"', function() {
let markup = renderToString(<Icon spin name="plus" />);
it('supports "spin"', function () {
const markup = renderToString(<Icon spin name="plus" />);
expect(/<span class="fa fa-plus fa-spin"/.exec(markup)).toBeTruthy();
});

it('supports "pulse"', function() {
let markup = renderToString(<Icon pulse name="plus" />);
it('supports "pulse"', function () {
const markup = renderToString(<Icon pulse name="plus" />);
expect(/<span class="fa fa-plus fa-pulse"/.exec(markup)).toBeTruthy();
});

it('supports "stack"', function() {
let markup = renderToString(<Icon stack="2x" name="plus" />);
it('supports "stack"', function () {
const markup = renderToString(<Icon stack="2x" name="plus" />);
expect(/<span class="fa fa-plus fa-stack-2x"/.exec(markup)).toBeTruthy();
});

it('supports "inverse"', function() {
let markup = renderToString(<Icon inverse name="plus" />);
it('supports "inverse"', function () {
const markup = renderToString(<Icon inverse name="plus" />);
expect(/<span class="fa fa-plus fa-inverse"/.exec(markup)).toBeTruthy();
});

it('supports custom className', function() {
let markup = renderToString(<Icon className="x" name="plus" />);
it('supports custom className', function () {
const markup = renderToString(<Icon className="x" name="plus" />);
expect(/<span class="fa fa-plus x"/.exec(markup)).toBeTruthy();
});

it('can be rendered using different DOM component', function() {
let markup = renderToString(<Icon Component="i" name="plus" />);
it('can be rendered using different DOM component', function () {
const markup = renderToString(<Icon Component="i" name="plus" />);
expect(/<i class="fa fa-plus"/.exec(markup)).toBeTruthy();
});
});
16 changes: 8 additions & 8 deletions src/__tests__/IconStack-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@
*/

import React from 'react';
import {renderToString} from 'react-dom/server';
import { renderToString } from 'react-dom/server';
import Icon from '../Icon';
import IconStack from '../IconStack';

describe('IconStack', function() {
it('renders icon stack container with default size', function() {
let markup = renderToString(
describe('IconStack', function () {
it('renders icon stack container with default size', function () {
const markup = renderToString(
<IconStack>
<Icon name="plus" />
</IconStack>,
);
expect(/<span class="fa-stack"/.exec(markup)).toBeTruthy();
});

it('supports optional "size"', function() {
let markup = renderToString(
it('supports optional "size"', function () {
const markup = renderToString(
<IconStack size="2x">
<Icon name="plus" />
</IconStack>,
);
expect(/<span class="fa-stack fa-2x"/.exec(markup)).toBeTruthy();
});

it('supports custom className', function() {
let markup = renderToString(
it('supports custom className', function () {
const markup = renderToString(
<IconStack className="x">
<Icon name="plus" />
</IconStack>,
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ import 'font-awesome/css/font-awesome.css';
import Icon from './Icon';
import IconStack from './IconStack';

export {Icon as default, Icon, IconStack};
export { Icon as default, Icon, IconStack };