-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
fix(v-model): v-model ended with spaces #7735
Conversation
src/compiler/directives/model.js
Outdated
@@ -69,6 +69,7 @@ type ModelParseResult = { | |||
|
|||
export function parseModel (val: string): ModelParseResult { | |||
len = val.length | |||
val = val.trim() |
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.
Shouldn't this be above the previous line 🤔
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.
It's true, I fixed this in the last commit
…e condition in the test
@@ -19,6 +19,17 @@ describe('Directive v-model text', () => { | |||
}).then(done) | |||
}) | |||
|
|||
it('should not create a new property ended with spaces when', () => { |
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.
Could you add a test that fails without the fix above please? This one passes
Also, could you rename the test title to should work with extra whitespace properties
or something similar, please?
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 did not understand the part of the test. Do I create another pull request with only the test? Because the current test fails without this fix
The current test does pass without the patch you added but it should fail. I'm asking if you could add a test case that fails without the |
Hi @posva , I add a e2e that fails without the Apparently, in the unit test, it was not possible to simulate this case, I believe it only creates the new property with extra spaces only when it is typed in the browser. P.S. The extra property was only created if you pass a v-model from an object like |
You needed to add a test with a nested object 😄 |
fix #7730
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
dev
branch for v2.x (or to a previous version branch), not themaster
branchfix #xxx[,#xxx]
, where "xxx" is the issue number)If adding a new feature, the PR's description includes:
Other information: