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

defaultValue check for null #5551

Merged
merged 6 commits into from
Jun 28, 2017
Merged

Conversation

Rudraksha20
Copy link
Contributor

Worked on issue #5511, defaultValue check for Null.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 28, 2017

Thanks @Rudraksha20! Could you also please add a small note to the 1.35 section of CHANGES.md to mention that defaultValue now also checks for null?

@Rudraksha20
Copy link
Contributor Author

Updated CHANGES.md.

@hpinkos
Copy link
Contributor

hpinkos commented Jun 28, 2017

@mramato I feel like I remember having a discussion about this before. Did you have a reason for not checking null in defaultValue?

@mramato
Copy link
Contributor

mramato commented Jun 28, 2017

At one point Cesium wanted to basically pretend null doesn't exist and if it showed up anywhere, then it must be a bug. However, this proved foolish in practice because external data or DOM API calls end up giving us null values on a regular basis. There were also performance concerns at one point with doing extra checks which have long since gone away now that browsers are so much faster.

So I'm okay with this change, but someone should smokescreen the widgets and some Sandcastle examples before merging this since it could potentially have unintended consequences (though I doubt we were relying on defaultValue returning null anywhere.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 28, 2017

So I'm okay with this change, but someone should smokescreen the widgets and some Sandcastle examples before merging this since it could potentially have unintended consequences (though I doubt we were relying on defaultValue returning null anywhere.

@omh1280 could you please do this?

Copy link
Contributor

@ottaviohartman ottaviohartman left a comment

Choose a reason for hiding this comment

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

I'll do a smokescreen now. Just that one comment! Thanks @Rudraksha20

CHANGES.md Outdated
@@ -28,6 +28,7 @@ Change Log
* Added a Sandcastle demo for setting time with the Clock API [#5457](https://github.com/AnalyticalGraphicsInc/cesium/pull/5457);
* Added support for `ParticleSystem`s. [#5212](https://github.com/AnalyticalGraphicsInc/cesium/pull/5212)
* Added `Cesium.Math.randomBetween`.
* `deafultValue` updated to check for Null.
Copy link
Contributor

Choose a reason for hiding this comment

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

Spelling!

Copy link
Contributor

Choose a reason for hiding this comment

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

And link this PR in CHANGES.md

@ottaviohartman
Copy link
Contributor

ottaviohartman commented Jun 28, 2017

Everything looks good to me. Once CHANGES.md is updated it'll be good. Thanks @Rudraksha20!

@Rudraksha20
Copy link
Contributor Author

@omh1280 updated CHANGES.md.

@ottaviohartman
Copy link
Contributor

Looks good! One of the tests is failing (timeout), but it's not failing locally. This makes me think it's a Travis issue, not a code issue.

@hpinkos
Copy link
Contributor

hpinkos commented Jun 28, 2017

I think you're right @omh1280. I restarted the travis build to see if it passes.

@Rudraksha20 can you please add a unit test?

@Rudraksha20
Copy link
Contributor Author

@hpinkos, added Unit test for defaultValue.


it('Works with first parameter undefined', function() {
expect(function(){
defaultValue.defaultValue(undefined, 5);
Copy link
Contributor

Choose a reason for hiding this comment

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

This can just become expect(defaultValue(undefined,5).toEqual(5), I think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@omh1280 yup, updated with the changes.

@ottaviohartman
Copy link
Contributor

Should be good once this goes green!

@hpinkos
Copy link
Contributor

hpinkos commented Jun 28, 2017

Great work @Rudraksha20! I just tweaked the working in CHANGES.md
Thanks for reviewing @omh1280!

@hpinkos hpinkos merged commit 4c14f16 into CesiumGS:master Jun 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants