mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
41 lines
1.4 KiB
JavaScript
41 lines
1.4 KiB
JavaScript
describe('$ionicBackdrop service', function() {
|
|
beforeEach(module('ionic'));
|
|
|
|
beforeEach(inject(function($animate) {
|
|
ionic.requestAnimationFrame = function(cb) { cb(); };
|
|
}));
|
|
|
|
it('should add active on retain', inject(function($ionicBackdrop) {
|
|
var el = $ionicBackdrop._element;
|
|
expect(el.hasClass('active')).toBe(false);
|
|
$ionicBackdrop.retain();
|
|
expect(el.hasClass('active')).toBe(true);
|
|
}));
|
|
|
|
it('should add and remove active on retain and release', inject(function($ionicBackdrop) {
|
|
var el = $ionicBackdrop._element;
|
|
expect(el.hasClass('active')).toBe(false);
|
|
$ionicBackdrop.retain();
|
|
expect(el.hasClass('active')).toBe(true);
|
|
$ionicBackdrop.release();
|
|
expect(el.hasClass('active')).toBe(false);
|
|
}));
|
|
|
|
it('should require equal releases and retains', inject(function($ionicBackdrop) {
|
|
var el = $ionicBackdrop._element;
|
|
expect(el.hasClass('active')).toBe(false);
|
|
$ionicBackdrop.retain();
|
|
expect(el.hasClass('active')).toBe(true);
|
|
$ionicBackdrop.retain();
|
|
expect(el.hasClass('active')).toBe(true);
|
|
$ionicBackdrop.retain();
|
|
expect(el.hasClass('active')).toBe(true);
|
|
$ionicBackdrop.release();
|
|
expect(el.hasClass('active')).toBe(true);
|
|
$ionicBackdrop.release();
|
|
expect(el.hasClass('active')).toBe(true);
|
|
$ionicBackdrop.release();
|
|
expect(el.hasClass('active')).toBe(false);
|
|
}));
|
|
});
|