Skip to content

Commit

Permalink
fix: assign a generated className to elements inside nested arrays (#292
Browse files Browse the repository at this point in the history
)
  • Loading branch information
vitaliymaz authored and gajus committed Aug 22, 2018
1 parent 982fcf5 commit 7a87ee3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
9 changes: 1 addition & 8 deletions src/linkClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,7 @@ const linkElement = (element: ReactElement, styles: Object, configuration: Objec
if (React.isValidElement(children)) {
elementShallowCopy.props.children = linkElement(React.Children.only(children), styles, configuration);
} else if (_.isArray(children) || isIterable(children)) {
elementShallowCopy.props.children = _.map(children, (node) => {
if (React.isValidElement(node)) {
// eslint-disable-next-line no-use-before-define
return linkElement(React.Children.only(node), styles, configuration);
} else {
return node;
}
});
elementShallowCopy.props.children = linkArray(objectUnfreeze(children), styles, configuration);
}

_.forEach(restProps, (propValue, propName) => {
Expand Down
27 changes: 27 additions & 0 deletions tests/linkClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,33 @@ describe('linkClass', () => {
expect(subject.props.children[0].props.className).to.equal('foo-1');
expect(subject.props.children[1].props.className).to.equal('bar-1');
});
it('assigns a generated className to elements inside nested arrays', () => {
let subject;

subject = <div>
{[
[
<p key='1' styleName='foo' />,
<p key='2' styleName='bar' />
],
[
<p key='1' styleName='foo' />,
<p key='2' styleName='bar' />
]
]}
</div>;

subject = linkClass(subject, {
bar: 'bar-1',
foo: 'foo-1'
});

expect(subject.props.children[0][0].props.className).to.equal('foo-1');
expect(subject.props.children[0][1].props.className).to.equal('bar-1');

expect(subject.props.children[1][0].props.className).to.equal('foo-1');
expect(subject.props.children[1][1].props.className).to.equal('bar-1');
});
it('styleName is deleted from props', () => {
let subject;

Expand Down

1 comment on commit 7a87ee3

@Santas-Little-Helper
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it looked like someone deleted my suggestion of a nested function dictionary on Anvil, a great way of using your Python clout to process HTTPs requests for rival claims on the IP address such as when Kali or other 'legal' hacking software uses the TOR network to wrap around your IP and do 'public interest' object wrapping, hashing and serialising along a chain of participating nodes.
To clarify, Kali has a 'paydirt' algorithm that you can use for one-off hacks; the Nusing V8 protocol - legit apps need 10 nodes min - so depends if you like defrauding node operators alone or in company ; )

I'm looking to register an app on electron.js for overnight memory address swaps. PM me if interested.

Please sign in to comment.