🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

angular-loading-overlay

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-loading-overlay - npm Package Compare versions

Comparing version

to
0.3.1

Gemfile.lock

4

dist/angular-loading-overlay.js

@@ -10,4 +10,4 @@ !function() {

var globalConfig = bsLoadingOverlayService.getGlobalConfig();
referenceId = $attributes.bsLoadingOverlayReferenceId, delay = +$attributes.bsLoadingOverlayDelay || globalConfig.delay,
activeClass = $attributes.bsLoadingOverlayActiveClass || globalConfig.activeClass;
referenceId = $attributes.bsLoadingOverlayReferenceId || $attributes.bsLoadingOverlay,
delay = +$attributes.bsLoadingOverlayDelay || globalConfig.delay, activeClass = $attributes.bsLoadingOverlayActiveClass || globalConfig.activeClass;
var templateUrl = $attributes.bsLoadingOverlayTemplateUrl || globalConfig.templateUrl;

@@ -14,0 +14,0 @@ templatePromise = templateUrl ? $templateRequest(templateUrl) : $q.when(!1), templatePromise.then(function(loadedTemplate) {

{
"name": "angular-loading-overlay",
"version": "0.2.0",
"version": "0.3.1",
"description": "Service and directive to manipulate overlays on async operations.",

@@ -10,12 +10,13 @@ "repository": {

"scripts": {
"test-watch": "node_modules/karma/bin/karma start",
"test": "node_modules/karma/bin/karma start --single-run",
"prepush": "npm test && npm build && git add -u",
"watch": "node_modules/grunt-cli/bin/grunt watch",
"build": "node_modules/grunt-cli/bin/grunt build",
"build-dev": "node_modules/grunt-cli/bin/grunt build-dev",
"check": "node_modules/grunt-cli/bin/grunt check"
"test-watch": "karma start",
"test": "karma start --single-run",
"prepush": "npm test && npm run build && git add -u",
"watch": "grunt watch",
"build": "grunt build",
"build-dev": "grunt build-dev",
"check": "grunt check"
},
"author": "Oleksandr Beshchuk <bs.alex.mail@gmail.com>",
"license": "Apache-2.0",
"main": "./dist/angular-loading-overlay.js",
"devDependencies": {

@@ -22,0 +23,0 @@ "angular": "^1.5.0-beta.0",

@@ -1,2 +0,2 @@

(function() {
(function () {
'use strict';

@@ -30,3 +30,3 @@

var globalConfig = bsLoadingOverlayService.getGlobalConfig();
referenceId = $attributes.bsLoadingOverlayReferenceId;
referenceId = $attributes.bsLoadingOverlayReferenceId || $attributes.bsLoadingOverlay;
delay = +$attributes.bsLoadingOverlayDelay || globalConfig.delay;

@@ -42,3 +42,3 @@ activeClass = $attributes.bsLoadingOverlayActiveClass || globalConfig.activeClass;

templatePromise.then(function(loadedTemplate) {
templatePromise.then(function (loadedTemplate) {
overlayElement = $compile(loadedTemplate)(scope);

@@ -49,3 +49,3 @@ overlayElement.isAttached = false;

var unsubscribe = $rootScope.$on('bsLoadingOverlayUpdateEvent', function(event, options) {
var unsubscribe = $rootScope.$on('bsLoadingOverlayUpdateEvent', function (event, options) {
if (options.referenceId === referenceId) {

@@ -90,3 +90,3 @@ updateOverlayElement(referenceId);

delayPromise.then(function() {
delayPromise.then(function () {
overlayElement.detach();

@@ -93,0 +93,0 @@

@@ -1,5 +0,5 @@

(function() {
(function () {
'use strict';
describe("bsLoadingOverlay directive", function() {
describe("bsLoadingOverlay directive", function () {
var bsLoadingOverlayService,

@@ -16,8 +16,18 @@ bsLoadingOverlayServiceMock,

beforeEach(function() {
function getCompiledElement(template, scope) {
var element;
scope.$apply(function () {
element = $compile(template)(scope);
});
return element;
}
beforeEach(function () {
module('bsLoadingOverlay');
module(function($provide) {
module(function ($provide) {
$provide.value('bsLoadingOverlayService', bsLoadingOverlayService);
$provide.decorator('$timeout', function($delegate) {
$provide.decorator('$timeout', function ($delegate) {
return sinon.spy($delegate);

@@ -43,3 +53,3 @@ });

inject(function(_$compile_, _$rootScope_, _$q_, _$document_, _$templateCache_, _$timeout_) {
inject(function (_$compile_, _$rootScope_, _$q_, _$document_, _$templateCache_, _$timeout_) {
$compile = _$compile_;

@@ -56,7 +66,4 @@ scope = _$rootScope_.$new();

it("should compile", function() {
var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
it("should compile", function () {
var element = getCompiledElement(template, scope);

@@ -67,9 +74,6 @@ expect(element[0]).toBeDefined();

it("should not add overlay when reference is not active", function() {
it("should not add overlay when reference is not active", function () {
bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(false);
var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);

@@ -80,9 +84,6 @@ expect(element[0].querySelector('.bs-loading-overlay')).toBeNull();

it("should add overlay when reference is active", function() {
it("should add overlay when reference is active", function () {
bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(true);
var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);

@@ -93,10 +94,31 @@ expect(element[0].querySelector('.bs-loading-overlay')).not.toBeNull();

it("should not add overlay when reference templateUrl is false in global config and not set in directive", function() {
describe("with reference set by directive name attribute", function () {
beforeEach(function () {
template = '<div bs-loading-overlay="referenceId"></div>';
});
it("should not add overlay when reference is not active", function () {
bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(false);
var element = getCompiledElement(template, scope);
expect(element[0].querySelector('.bs-loading-overlay')).toBeNull();
bsLoadingOverlayServiceMock.verify();
});
it("should add overlay when reference is active", function () {
bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(true);
var element = getCompiledElement(template, scope);
expect(element[0].querySelector('.bs-loading-overlay')).not.toBeNull();
bsLoadingOverlayServiceMock.verify();
});
});
it("should not add overlay when reference templateUrl is false in global config and not set in directive", function () {
bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(true);
defaultConfig.templateUrl = false;
var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);

@@ -107,3 +129,3 @@ expect(element[0].querySelector('.bs-loading-overlay')).toBeNull();

it("should reuse the same element on start stop and start again", function() {
it("should reuse the same element on start stop and start again", function () {
bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(true);

@@ -113,6 +135,3 @@ bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(false);

var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);

@@ -133,3 +152,3 @@ element[0].querySelector('.bs-loading-overlay').testProperty = 1;

it("should add overlay element using provided templateUrl when reference is active", function() {
it("should add overlay element using provided templateUrl when reference is active", function () {
$templateCache.put('some-template.html', '<div class="from-template-url"></div>');

@@ -140,6 +159,3 @@ template = '<div bs-loading-overlay bs-loading-overlay-template-url="some-template.html" bs-loading-overlay-reference-id="referenceId">';

var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);

@@ -150,3 +166,3 @@ expect(element[0].querySelector('.from-template-url')).not.toBeNull();

describe("with global config", function() {
describe("with global config", function () {
var globalConfig = {

@@ -157,3 +173,3 @@ templateUrl: 'global-template-url.html',

beforeEach(function() {
beforeEach(function () {
bsLoadingOverlayServiceMock.restore();

@@ -168,7 +184,4 @@ bsLoadingOverlayServiceMock = sinon.mock(bsLoadingOverlayService);

it("should use templateUrl from global config if it is not provided directly into directive", function() {
var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
it("should use templateUrl from global config if it is not provided directly into directive", function () {
var element = getCompiledElement(template, scope);

@@ -178,7 +191,4 @@ expect(element[0].querySelector('.from-global-template-url')).not.toBeNull();

it("should use active class from global config if it is not provided directly into directive", function() {
var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
it("should use active class from global config if it is not provided directly into directive", function () {
var element = getCompiledElement(template, scope);

@@ -188,11 +198,8 @@ expect(element.hasClass('globalActiveClass')).toBeTruthy();

it("should use delay from global config if it is not provided directly into directive", function() {
it("should use delay from global config if it is not provided directly into directive", function () {
globalConfig.delay = 1000;
bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(false);
var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
scope.$apply(function() {
var element = getCompiledElement(template, scope);
scope.$apply(function () {
$rootScope.$emit('bsLoadingOverlayUpdateEvent', {

@@ -209,4 +216,4 @@ referenceId: referenceId

describe("with delay", function() {
it("should call timeout with correct args if delay is set", function() {
describe("with delay", function () {
it("should call timeout with correct args if delay is set", function () {
template = '<div bs-loading-overlay bs-loading-overlay-delay="5000" bs-loading-overlay-reference-id="referenceId">';

@@ -216,6 +223,3 @@ bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(true);

var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);

@@ -230,3 +234,3 @@ $rootScope.$emit('bsLoadingOverlayUpdateEvent', {

it("should not remove overlay element until timer is triggered", function() {
it("should not remove overlay element until timer is triggered", function () {
template = '<div bs-loading-overlay bs-loading-overlay-delay="5000" bs-loading-overlay-reference-id="referenceId">';

@@ -236,6 +240,3 @@ bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(true);

var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);

@@ -250,3 +251,3 @@ $rootScope.$emit('bsLoadingOverlayUpdateEvent', {

it("should remove overlay element when timer is triggered", function() {
it("should remove overlay element when timer is triggered", function () {
template = '<div bs-loading-overlay bs-loading-overlay-delay="5000" bs-loading-overlay-reference-id="referenceId">';

@@ -256,6 +257,3 @@ bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(true);

var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);

@@ -272,3 +270,3 @@ $rootScope.$emit('bsLoadingOverlayUpdateEvent', {

it("should not remove overlay element when timer is triggered, but overlay became active again", function() {
it("should not remove overlay element when timer is triggered, but overlay became active again", function () {
template = '<div bs-loading-overlay bs-loading-overlay-delay="5000" bs-loading-overlay-reference-id="referenceId">';

@@ -279,6 +277,3 @@ bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(true);

var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);

@@ -299,3 +294,3 @@ $rootScope.$emit('bsLoadingOverlayUpdateEvent', {

it("should not remove overlay element until timeout triggered on second stop", function() {
it("should not remove overlay element until timeout triggered on second stop", function () {
template = '<div bs-loading-overlay bs-loading-overlay-delay="5000" bs-loading-overlay-reference-id="referenceId">';

@@ -307,6 +302,3 @@ bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(true);

var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);

@@ -331,3 +323,3 @@ $rootScope.$emit('bsLoadingOverlayUpdateEvent', {

it("should remove overlay element when timeout triggered on second stop", function() {
it("should remove overlay element when timeout triggered on second stop", function () {
template = '<div bs-loading-overlay bs-loading-overlay-delay="5000" bs-loading-overlay-reference-id="referenceId">';

@@ -339,6 +331,3 @@ bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(true);

var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);

@@ -365,3 +354,3 @@ $rootScope.$emit('bsLoadingOverlayUpdateEvent', {

it("should not call timeout if delay is not set", function() {
it("should not call timeout if delay is not set", function () {
template = '<div bs-loading-overlay bs-loading-overlay-reference-id="referenceId">';

@@ -371,6 +360,3 @@ bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(true);

var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);

@@ -386,4 +372,4 @@ $rootScope.$emit('bsLoadingOverlayUpdateEvent', {

describe("with two loader overlays", function() {
it("should be able to render two loaders with different templates and references", function() {
describe("with two loader overlays", function () {
it("should be able to render two loaders with different templates and references", function () {
$templateCache.put('some-template.html', '<div class="from-template-url"></div>');

@@ -399,6 +385,4 @@ $templateCache.put('some-another-template.html', '<div class="from-another-template-url"></div>');

scope.$apply(function() {
element = $compile(template)(scope);
anotherElement = $compile(anotherTemplate)(scope);
});
var element = getCompiledElement(template, scope);
var anotherElement = getCompiledElement(anotherTemplate, scope);

@@ -410,3 +394,3 @@ expect(element[0].querySelector('.from-template-url')).not.toBeNull();

it("should be able to render and show two loaders with same referenceId and template", function() {
it("should be able to render and show two loaders with same referenceId and template", function () {
$templateCache.put('some-template.html', '<div class="from-template-url"></div>');

@@ -417,9 +401,5 @@ template = '<div bs-loading-overlay bs-loading-overlay-template-url="some-template.html" bs-loading-overlay-reference-id="referenceId">';

var element, anotherElement;
var element = getCompiledElement(template, scope);
var anotherElement = getCompiledElement(template, scope);
scope.$apply(function() {
element = $compile(template)(scope);
anotherElement = $compile(template)(scope);
});
expect(element[0].querySelector('.from-template-url')).not.toBeNull();

@@ -430,3 +410,3 @@ expect(anotherElement[0].querySelector('.from-template-url')).not.toBeNull();

it("should be able to render two loaders with same referenceId but different templates", function() {
it("should be able to render two loaders with same referenceId but different templates", function () {
$templateCache.put('some-template.html', '<div class="from-template-url"></div>');

@@ -439,9 +419,5 @@ $templateCache.put('some-another-template.html', '<div class="from-another-template-url"></div>');

var element, anotherElement;
var element = getCompiledElement(template, scope);
var anotherElement = getCompiledElement(anotherTemplate, scope);
scope.$apply(function() {
element = $compile(template)(scope);
anotherElement = $compile(anotherTemplate)(scope);
});
expect(element[0].querySelector('.from-template-url')).not.toBeNull();

@@ -452,3 +428,3 @@ expect(anotherElement[0].querySelector('.from-another-template-url')).not.toBeNull();

it("should be able to render two loaders with different referenceId but same templates", function() {
it("should be able to render two loaders with different referenceId but same templates", function () {
$templateCache.put('some-template.html', '<div class="from-template-url"></div>');

@@ -461,9 +437,5 @@ template = '<div bs-loading-overlay bs-loading-overlay-template-url="some-template.html" bs-loading-overlay-reference-id="referenceId">';

var element, anotherElement;
var element = getCompiledElement(template, scope);
var anotherElement = getCompiledElement(anotherTemplate, scope);
scope.$apply(function() {
element = $compile(template)(scope);
anotherElement = $compile(anotherTemplate)(scope);
});
expect(element[0].querySelector('.from-template-url')).not.toBeNull();

@@ -474,3 +446,3 @@ expect(anotherElement[0].querySelector('.from-template-url')).not.toBeNull();

it("should be able to render two loaders with different referenceId and templates then hide and show first", function() {
it("should be able to render two loaders with different referenceId and templates then hide and show first", function () {
$templateCache.put('some-template.html', '<div class="from-template-url"></div>');

@@ -486,9 +458,5 @@ $templateCache.put('some-another-template.html', '<div class="from-another-template-url"></div>');

var element, anotherElement;
var element = getCompiledElement(template, scope);
var anotherElement = getCompiledElement(anotherTemplate, scope);
scope.$apply(function() {
element = $compile(template)(scope);
anotherElement = $compile(anotherTemplate)(scope);
});
$rootScope.$emit('bsLoadingOverlayUpdateEvent', {

@@ -512,3 +480,3 @@ referenceId: referenceId

it("should remove overlay with provided templateUrl class if reference became inactive and update event emitted", function() {
it("should remove overlay with provided templateUrl class if reference became inactive and update event emitted", function () {
$templateCache.put('some-template.html', '<div class="from-template-url"></div>');

@@ -525,8 +493,5 @@ template = '<div bs-loading-overlay bs-loading-overlay-template-url="some-template.html" bs-loading-overlay-reference-id="referenceId">';

var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);
scope.$apply(function() {
scope.$apply(function () {
$rootScope.$emit('bsLoadingOverlayUpdateEvent', {

@@ -540,9 +505,6 @@ referenceId: referenceId

it("should add overlay class when reference is active", function() {
it("should add overlay class when reference is active", function () {
bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(true);
var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);

@@ -552,10 +514,7 @@ expect(element.hasClass('bs-loading-overlay--active')).toBeTruthy();

it("should add overlay class when reference is active event if templateUrl is false", function() {
it("should add overlay class when reference is active event if templateUrl is false", function () {
defaultConfig.templateUrl = false;
bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(true);
var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);

@@ -565,10 +524,7 @@ expect(element.hasClass('bs-loading-overlay--active')).toBeTruthy();

it("should not add overlay class when it is false in global config and not provided to directive", function() {
it("should not add overlay class when it is false in global config and not provided to directive", function () {
defaultConfig.activeClass = false;
bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(true);
var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);

@@ -578,3 +534,3 @@ expect(element.hasClass('bs-loading-overlay--active')).toBeFalsy();

it("should remove overlay class if reference became inactive and update event emitted", function() {
it("should remove overlay class if reference became inactive and update event emitted", function () {
bsLoadingOverlayServiceMock.expects('isActive')

@@ -588,8 +544,5 @@ .twice()

var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);
scope.$apply(function() {
scope.$apply(function () {
$rootScope.$emit('bsLoadingOverlayUpdateEvent', {

@@ -603,3 +556,3 @@ referenceId: referenceId

it("should remove overlay class if reference became inactive and update event emitted and templateUrl is false", function() {
it("should remove overlay class if reference became inactive and update event emitted and templateUrl is false", function () {
defaultConfig.templateUrl = false;

@@ -614,8 +567,5 @@ bsLoadingOverlayServiceMock.expects('isActive')

var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);
scope.$apply(function() {
scope.$apply(function () {
$rootScope.$emit('bsLoadingOverlayUpdateEvent', {

@@ -629,14 +579,11 @@ referenceId: referenceId

describe("with custom class", function() {
beforeEach(function() {
describe("with custom class", function () {
beforeEach(function () {
template = '<div bs-loading-overlay bs-loading-overlay-active-class="some-active-class" bs-loading-overlay-reference-id="referenceId">';
});
it("should add overlay custom class when reference is active", function() {
it("should add overlay custom class when reference is active", function () {
bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(true);
var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);

@@ -646,3 +593,3 @@ expect(element.hasClass('some-active-class')).toBeTruthy();

it("should remove overlay custom class if reference became inactive and update event emitted", function() {
it("should remove overlay custom class if reference became inactive and update event emitted", function () {
bsLoadingOverlayServiceMock.expects('isActive')

@@ -656,8 +603,5 @@ .twice()

var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);
scope.$apply(function() {
scope.$apply(function () {
$rootScope.$emit('bsLoadingOverlayUpdateEvent', {

@@ -672,3 +616,3 @@ referenceId: referenceId

it("should remove overlay if reference became inactive and update event emitted", function() {
it("should remove overlay if reference became inactive and update event emitted", function () {
bsLoadingOverlayServiceMock.expects('isActive')

@@ -682,7 +626,4 @@ .twice()

var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
scope.$apply(function() {
var element = getCompiledElement(template, scope);
scope.$apply(function () {
$rootScope.$emit('bsLoadingOverlayUpdateEvent', {

@@ -696,3 +637,3 @@ referenceId: referenceId

it("should not remove overlay if reference became inactive and update event is not emitted", function() {
it("should not remove overlay if reference became inactive and update event is not emitted", function () {
bsLoadingOverlayServiceMock.expects('isActive')

@@ -704,6 +645,3 @@ .twice()

var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);

@@ -713,9 +651,6 @@ expect(element[0].querySelector('.bs-loading-overlay')).not.toBeNull();

it("should add overlay when rootScope event triggered and reference become active", function() {
it("should add overlay when rootScope event triggered and reference become active", function () {
bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(false);
var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);

@@ -731,7 +666,4 @@ bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(true);

it("should not add overlay when reference become active but rootScope event is not triggered", function() {
var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
it("should not add overlay when reference become active but rootScope event is not triggered", function () {
var element = getCompiledElement(template, scope);

@@ -743,9 +675,6 @@ bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(true);

it("should remove rootScope listener on overlay element removed", function() {
var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
it("should remove rootScope listener on overlay element removed", function () {
var element = getCompiledElement(template, scope);
scope.$apply(function() {
scope.$apply(function () {
element.remove();

@@ -757,9 +686,6 @@ });

it("should not add overlay when rootScope event triggered for another reference", function() {
it("should not add overlay when rootScope event triggered for another reference", function () {
bsLoadingOverlayServiceMock.expects('isActive').once().withArgs(referenceId).returns(false);
var element;
scope.$apply(function() {
element = $compile(template)(scope);
});
var element = getCompiledElement(template, scope);

@@ -766,0 +692,0 @@ $rootScope.$emit('bsLoadingOverlayUpdateEvent', {

@@ -1,2 +0,2 @@

(function() {
(function () {
"use strict";

@@ -3,0 +3,0 @@

@@ -1,2 +0,2 @@

(function() {
(function () {
'use strict';

@@ -35,3 +35,3 @@

if(!angular.isFunction(promiseFunction)) {
if (!angular.isFunction(promiseFunction)) {
promise = function () {

@@ -51,3 +51,3 @@ return promiseFunction;

stop: stop.bind(null, options),
wrap: function(promiseFunction) {
wrap: function (promiseFunction) {
return wrap(promiseFunction, options);

@@ -54,0 +54,0 @@ }

@@ -1,2 +0,2 @@

(function() {
(function () {
"use strict";

@@ -8,12 +8,12 @@

inject: ['$rootScope', 'bsLoadingOverlayService', '$q'],
tests: function(dependencies) {
it("should exist", function() {
tests: function (dependencies) {
it("should exist", function () {
expect(dependencies.bsLoadingOverlayService).toBeDefined();
});
describe("handlers", function() {
describe("handlers", function () {
var overlayHandler,
referenceId;
beforeEach(function() {
beforeEach(function () {
referenceId = 'referenceId';

@@ -25,4 +25,4 @@ overlayHandler = dependencies.bsLoadingOverlayService.createHandler({

it("should emit rootScope event on start with referenceId in options", function(done) {
dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', function(event, options) {
it("should emit rootScope event on start with referenceId in options", function (done) {
dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', function (event, options) {
expect(options.referenceId).toEqual(referenceId);

@@ -35,4 +35,4 @@ done();

it("should emit rootScope event on stop with referenceId in options", function(done) {
dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', function(event, options) {
it("should emit rootScope event on stop with referenceId in options", function (done) {
dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', function (event, options) {
expect(options.referenceId).toEqual(referenceId);

@@ -46,3 +46,3 @@ done();

describe("wrapper", function() {
describe("wrapper", function () {
var overlayHandler,

@@ -58,10 +58,10 @@ referenceId,

beforeEach(function() {
beforeEach(function () {
referenceId = 'referenceId';
func1 = function() {
func1 = function () {
return dependencies.$q.when(1);
};
func2 = function() {
func2 = function () {
return dependencies.$q.when(2);

@@ -79,5 +79,5 @@ };

it("should wrap provided function returning promise in start and stop functions", function() {
dependencies.$rootScope.$apply(function() {
dependencies.bsLoadingOverlayService.wrap(function() {
it("should wrap provided function returning promise in start and stop functions", function () {
dependencies.$rootScope.$apply(function () {
dependencies.bsLoadingOverlayService.wrap(function () {
return t.func1().then(t.func2);

@@ -95,4 +95,4 @@ }, {

it("should wrap provided promise in start and stop functions", function() {
dependencies.$rootScope.$apply(function() {
it("should wrap provided promise in start and stop functions", function () {
dependencies.$rootScope.$apply(function () {
dependencies.bsLoadingOverlayService.wrap(t.func1().then(t.func2), {

@@ -109,5 +109,5 @@ referenceId: referenceId

it("should hide overlay if provided promise failed", function() {
dependencies.$rootScope.$apply(function() {
dependencies.bsLoadingOverlayService.wrap(function() {
it("should hide overlay if provided promise failed", function () {
dependencies.$rootScope.$apply(function () {
dependencies.bsLoadingOverlayService.wrap(function () {
return dependencies.$q.reject();

@@ -123,4 +123,4 @@ }, {

describe("global config", function() {
it("should be able to set and get global config", function() {
describe("global config", function () {
it("should be able to set and get global config", function () {
var config = {

@@ -136,7 +136,7 @@ option1: 1,

it("should return global empty object as global config by default", function() {
it("should return global empty object as global config by default", function () {
expect(dependencies.bsLoadingOverlayService.getGlobalConfig()).toEqual({});
});
it("should extend global config", function() {
it("should extend global config", function () {
var config = {

@@ -162,3 +162,3 @@ option1: 1,

describe("handler wrapper", function() {
describe("handler wrapper", function () {
var overlayHandler,

@@ -175,10 +175,10 @@ referenceId,

beforeEach(function() {
beforeEach(function () {
referenceId = 'referenceId';
func1 = function() {
func1 = function () {
return dependencies.$q.when(1);
};
func2 = function() {
func2 = function () {
return dependencies.$q.when(2);

@@ -200,5 +200,5 @@ };

it("should wrap provided function returning promise in start and stop functions", function() {
dependencies.$rootScope.$apply(function() {
handler.wrap(function() {
it("should wrap provided function returning promise in start and stop functions", function () {
dependencies.$rootScope.$apply(function () {
handler.wrap(function () {
return t.func1().then(t.func2);

@@ -214,4 +214,4 @@ });

it("should wrap provided promise in start and stop functions", function() {
dependencies.$rootScope.$apply(function() {
it("should wrap provided promise in start and stop functions", function () {
dependencies.$rootScope.$apply(function () {
handler.wrap(t.func1().then(t.func2), {

@@ -228,5 +228,5 @@ referenceId: referenceId

it("should hide overlay if provided promise failed", function() {
dependencies.$rootScope.$apply(function() {
handler.wrap(function() {
it("should hide overlay if provided promise failed", function () {
dependencies.$rootScope.$apply(function () {
handler.wrap(function () {
return dependencies.$q.reject();

@@ -240,5 +240,5 @@ });

describe("without referenceId", function() {
it("should emit rootScope event on start", function(done) {
dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', function() {
describe("without referenceId", function () {
it("should emit rootScope event on start", function (done) {
dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', function () {
done();

@@ -250,3 +250,3 @@ });

it("should indicate that loadingOverlay is active after start", function() {
it("should indicate that loadingOverlay is active after start", function () {
dependencies.bsLoadingOverlayService.start();

@@ -257,7 +257,7 @@

it("should indicate that loadingOverlay is not active by default", function() {
it("should indicate that loadingOverlay is not active by default", function () {
expect(dependencies.bsLoadingOverlayService.isActive()).toBeFalsy();
});
it("should indicate that loadingOverlay is not active after stop", function() {
it("should indicate that loadingOverlay is not active after stop", function () {
dependencies.bsLoadingOverlayService.start();

@@ -269,4 +269,4 @@ dependencies.bsLoadingOverlayService.stop();

it("should emit rootScope event on stop", function(done) {
dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', function() {
it("should emit rootScope event on stop", function (done) {
dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', function () {
done();

@@ -279,10 +279,10 @@ });

describe("with referenceId", function() {
describe("with referenceId", function () {
var referenceId;
beforeEach(function() {
beforeEach(function () {
referenceId = 'referenceId';
});
it("should emit rootScope event on start", function(done) {
dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', function() {
it("should emit rootScope event on start", function (done) {
dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', function () {
done();

@@ -296,4 +296,4 @@ });

it("should emit rootScope event on stop", function(done) {
dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', function() {
it("should emit rootScope event on stop", function (done) {
dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', function () {
done();

@@ -307,4 +307,4 @@ });

it("should emit rootScope event on start with referenceId in options", function(done) {
dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', function(event, options) {
it("should emit rootScope event on start with referenceId in options", function (done) {
dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', function (event, options) {
expect(options.referenceId).toEqual(referenceId);

@@ -319,4 +319,4 @@ done();

it("should emit rootScope event on stop with referenceId in options", function(done) {
dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', function(event, options) {
it("should emit rootScope event on stop with referenceId in options", function (done) {
dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', function (event, options) {
expect(options.referenceId).toEqual(referenceId);

@@ -331,3 +331,3 @@ done();

it("should not make other references active on start", function() {
it("should not make other references active on start", function () {
dependencies.bsLoadingOverlayService.start({

@@ -340,3 +340,3 @@ referenceId: referenceId

it("should not be marked as active on other reference start", function() {
it("should not be marked as active on other reference start", function () {
dependencies.bsLoadingOverlayService.start({

@@ -349,3 +349,3 @@ referenceId: 'otherReference'

it("should not stop other references on stop", function() {
it("should not stop other references on stop", function () {
dependencies.bsLoadingOverlayService.start({

@@ -366,3 +366,3 @@ referenceId: referenceId

it("should indicate that loadingOverlay is active after start", function() {
it("should indicate that loadingOverlay is active after start", function () {
dependencies.bsLoadingOverlayService.start({

@@ -375,7 +375,7 @@ referenceId: referenceId

it("should indicate that loadingOverlay is not active by default", function() {
it("should indicate that loadingOverlay is not active by default", function () {
expect(dependencies.bsLoadingOverlayService.isActive(referenceId)).toBeFalsy();
});
it("should indicate that loadingOverlay is not active after stop", function() {
it("should indicate that loadingOverlay is not active after stop", function () {
dependencies.bsLoadingOverlayService.start({

@@ -382,0 +382,0 @@ referenceId: referenceId