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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions test-support/helpers/ember-test-selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,5 @@ const {
} = Ember;

export default function testSelector(key, value) {
let selector;
if (!isNone(value)) {
selector = `[data-test-${key}="${value}"]`;
} else {
selector = `[data-test-${key}]`;
}
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()...

}