-
Notifications
You must be signed in to change notification settings - Fork 1.9k
changes for event box component #2710
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
changes for event box component #2710
Conversation
| }, | ||
| locationName: function () { | ||
| return this.event.location_name.split(",")[0]; | ||
| if(this.event.location_name){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should also check for non-empty string. This checks only for the None. Non-empty and undefined should also be checked I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
split works well with non-empty string,and since we are retrieving from model and we defined the attribute location_name as a String and initialising it to None , there is no choice for it to be returned as undefined. @SaptakS

| if(this.event.location_name){ | ||
| return this.event.location_name.split(",")[0]; | ||
| } | ||
| else{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the indentation rule of jslint to put else on the same line as closing bracket of if. Also provide spaces before opening brackets.
| return this.event.location_name.split(",")[0]; | ||
| } | ||
| else{ | ||
| return ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think returning a blank string necessary either. Please check.
|
@SaptakS made a new commit |
| }, | ||
| locationName: function () { | ||
| return this.event.location_name.split(",")[0]; | ||
| if (this.event.location_name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this check for both null and undefined. Did you try that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nikhilrayaprolu also, we need to return a default value ... Since this is a computed value
| }, | ||
| locationName: function () { | ||
| return this.event.location_name.split(",")[0]; | ||
| if (this.event.location_name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nikhilrayaprolu also, we need to return a default value ... Since this is a computed value
Current coverage is 74.82% (diff: 100%)
|
In reference to #2692 @niranjan94