-
Notifications
You must be signed in to change notification settings - Fork 217
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
Conversation
Remove slowCheck (dirty checking in fixed time intervals) #103
clearTimeout(observer.next); | ||
observer.next = setTimeout(() => { | ||
dirtyCheck(); | ||
}); |
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'd replace it with just
observer.next = setTimeout(dirtyCheck);
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.
@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?
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've tested it with KitchenSink, whoch is used PuppetJs
Reassigining to @tomalec for code review. |
@@ -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"}]); |
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.
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"}]);
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.
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
I have added my comments at https://github.com/Starcounter-Jack/JSON-Patch/pull/104/files |
Also if you are changing spec for |
In general I would suggest not to mix |
@aloscha's problem was that the tests for |
|
LGTM, could you check if it passes the test suite with PuppetJs/puppet-polymer-client? If so, we can marge this PR |
@tomalec It passes |
Remove slowCheck (dirty checking in fixed time intervals) #103
Change the observed events to mouseup, keyup #98