Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component will not render a prop as a class that has the same string in elementClasses #151

Closed
kienD opened this issue Aug 16, 2016 · 0 comments
Assignees
Labels

Comments

@kienD
Copy link
Contributor

kienD commented Aug 16, 2016

Given the following component:

import Component, {Config} from 'metal-jsx';

class TestComponent1 extends Component {
    render() {
        return (
            <div class={this.props.name}>
                <h1>{"Hi!"}</h1>
            </div>
        );
    }
}

TestComponent1.props = {
    name: Config.string()
};

class TestComponent2 extends Component {
    render() {
        return (
            <TestComponent1 elementClasses="testClass" name="a-randomtestClassthat-will-fail" />
        );
    }
}

export default TestComponent2;

This is what is rendered:

<div class="testClass">
  <h1>"Hi!"</h1>
</div>

This is what I expected:

<div class="testClass a-randomtestClassthat-will-fail">
  <h1>"Hi!"</h1>
</div>

The class that I'm creating by passing in the "name" prop isn't being added to the class of the outer wrapping div in the child component.

This will occur as long as the string for "name" contains the same word that is passed in as "elementClasses", regardless of what is prepending or appending the word.

This occurred after updating to [email protected].

@mairatma mairatma self-assigned this Aug 29, 2016
@mairatma mairatma added the bug label Aug 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants