mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
describe('$ionicBackdrop service', function() {
|
|
beforeEach(module('ionic', function($provide) {
|
|
$provide.value('$$rAF', 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);
|
|
}));
|
|
});
|