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

Fix json-patch check #103 #98 #104

Merged
merged 3 commits into from
May 30, 2016
Merged

Fix json-patch check #103 #98 #104

merged 3 commits into from
May 30, 2016

Conversation

aloscha
Copy link
Collaborator

@aloscha aloscha commented May 27, 2016

Remove slowCheck (dirty checking in fixed time intervals) #103
Change the observed events to mouseup, keyup #98

Remove slowCheck (dirty checking in fixed time intervals) #103
clearTimeout(observer.next);
observer.next = setTimeout(() => {
dirtyCheck();
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd replace it with just

observer.next = setTimeout(dirtyCheck);

Copy link
Collaborator

@tomalec tomalec May 30, 2016

Choose a reason for hiding this comment

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

@aloscha Have you tested it with some Polymer binding example (for example PuppetJs demo, or something with arrays - Polymer acts more asynchronously for bound arrays) that we do not need another single check after some delay?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've tested it with KitchenSink, whoch is used PuppetJs

@warpech
Copy link
Collaborator

warpech commented May 30, 2016

Reassigining to @tomalec for code review.

@warpech warpech assigned tomalec and unassigned warpech May 30, 2016
@@ -407,7 +413,7 @@ describe("duplex", function () {
obj.foo = "something";

var patches = jsonpatch.generate(observer);
expect(patches).toEqual([{op: 'replace', path: '/foo', value: "something"}]);
expect(patches).toEqual([{op: 'add', path: '/foo', value: "something"}]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems to be not correct.
Test code does not match description:

should generate replace, when undefined property is set to something

expect(patches).toEqual([{op: 'add', path: '/foo', value: "something"}]);

Copy link
Collaborator Author

@aloscha aloscha May 30, 2016

Choose a reason for hiding this comment

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

should generate replace, when undefined property is set to something

Yeah but for me it's strange, for example object.property = undefined, but if we doesn't assign to it undefined and write into console object.property, we also receive undefined.

So it's definitely add instead of replace

@tomalec
Copy link
Collaborator

tomalec commented May 30, 2016

I have added my comments at https://github.com/Starcounter-Jack/JSON-Patch/pull/104/files

@tomalec
Copy link
Collaborator

tomalec commented May 30, 2016

Also if you are changing spec for undefineds please make sure to keep it consistent with README: https://github.com/Starcounter-Jack/JSON-Patch#undefineds-json-to-js-extension

@tomalec
Copy link
Collaborator

tomalec commented May 30, 2016

In general I would suggest not to mix undefined related things to this PR, you can submit them independently, referring other applicable issues.

@warpech
Copy link
Collaborator

warpech commented May 30, 2016

Also if you are changing spec for undefineds please make sure to keep it consistent with README: https://github.com/Starcounter-Jack/JSON-Patch#undefineds-json-to-js-extension

@aloscha's problem was that the tests for undefineds were not passing. So the changes were supposed only to fix the test.

@tomalec
Copy link
Collaborator

tomalec commented May 30, 2016

  1. I would change it in separate issue and commit
  2. I would like to avoid the case when
    • README says: "We treat undefined as any other falsy value, and
    • implementation & tests works: "We tread undefined as no property specified"

@aloscha
Copy link
Collaborator Author

aloscha commented May 30, 2016

@warpech indeed.
@tomalec

  1. Ok so I rollback changes with undefined, create issue and reintroduce changes
  2. But how is it possible to commiet tests, which fail solution?

@aloscha aloscha closed this May 30, 2016
@aloscha aloscha reopened this May 30, 2016
@aloscha
Copy link
Collaborator Author

aloscha commented May 30, 2016

I've remove tests with undefinedand create new issue - #105

@tomalec could you look at it again?

@tomalec
Copy link
Collaborator

tomalec commented May 30, 2016

LGTM, could you check if it passes the test suite with PuppetJs/puppet-polymer-client? If so, we can marge this PR

@aloscha
Copy link
Collaborator Author

aloscha commented May 30, 2016

@tomalec It passes
image

@aloscha aloscha merged commit 40ff8fb into master May 30, 2016
@warpech warpech deleted the dirty_check_fix_#103_#98 branch April 19, 2017 14:39
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.

3 participants