Skip to content

Commit

Permalink
Replace 'uuid' package with 'consecutive' package, for more predictab…
Browse files Browse the repository at this point in the history
…le id attributes.
  • Loading branch information
ryami333 committed Oct 6, 2017
1 parent 936d956 commit 15c0324
Show file tree
Hide file tree
Showing 4 changed files with 794 additions and 571 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -94,7 +94,7 @@
},
"dependencies": {
"classnames": "^2.2.5",
"uuid": "^3.0.1"
"consecutive": "^5.0.4"
},
"peerDependencies": {
"react": "^15.4.0 || ^16.0.0",
Expand Down
6 changes: 4 additions & 2 deletions src/AccordionItem/accordion-item.js
Expand Up @@ -2,9 +2,11 @@

import React, { Component } from 'react';
import type { Node } from 'react';
import uuid from 'uuid';
import consecutive from 'consecutive';
import classNames from 'classnames';

const nextUuid = consecutive();

type AccordionItemProps = {
accordion: boolean,
expanded: boolean,
Expand All @@ -28,7 +30,7 @@ class AccordionItem extends Component<AccordionItemProps, AccordionItemState> {
};

state = {
itemUuid: uuid.v4(),
itemUuid: nextUuid(),
};

renderChildren() {
Expand Down
4 changes: 1 addition & 3 deletions src/AccordionItem/accordion-item.spec.js
Expand Up @@ -7,9 +7,7 @@ import AccordionItemTitle from '../AccordionItemTitle/accordion-item-title';
import AccordionItemBody from '../AccordionItemBody/accordion-item-body';
import AccordionItem from './accordion-item';

jest.mock('uuid', () => ({
v4: () => 'mock-uuid-hash',
}));
jest.mock('consecutive', () => () => () => 'mock-uuid-hash');

jest.mock('../AccordionItemTitle/accordion-item-title', () => {
const RealReact = require.requireActual('react');
Expand Down

0 comments on commit 15c0324

Please sign in to comment.