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

Simplify testSelector() function #25

Merged
merged 1 commit into from
Oct 6, 2016
Merged

Conversation

Turbo87
Copy link
Collaborator

@Turbo87 Turbo87 commented Sep 29, 2016

Ternary operators are often considered harder to read, but in this case I think it simplifies the logic quite a bit.

}
return selector;
};
return isNone(value) ? `[data-test-${key}]` : `[data-test-${key}="${value}"]`;
Copy link
Contributor

@pangratz pangratz Sep 30, 2016

Choose a reason for hiding this comment

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

I like the explicit version better:

if (isNone(value)) {
  return `[data-test-${key}]`;
} else {
  return `[data-test-${key}="${value}"]`;
}

But the proposed changes are fine with me too. Definitely better than the !isNone()...

@marcoow marcoow merged commit ac8fb7b into mainmatter:master Oct 6, 2016
@chriskrycho
Copy link
Contributor

👍

Can we get a new release pushed to NPM? That'd be super helpful.

@Turbo87 Turbo87 deleted the simplify branch November 22, 2016 16:08
@marcoow
Copy link
Member

marcoow commented Nov 23, 2016

marcoow pushed a commit that referenced this pull request Nov 23, 2016
@chriskrycho
Copy link
Contributor

Thanks!

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

Successfully merging this pull request may close these issues.

4 participants