mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(toggle): fix ngChange being reported before model changes
Closes #1349, #1741 BREAKING CHANGE: ion-toggle no longer has an isolate scope. This will break your toggle only if you were relying upon the toggle having an isolate scope: if you were referencing `$parent.value` as the ng-disabled attribute, for example. Change your code from this: <ion-toggle ng-disabled="{{$parent.isDisabled}}"></ion-toggle> To this: <ion-toggle ng-disabled="{{isDisabled}}"></ion-toggle>
This commit is contained in:
@@ -10,16 +10,16 @@ describe('Ionic Toggle', function() {
|
||||
}));
|
||||
|
||||
it('Should load', function() {
|
||||
var toggleView = el.isolateScope().toggle;
|
||||
var toggleView = el.scope().toggle;
|
||||
expect(toggleView).not.toEqual(null);
|
||||
expect(toggleView.checkbox).not.toEqual(null);
|
||||
expect(toggleView.handle).not.toEqual(null);
|
||||
});
|
||||
|
||||
it('Should destroy', function() {
|
||||
var toggleView = el.isolateScope().toggle;
|
||||
var toggleView = el.scope().toggle;
|
||||
spyOn(toggleView, 'destroy');
|
||||
el.isolateScope().$destroy();
|
||||
el.scope().$destroy();
|
||||
expect(toggleView.destroy).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@ describe('Ionic Toggle', function() {
|
||||
|
||||
// Grab fields
|
||||
var label = el[0].querySelector('label');
|
||||
var toggle = el.isolateScope().toggle;
|
||||
var toggle = el.scope().toggle;
|
||||
var input = el[0].querySelector('input');
|
||||
|
||||
// Not disabled, we can toggle
|
||||
@@ -59,7 +59,7 @@ describe('Ionic Toggle', function() {
|
||||
});
|
||||
|
||||
it('Should toggle', function() {
|
||||
var toggle = el.isolateScope().toggle;
|
||||
var toggle = el.scope().toggle;
|
||||
var label = el[0].querySelector('label');
|
||||
expect(toggle.val()).toBe(false);
|
||||
ionic.trigger('click', {target: label});
|
||||
|
||||
Reference in New Issue
Block a user