mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Added Android back button support to action sheet, modal
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
describe('Ionic Modal', function() {
|
||||
var modal, q;
|
||||
var modal, q, timeout;
|
||||
|
||||
beforeEach(module('ionic.service.modal'));
|
||||
|
||||
beforeEach(inject(function($ionicModal, $q, $templateCache) {
|
||||
beforeEach(inject(function($ionicModal, $q, $templateCache, $timeout) {
|
||||
q = $q;
|
||||
modal = $ionicModal;
|
||||
timeout = $timeout;
|
||||
|
||||
$templateCache.put('modal.html', '<div class="modal"></div>');
|
||||
}));
|
||||
@@ -18,7 +19,7 @@ describe('Ionic Modal', function() {
|
||||
expect(modalInstance.el.classList.contains('slide-in-up')).toBe(true);
|
||||
});
|
||||
|
||||
xit('Should show for dynamic template', function() {
|
||||
it('Should show for dynamic template', function() {
|
||||
var template = '<div class="modal"></div>';
|
||||
|
||||
var done = false;
|
||||
@@ -27,11 +28,30 @@ describe('Ionic Modal', function() {
|
||||
done = true;
|
||||
modalInstance.show();
|
||||
expect(modalInstance.el.classList.contains('modal')).toBe(true);
|
||||
expect(modalInstance.el.classList.contains('active')).toBe(true);
|
||||
});
|
||||
|
||||
timeout.flush();
|
||||
|
||||
waitsFor(function() {
|
||||
return done;
|
||||
}, "Modal should be loaded", 100);
|
||||
|
||||
});
|
||||
|
||||
it('Should close on hardware back button', function() {
|
||||
var template = '<div class="modal"></div>';
|
||||
var modalInstance = modal.fromTemplate(template);
|
||||
modalInstance.show();
|
||||
|
||||
timeout.flush();
|
||||
|
||||
expect(modalInstance.el.classList.contains('active')).toBe(true);
|
||||
|
||||
ionic.trigger('backbutton', {
|
||||
target: document
|
||||
});
|
||||
|
||||
expect(modalInstance.el.classList.contains('active')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user