fix(popup): only override prompt input if template includes HTML

This commit is contained in:
Perry Govier
2014-08-08 15:00:19 -05:00
parent c336e8ede8
commit 044fac4d77
2 changed files with 17 additions and 1 deletions

View File

@@ -277,5 +277,16 @@ describe('$ionicPopup service', function() {
$timeout.flush();
expect($ionicBackdrop.release).toHaveBeenCalled();
}));
it('template should only overwrite prompt input if it includes html', inject(function($timeout) {
spyOn($ionicPopup, '_createPopup');
$ionicPopup.prompt({template: "Tacos!"});
params = $ionicPopup._createPopup.mostRecentCall.args;
expect(params[0].template.indexOf('<span>Tacos!</span>')).toEqual(0);
expect(params[0].template.indexOf('<input')).toBeGreaterThan(6);
$ionicPopup.prompt({template: '<input type="email" />'});
params = $ionicPopup._createPopup.mostRecentCall.args;
expect(params[0].template.indexOf('<input type="email" />')).toEqual(0);
}));
});
});