├── .babelrc
├── .eslintignore
├── .eslintrc.js
├── .github
└── workflows
│ └── publish.yml
├── .gitignore
├── .npmrc
├── .nvmrc
├── .travis.yml
├── LICENSE.md
├── README.md
├── dist
└── index.js
├── package-lock.json
├── package.json
├── src
├── index.js
├── index.js.example
├── setupTests.js
└── svg-loader-components
│ ├── audio.js
│ ├── ball-triangle.js
│ ├── bars.js
│ ├── circles.js
│ ├── grid.js
│ ├── hearts.js
│ ├── oval.js
│ ├── puff.js
│ ├── rings.js
│ ├── spinning-circles.js
│ ├── tail-spin.js
│ └── three-dots.js
├── test
├── audio.test.js
├── ball-triangle.test.js
├── bars.test.js
├── circles.test.js
├── grid.test.js
├── hearts.test.js
├── oval.test.js
├── puff.test.js
├── rings.test.js
├── spinning-circles.test.js
├── tail-spin.test.js
└── three-dots.test.js
└── webpack.config.js
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["@babel/preset-env", "@babel/preset-react"],
3 | "plugins": [
4 | "@babel/plugin-proposal-object-rest-spread",
5 | "transform-react-jsx"
6 | ]
7 | }
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | /node_modules/
2 | /dist/
3 | webpack.config.js
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | // ESLint configuration
2 | // http://eslint.org/docs/user-guide/configuring
3 | module.exports = {
4 | parser: 'babel-eslint',
5 |
6 | extends: [
7 | 'airbnb',
8 | ],
9 |
10 | globals: {
11 | __DEV__: true,
12 | },
13 |
14 | env: {
15 | node: true,
16 | browser: true,
17 | amd: true,
18 | es6: true,
19 | jest: true
20 | },
21 |
22 | rules: {
23 | // `js` and `jsx` are common extensions
24 | 'import/extensions': [
25 | 'error',
26 | 'always',
27 | {
28 | js: 'never',
29 | jsx: 'never',
30 | },
31 | ],
32 |
33 | 'react/jsx-filename-extension': [
34 | 1,
35 | {
36 | 'extensions': ['.js', '.jsx'],
37 | },
38 | ],
39 |
40 | // Not supporting nested package.json yet
41 | // https://github.com/benmosher/eslint-plugin-import/issues/458
42 | 'import/no-extraneous-dependencies': 'off',
43 |
44 | // Recommend not to leave any console.log in your code
45 | // Use console.error, console.warn and console.info instead
46 | 'no-console': [
47 | 'error',
48 | {
49 | allow: ['warn', 'error', 'info'],
50 | },
51 | ],
52 |
53 | // Switching off checks for linebreaks
54 | 'linebreak-style': 'off',
55 |
56 | // Switching off default exports
57 | 'import/prefer-default-export': 'off',
58 |
59 | // Switching off prop-types, which is disabled in React 18 and removed in React 19
60 | // See https://react.dev/blog/2024/04/25/react-19-upgrade-guide#removed-proptypes-and-defaultprops
61 | "react/prop-types": "off"
62 | },
63 | };
64 |
--------------------------------------------------------------------------------
/.github/workflows/publish.yml:
--------------------------------------------------------------------------------
1 | name: Publish Package to npmjs
2 | on:
3 | release:
4 | types: [published]
5 |
6 | jobs:
7 | build:
8 | runs-on: ubuntu-latest
9 | permissions:
10 | contents: read
11 | id-token: write
12 | steps:
13 | - uses: actions/checkout@v4
14 | - uses: actions/setup-node@v4
15 | with:
16 | node-version: '20.x'
17 | registry-url: 'https://registry.npmjs.org'
18 | - run: npm ci
19 | - run: npm test
20 | - run: npm publish --provenance --access public
21 | env:
22 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 |
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | legacy-peer-deps=true
2 |
--------------------------------------------------------------------------------
/.nvmrc:
--------------------------------------------------------------------------------
1 | v20
2 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - stable
4 | cache:
5 | directories:
6 | - node_modules
7 | script:
8 | - npm run lint
9 | - npm run test
10 | - npm run build
11 | deploy:
12 | provider: npm
13 | edge: true
14 | email: ajwann@ajwann.com
15 | api_key:
16 | secure: YkxXF6wD7aSq0jR9kxORYNd01dakfOGyCJnXYiZZSAZQCByKIULw3clXaUo6dIWVyOy/uMU4/sAFmov2HIzrJ4yin2AeoLUKhSPaxKa7C/7/rar1m5jgw4B5vskrCdfsdoyalbnZquWjh+hdA8YV6YMyPyrS19coXdFRFiabIPyAzljiuv+Iquips7HJQuA12FbTsrVyLYloOkUvBLMUv+0JtJxDBJPFRq9RYwt+9jrdh2YADjf2gcpUHyaw7p8gIkNRAsNyWtFi6uPJ5fOP4XWGDoKh7IUMxdP+siN3jsqYR2nPkfFpaO1S4X/4r9R3VpHln4G79B5R/l1k47ZiroHuLQMoC9azUHc+qoLnbBYcCJl9te6JItrfDB4JXqOyNuF3AF6NLhXNeywbuoxcc+ypXGOVkSgTXWbtfsVzuvAN+b5a0Hj6Fkzu5hyYkJ8a4gL/4WxsPK7GoCwzw9CbdXvQR9K3kQpeRFv1vRrdGhKjLbbU+DDZUhojxGIP8CYAJESA/fpKJ7+PiQUQj/tIfu+Hx1mAn5iZIFwKDYuEpMLPGOxIdxj4Nilb8fujCJOSrVqzpo75gpah5yjtE/1T9aRvJN8LuulbaZmJcyxtMoqGwl6KrDGhnXWzsFabZkSQypxuM1+zfJBXyyU0TAh7mx+NpF6EaWz5dXNKgjwbVYs=
17 | on:
18 | tags: true
19 | repo: ajwann/svg-loaders-react
20 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | **Original Work** Copyright (c) 2014 Sam Herbert
4 |
5 | **Modified Work Copyright (c) 2018 Adam Wanninger**
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | of this software and associated documentation files (the "Software"), to deal
9 | in the Software without restriction, including without limitation the rights
10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be included in all
15 | copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | SOFTWARE.
24 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://badge.fury.io/js/svg-loaders-react)
2 |
3 | This is a zero-dependency React adaptation of Sam Herberts [SVG Loaders](https://github.com/SamHerbert/SVG-Loaders) library.
4 |
5 | # Usage
6 |
7 | ## Install from NPM
8 | ```bash
9 | npm install svg-loaders-react
10 | ```
11 |
12 | ## Import the SVGLoaders components
13 |
14 | ### Import all the loaders in a namespaced fashion
15 | You can import all the loaders at once:
16 | ```js
17 | import * as SVGLoaders from 'svg-loaders-react';
18 | ```
19 | and use them in a namespaced manner:
20 | ```js
21 |
22 | ```
23 |
24 | ### Import an individual loader
25 | You can also import a single loader:
26 | ```js
27 | import { Bars } from 'svg-loaders-react'
28 | ```
29 | and use it without any fancy namespacing:
30 | ```js
31 |
32 | ```
33 |
34 | ## Components
35 |
36 | ``````
37 |
38 | ``````
39 |
40 | ``````
41 |
42 | ``````
43 |
44 | ``````
45 |
46 | ``````
47 |
48 | ``````
49 |
50 | ``````
51 |
52 | ``````
53 |
54 | ``````
55 |
56 | ``````
57 |
58 | ``````
59 |
60 | # Options
61 |
62 | Each of these components should be able to accept any [SVG tag presentation attributes](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/Presentation) as props.
63 |
64 | # Common Usage
65 | ```Javascript
66 | // render the Puff loader with a stroke opacity of .125
67 |
68 |
69 | // render the Puff loader with a stroke of mint green
70 |
71 |
72 | // render the Puff loader with a stroke of mint green and a stroke opactiy of .125
73 |
74 | ```
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/dist/index.js:
--------------------------------------------------------------------------------
1 | module.exports=function(e){var t={};function a(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,a),n.l=!0,n.exports}return a.m=e,a.c=t,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(r,n,function(t){return e[t]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=1)}([function(e,t){e.exports=require("react")},function(e,t,a){"use strict";a.r(t),a.d(t,"Audio",(function(){return l})),a.d(t,"BallTriangle",(function(){return o})),a.d(t,"Bars",(function(){return s})),a.d(t,"Circles",(function(){return m})),a.d(t,"Grid",(function(){return v})),a.d(t,"Hearts",(function(){return b})),a.d(t,"Oval",(function(){return y})),a.d(t,"Puff",(function(){return E})),a.d(t,"Rings",(function(){return N})),a.d(t,"SpinningCircles",(function(){return x})),a.d(t,"TailSpin",(function(){return C})),a.d(t,"ThreeDots",(function(){return P}));var r=a(0),n=a.n(r);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t=18",
12 | "react-dom": ">=18"
13 | },
14 | "devDependencies": {
15 | "@babel/core": "^7.4.5",
16 | "@babel/plugin-proposal-object-rest-spread": "^7.4.4",
17 | "@babel/preset-env": "^7.4.5",
18 | "@babel/preset-react": "^7.0.0",
19 | "@cfaester/enzyme-adapter-react-18": "^0.8.0",
20 | "@testing-library/react": "^16.1.0",
21 | "babel-cli": "^6.26.0",
22 | "babel-eslint": "^10.0.2",
23 | "babel-jest": "^29.7.0",
24 | "babel-loader": "^8.0.6",
25 | "babel-plugin-transform-react-jsx": "^6.24.1",
26 | "babel-preset-env": "^1.7.0",
27 | "enzyme": "^3.10.0",
28 | "eslint": "^6.0.0",
29 | "eslint-config-airbnb": "^17.1.0",
30 | "eslint-plugin-import": "^2.17.3",
31 | "eslint-plugin-jsx-a11y": "^6.2.1",
32 | "eslint-plugin-react": "^7.13.0",
33 | "identity-obj-proxy": "^3.0.0",
34 | "jest": "^29.7.0",
35 | "jsdom": "^25.0.1",
36 | "jsdom-global": "^3.0.2",
37 | "prop-types": "^15.8.1",
38 | "react": "^18.3.1",
39 | "react-dom": "^18.3.1",
40 | "webpack": "^4.29.0",
41 | "webpack-cli": "^3.2.1"
42 | },
43 | "scripts": {
44 | "lint": "eslint --ext .js,.ts,.tsx .",
45 | "lint:fix": "eslint --ext .js,.ts,.tsx . --fix",
46 | "test": "jest",
47 | "test:dev": "jest --watch",
48 | "start": "webpack --watch",
49 | "build": "webpack --mode production"
50 | },
51 | "jest": {
52 | "setupFiles": [
53 | "./src/setupTests.js"
54 | ]
55 | },
56 | "keywords": [
57 | "react",
58 | "svgloaders",
59 | "svg",
60 | "loaders",
61 | "loader",
62 | "loading",
63 | "spinners",
64 | "spinner"
65 | ],
66 | "author": "Adam Wanninger",
67 | "license": "MIT"
68 | }
69 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | export * from './svg-loader-components/audio.js';
2 | export * from './svg-loader-components/ball-triangle.js';
3 | export * from './svg-loader-components/bars.js';
4 | export * from './svg-loader-components/circles.js';
5 | export * from './svg-loader-components/grid.js';
6 | export * from './svg-loader-components/hearts.js';
7 | export * from './svg-loader-components/oval.js';
8 | export * from './svg-loader-components/puff.js';
9 | export * from './svg-loader-components/rings.js';
10 | export * from './svg-loader-components/spinning-circles.js';
11 | export * from './svg-loader-components/tail-spin.js';
12 | export * from './svg-loader-components/three-dots.js';
13 |
--------------------------------------------------------------------------------
/src/index.js.example:
--------------------------------------------------------------------------------
1 | export * from './svg-loader-components/example.js'
2 |
--------------------------------------------------------------------------------
/src/setupTests.js:
--------------------------------------------------------------------------------
1 | import 'jsdom-global/register';
2 |
3 | import { configure } from 'enzyme';
4 | import Adapter from '@cfaester/enzyme-adapter-react-18';
5 |
6 | configure({ adapter: new Adapter() });
7 |
--------------------------------------------------------------------------------
/src/svg-loader-components/audio.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const Audio = ({
4 | className = undefined, // String
5 | ...props
6 | }) => (
7 |
51 | );
52 |
53 | export { Audio };
54 |
--------------------------------------------------------------------------------
/src/svg-loader-components/ball-triangle.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const BallTriangle = ({
4 | className = undefined, // String
5 | ...props
6 | }) => (
7 |
76 | );
77 |
78 | export { BallTriangle };
79 |
--------------------------------------------------------------------------------
/src/svg-loader-components/bars.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const Bars = ({
4 | className = undefined, // String
5 | ...props
6 | }) => (
7 |
99 | );
100 |
101 | export { Bars };
102 |
--------------------------------------------------------------------------------
/src/svg-loader-components/circles.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const Circles = ({
4 | className = undefined, // String
5 | ...props
6 | }) => (
7 |
29 | );
30 |
31 | export { Circles };
32 |
--------------------------------------------------------------------------------
/src/svg-loader-components/grid.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const Grid = ({
4 | className = undefined, // String
5 | ...props
6 | }) => (
7 |
99 | );
100 |
101 | export { Grid };
102 |
--------------------------------------------------------------------------------
/src/svg-loader-components/hearts.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const Hearts = ({
4 | className = undefined, // String
5 | ...props
6 | }) => (
7 |
36 | );
37 |
38 | export { Hearts };
39 |
--------------------------------------------------------------------------------
/src/svg-loader-components/oval.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const Oval = ({
4 | className = undefined, // String
5 | ...props
6 | }) => (
7 |
27 | );
28 |
29 | export { Oval };
30 |
--------------------------------------------------------------------------------
/src/svg-loader-components/puff.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const Puff = ({
4 | className = undefined, // String
5 | ...props
6 | }) => (
7 |
55 | );
56 |
57 | export { Puff };
58 |
--------------------------------------------------------------------------------
/src/svg-loader-components/rings.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const Rings = ({
4 | className = undefined, // String
5 | ...props
6 | }) => (
7 |
78 | );
79 |
80 | export { Rings };
81 |
--------------------------------------------------------------------------------
/src/svg-loader-components/spinning-circles.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const SpinningCircles = ({
4 | className = undefined, // String
5 | ...props
6 | }) => (
7 |
97 | );
98 |
99 | export { SpinningCircles };
100 |
--------------------------------------------------------------------------------
/src/svg-loader-components/tail-spin.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const TailSpin = ({
4 | className = undefined, // String
5 | ...props
6 | }) => (
7 |
48 | );
49 |
50 | export { TailSpin };
51 |
--------------------------------------------------------------------------------
/src/svg-loader-components/three-dots.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const ThreeDots = ({
4 | className = undefined, // String
5 | ...props
6 | }) => (
7 |
75 | );
76 |
77 | export { ThreeDots };
78 |
--------------------------------------------------------------------------------
/test/audio.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow, mount } from 'enzyme';
3 |
4 | import { Audio } from '../src/svg-loader-components/audio';
5 |
6 | describe('Test ', () => {
7 | it('renders without crashing', () => {
8 | shallow();
9 | });
10 | it('viewBox property is defined', () => {
11 | const AudioComponent = mount().find('svg');
12 | expect(AudioComponent.prop('viewBox')).toBeDefined();
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/test/ball-triangle.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow, mount } from 'enzyme';
3 |
4 | import { BallTriangle } from '../src/svg-loader-components/ball-triangle';
5 |
6 | describe('Test ', () => {
7 | it('renders without crashing', () => {
8 | shallow();
9 | });
10 | it('viewBox property is defined', () => {
11 | const BallTriangleComponent = mount().find('svg');
12 | expect(BallTriangleComponent.prop('viewBox')).toBeDefined();
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/test/bars.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow, mount } from 'enzyme';
3 |
4 | import { Bars } from '../src/svg-loader-components/bars';
5 |
6 | describe('Test ', () => {
7 | it('renders without crashing', () => {
8 | shallow();
9 | });
10 | it('viewBox property is defined', () => {
11 | const BarsComponent = mount().find('svg');
12 | expect(BarsComponent.prop('viewBox')).toBeDefined();
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/test/circles.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow, mount } from 'enzyme';
3 |
4 | import { Circles } from '../src/svg-loader-components/circles';
5 |
6 | describe('Test ', () => {
7 | it('renders without crashing', () => {
8 | shallow();
9 | });
10 | it('viewBox property is defined', () => {
11 | const CirclesComponent = mount().find('svg');
12 | expect(CirclesComponent.prop('viewBox')).toBeDefined();
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/test/grid.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow, mount } from 'enzyme';
3 |
4 | import { Grid } from '../src/svg-loader-components/grid';
5 |
6 | describe('Test ', () => {
7 | it('renders without crashing', () => {
8 | shallow();
9 | });
10 | it('viewBox property is defined', () => {
11 | const GridComponent = mount().find('svg');
12 | expect(GridComponent.prop('viewBox')).toBeDefined();
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/test/hearts.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow, mount } from 'enzyme';
3 |
4 | import { Hearts } from '../src/svg-loader-components/hearts';
5 |
6 | describe('Test ', () => {
7 | it('renders without crashing', () => {
8 | shallow();
9 | });
10 | it('viewBox property is defined', () => {
11 | const HeartsComponent = mount().find('svg');
12 | expect(HeartsComponent.prop('viewBox')).toBeDefined();
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/test/oval.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow, mount } from 'enzyme';
3 |
4 | import { Oval } from '../src/svg-loader-components/oval';
5 |
6 | describe('Test ', () => {
7 | it('renders without crashing', () => {
8 | shallow();
9 | });
10 | it('viewBox property is defined', () => {
11 | const OvalComponent = mount().find('svg');
12 | expect(OvalComponent.prop('viewBox')).toBeDefined();
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/test/puff.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow, mount } from 'enzyme';
3 |
4 | import { Puff } from '../src/svg-loader-components/puff';
5 |
6 | describe('Test ', () => {
7 | it('renders without crashing', () => {
8 | shallow();
9 | });
10 | it('viewBox property is defined', () => {
11 | const PuffComponent = mount().find('svg');
12 | expect(PuffComponent.prop('viewBox')).toBeDefined();
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/test/rings.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow, mount } from 'enzyme';
3 |
4 | import { Rings } from '../src/svg-loader-components/rings';
5 |
6 | describe('Test ', () => {
7 | it('renders without crashing', () => {
8 | shallow();
9 | });
10 | it('viewBox property is defined', () => {
11 | const RingsComponent = mount().find('svg');
12 | expect(RingsComponent.prop('viewBox')).toBeDefined();
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/test/spinning-circles.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow, mount } from 'enzyme';
3 |
4 | import { SpinningCircles } from '../src/svg-loader-components/spinning-circles';
5 |
6 | describe('Test ', () => {
7 | it('renders without crashing', () => {
8 | shallow();
9 | });
10 | it('viewBox property is defined', () => {
11 | const SpinningCirclesComponent = mount().find('svg');
12 | expect(SpinningCirclesComponent.prop('viewBox')).toBeDefined();
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/test/tail-spin.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow, mount } from 'enzyme';
3 |
4 | import { TailSpin } from '../src/svg-loader-components/tail-spin';
5 |
6 | describe('Test ', () => {
7 | it('renders without crashing', () => {
8 | shallow();
9 | });
10 | it('viewBox property is defined', () => {
11 | const TailSpinComponent = mount().find('svg');
12 | expect(TailSpinComponent.prop('viewBox')).toBeDefined();
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/test/three-dots.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow, mount } from 'enzyme';
3 |
4 | import { ThreeDots } from '../src/svg-loader-components/three-dots';
5 |
6 | describe('Test ', () => {
7 | it('renders without crashing', () => {
8 | shallow();
9 | });
10 | it('viewBox property is defined', () => {
11 | const ThreeDotsComponent = mount().find('svg');
12 | expect(ThreeDotsComponent.prop('viewBox')).toBeDefined();
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 |
3 | module.exports = {
4 | entry: './src/index.js',
5 | output: {
6 | path: path.resolve(__dirname, 'dist'),
7 | filename: 'index.js',
8 | libraryTarget: 'commonjs2',
9 | },
10 | module: {
11 | rules: [
12 | {
13 | test: /\.js$/,
14 | include: path.resolve(__dirname, 'src'),
15 | exclude: /(node_modules|bower_components|dist)/,
16 | use: {
17 | loader: 'babel-loader',
18 | options: {
19 | presets: ['@babel/preset-env'],
20 | plugins: ['@babel/plugin-proposal-object-rest-spread']
21 | }
22 | }
23 | },
24 | ],
25 | },
26 | externals: {
27 | react: {
28 | commonjs: 'react',
29 | commonjs2: 'react',
30 | amd: 'React',
31 | root: 'React',
32 | },
33 | 'react-dom': {
34 | commonjs: 'react-dom',
35 | commonjs2: 'react-dom',
36 | amd: 'ReactDOM',
37 | root: 'ReactDOM',
38 | },
39 | },
40 | };
41 |
--------------------------------------------------------------------------------