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

#03 (expected , actual)  looks like the same,why? #66

Open
liuestc opened this issue Aug 19, 2016 · 2 comments
Open

#03 (expected , actual)  looks like the same,why? #66

liuestc opened this issue Aug 19, 2016 · 2 comments

Comments

@liuestc
Copy link

liuestc commented Aug 19, 2016

error:

  1. 03 - What's Your Name? should complete all tasks Task Create test-helpers for all tests #2 - don't greet user if name wasn't provided Should display welcoming message if user didn't provide their name:
  AssertionError: If user didn't enter the name (`this.state.name` length is 0), show "Hey there. Enter your name.". See the hint in task's description.
  + expected - actual

  -Hey there. Enter your name
  +Hey there. Enter your name.

looks like the same;why ?
my code :

render() {
var howdy = "Hello " + this.state.name;
if(this.state.name.length<=0)
howdy ='Hey there. Enter your name';

return (
  <div>
    <p>{howdy}</p>
    <input type="text" name="name" onChange={this.onNameChange} />
  </div>
);

}

@DzmitryU
Copy link

DzmitryU commented Dec 1, 2016

Looks like real bug. You code looks nice and work correctly.
Try my solution, that was accepted:

render() {
    var greeting = "Hello " + this.state.name;
    if (this.state.name.length == 0) {
      greeting = "Hey there. Enter your name.";
    }
    return (
      <div>
        <p>{greeting}</p>
        <input type="text" name="name" onChange={this.onNameChange} />
      </div>
    );
  }

@antonpaisov
Copy link

@liuestc well to precise there is a difference between what is expected and what you provide

-Hey there. Enter your name
+Hey there. Enter your name.

Your solution is missing . at the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants