FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: WrappedValue.unwrap empty string behavior by the-reality-engineer · Pull Request #6900 · NativeScript/NativeScript · GitHub

fix: WrappedValue.unwrap empty string behavior - #6900

Merged
manoldonev merged 7 commits into
NativeScript:masterfrom
the-reality-engineer:patch-2
Mar 14, 2019
Merged

manoldonev merged 7 commits into
NativeScript:masterfrom
the-reality-engineer:patch-2

Conversation

Copy link
Copy Markdown
Contributor

Currently:

var value = new WrappedValue('') // passing empty string
console.log(WrappedValue.unwrap(value) === '' ) // prints "false"

Now:

var value = new WrappedValue('') // passing empty string
console.log(WrappedValue.unwrap(value) === '' ) // prints "true"

PR Checklist

What is the current behavior?

What is the new behavior?

Fixes/Implements/Closes #[Issue Number].

Currently:
```
var value = new WrappedValue('') // passing empty string
console.log(WrappedValue.unwrap(value) === '' ) // prints "false"
```

Now:
```
var value = new WrappedValue('') // passing empty string
console.log(WrappedValue.unwrap(value) === '' ) // prints "true"
```
ghost added the ♥ community PR label Feb 13, 2019
ghost assigned manoldonev Feb 22, 2019
ghost added in progress and removed ♥ community PR labels Feb 22, 2019
manoldonev changed the title Fix WrappedValue.unwrap fix: WrappedValue.unwrap empty string behavior Feb 22, 2019

Copy link
Copy Markdown
Contributor

@speigg there are failing unit tests with this change:

JS: Test: --- [XML-DECLARATION.test_TabViewHasCorrectParentChain] FAILED: Cannot use 'in' operator to search for 'wrapped' in true, Stack: TypeError: Cannot use 'in' operator to search for 'wrapped' in true

You can run the unit tests locally like this:

cd tests
tns run android

vakrilov left a comment •
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

As @manoldonev pointed out - the proposed solution fails when unwrap is given a boolean value.
Lets just make an instanceof check:

return (value instanceof WrappedValue) ? value.wrapped : value;

Also, can you add some unit-tests about this case. You can check this guide on how to do that.

vakrilov assigned vakrilov and unassigned manoldonev Feb 26, 2019

Copy link
Copy Markdown
Contributor

@cla-bot check

cla-bot Bot commented Feb 27, 2019

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

ghost assigned manoldonev Mar 12, 2019

Copy link
Copy Markdown
Contributor Author

@manoldonev thanks for taking care of this, I haven't had time to work on this myself

Copy link
Copy Markdown
Contributor

test

manoldonev merged commit 0482460 into NativeScript:master Mar 14, 2019
ghost removed the in progress label Mar 14, 2019

lock Bot commented Mar 17, 2020

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock Bot locked and limited conversation to collaborators Mar 17, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL