Closed tsvetomir closed 7 years ago
Moving this issue to the Q1 milestone as it'll likely require breaking changes in the components API
Additional info regarding the then
/ done
methods :
then
method callsHere is the way to migrate existing then
method usages to be compatible with both jQuery 3 & existing versions:
1) then
method is called with single argument. In this case the widget code should be untouched and only the tests should be updated. The tests can be upgraded by:
jasmine.clock().install()
method inside the tests module setup
functionjasmine.clock().uninstall()
method inside the tests module teardown
functionjasmine.clock().tick()
method inside the failing sync testsBefore:
test("sync calls change after destroy", function() {
var model = dataSource.get(1),
wasCalled = false;
dataSource.remove(model);
dataSource.bind("change", function() {
wasCalled = true;
});
dataSource.sync();
ok(wasCalled);
});
After:
test("sync calls change after destroy", function() {
var model = dataSource.get(1),
wasCalled = false;
dataSource.remove(model);
dataSource.bind("change", function() {
wasCalled = true;
});
dataSource.sync();
jasmine.clock().tick();
ok(wasCalled);
});
2) then
method is called with two arguments. In this case we can replace the function call with done
and fail
methods to maintain compatibility. The tests will not require updates.
Before:
return this[method]({ id: model.id }).then(
proxy(this._modelLoaded, this, model.id),
proxy(this._modelError, this, model.id)
);
After:
return this[method]({ id: model.id })
.done(proxy(this._modelLoaded, this, model.id))
.fail(proxy(this._modelError, this, model.id));
No breaking changes were necessary in the end. The fixes will be included in releases 2016.3.1116 and later.
We're validating our components for operation with jQuery 3 and fixing issues as they're discovered. Some work already has been done in as part of #1877