angular-bootstrap-confirm
Advanced tools
Comparing version 2.4.0 to 2.4.1
{ | ||
"name": "angular-bootstrap-confirm", | ||
"version": "2.4.0", | ||
"version": "2.4.1", | ||
"homepage": "https://github.com/mattlewis92/angular-bootstrap-confirm", | ||
@@ -30,5 +30,4 @@ "authors": [ | ||
"angular": ">=1.3.0", | ||
"bootstrap": "^3.3.5", | ||
"angular-sanitize": ">=1.3.0" | ||
} | ||
} |
@@ -0,1 +1,12 @@ | ||
<a name="2.4.1"></a> | ||
## [2.4.1](https://github.com/mattlewis92/angular-bootstrap-confirm/compare/2.4.0...v2.4.1) (2016-10-05) | ||
### Bug Fixes | ||
* ensure the popover is always destroyed after its loaded ([1f4e81d](https://github.com/mattlewis92/angular-bootstrap-confirm/commit/1f4e81d)), closes [#31](https://github.com/mattlewis92/angular-bootstrap-confirm/issues/31) | ||
* remove dependency on bootstrap ([76cff9c](https://github.com/mattlewis92/angular-bootstrap-confirm/commit/76cff9c)), closes [#30](https://github.com/mattlewis92/angular-bootstrap-confirm/issues/30) | ||
<a name="2.4.0"></a> | ||
@@ -2,0 +13,0 @@ # [2.4.0](https://github.com/mattlewis92/angular-bootstrap-confirm/compare/2.3.0...v2.4.0) (2016-09-25) |
/** | ||
* angular-bootstrap-confirm - Displays a bootstrap confirmation popover when clicking the given element. | ||
* @version v2.4.0 | ||
* @version v2.4.1 | ||
* @link https://github.com/mattlewis92/angular-bootstrap-confirm | ||
@@ -112,7 +112,8 @@ * @license MIT | ||
$templateRequest(templateUrl).then(function(template) { | ||
vm.popover = angular.element(template); | ||
vm.popover.css('display', 'none'); | ||
$compile(vm.popover)(popoverScope); | ||
$document.find('body').append(vm.popover); | ||
var popoverLoaded = $templateRequest(templateUrl).then(function(template) { | ||
var popover = angular.element(template); | ||
popover.css('display', 'none'); | ||
$compile(popover)(popoverScope); | ||
$document.find('body').append(popover); | ||
return popover; | ||
}); | ||
@@ -123,6 +124,8 @@ | ||
function positionPopover() { | ||
var position = positionService.positionElements($element, vm.popover, $attrs.placement || vm.defaults.placement, true); | ||
position.top += 'px'; | ||
position.left += 'px'; | ||
vm.popover.css(position); | ||
popoverLoaded.then(function(popover) { | ||
var position = positionService.positionElements($element, popover, $attrs.placement || vm.defaults.placement, true); | ||
position.top += 'px'; | ||
position.left += 'px'; | ||
popover.css(position); | ||
}); | ||
} | ||
@@ -133,4 +136,6 @@ | ||
if (buttonToFocus) { | ||
var targetButtonClass = buttonToFocus + '-button'; | ||
vm.popover[0].getElementsByClassName(targetButtonClass)[0].focus(); | ||
popoverLoaded.then(function(popover) { | ||
var targetButtonClass = buttonToFocus + '-button'; | ||
popover[0].getElementsByClassName(targetButtonClass)[0].focus(); | ||
}); | ||
} | ||
@@ -141,7 +146,9 @@ } | ||
if (!vm.isVisible && !evaluateOuterScopeValue($attrs.isDisabled, false)) { | ||
vm.popover.css({display: 'block'}); | ||
positionPopover(); | ||
applyFocus(); | ||
vm.isVisible = true; | ||
assignOuterScopeValue('isOpen', true); | ||
popoverLoaded.then(function(popover) { | ||
popover.css({display: 'block'}); | ||
positionPopover(); | ||
applyFocus(); | ||
vm.isVisible = true; | ||
assignOuterScopeValue('isOpen', true); | ||
}); | ||
} | ||
@@ -152,5 +159,7 @@ } | ||
if (vm.isVisible) { | ||
vm.popover.css({display: 'none'}); | ||
vm.isVisible = false; | ||
assignOuterScopeValue('isOpen', false); | ||
popoverLoaded.then(function(popover) { | ||
popover.css({display: 'none'}); | ||
vm.isVisible = false; | ||
assignOuterScopeValue('isOpen', false); | ||
}); | ||
} | ||
@@ -165,10 +174,10 @@ } | ||
} | ||
$scope.$apply(); | ||
} | ||
function documentClick(event) { | ||
if (vm.isVisible && !vm.popover[0].contains(event.target) && !$element[0].contains(event.target)) { | ||
hidePopover(); | ||
$scope.$apply(); | ||
} | ||
popoverLoaded.then(function(popover) { | ||
if (vm.isVisible && !popover[0].contains(event.target) && !$element[0].contains(event.target)) { | ||
hidePopover(); | ||
} | ||
}); | ||
} | ||
@@ -206,8 +215,10 @@ | ||
$scope.$on('$destroy', function() { | ||
vm.popover.remove(); | ||
$element.unbind('click', togglePopover); | ||
$window.removeEventListener('resize', positionPopover); | ||
$document.unbind('click', documentClick); | ||
$document.unbind('touchend', documentClick); | ||
popoverScope.$destroy(); | ||
popoverLoaded.then(function(popover) { | ||
popover.remove(); | ||
$element.unbind('click', togglePopover); | ||
$window.removeEventListener('resize', positionPopover); | ||
$document.unbind('click', documentClick); | ||
$document.unbind('touchend', documentClick); | ||
popoverScope.$destroy(); | ||
}); | ||
}); | ||
@@ -214,0 +225,0 @@ |
/** | ||
* angular-bootstrap-confirm - Displays a bootstrap confirmation popover when clicking the given element. | ||
* @version v2.4.0 | ||
* @version v2.4.1 | ||
* @link https://github.com/mattlewis92/angular-bootstrap-confirm | ||
* @license MIT | ||
*/ | ||
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("angular"),require("angular-sanitize")):"function"==typeof define&&define.amd?define(["angular","angular-sanitize"],t):"object"==typeof exports?exports.angularBootstrapConfirmModuleName=t(require("angular"),require("angular-sanitize")):n.angularBootstrapConfirmModuleName=t(n.angular,n["angular-sanitize"])}(this,function(n,t){return function(n){function t(o){if(e[o])return e[o].exports;var i=e[o]={exports:{},id:o,loaded:!1};return n[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var e={};return t.m=n,t.c=e,t.p="",t(0)}([function(n,t,e){"use strict";var o=e(1),i=e(2);e(3),e(1);var s="angular-bootstrap-confirm.html";n.exports=o.module("mwl.confirm",["ngSanitize","ui.bootstrap.position"]).run(["$templateCache",function(n){n.put(s,i)}]).controller("PopoverConfirmCtrl",["$scope","$rootScope","$element","$attrs","$compile","$document","$window","$timeout","$injector","$templateRequest","$parse","$log","confirmationPopoverDefaults",function(n,t,e,i,s,r,a,l,c,u,p,m,f){function v(t,e){var s=i[t];o.isDefined(s)&&(p(s).assign?p(s).assign(n,e):m.warn("Could not set value of "+t+" to "+e+". This is normally because the value is not a variable."))}function d(t,e,i){return o.isDefined(t)?p(t)(n,i):e}function b(){var n=T.positionElements(e,B.popover,i.placement||B.defaults.placement,!0);n.top+="px",n.left+="px",B.popover.css(n)}function $(){var n=i.focusButton||B.defaults.focusButton;if(n){var t=n+"-button";B.popover[0].getElementsByClassName(t)[0].focus()}}function g(){B.isVisible||d(i.isDisabled,!1)||(B.popover.css({display:"block"}),b(),$(),B.isVisible=!0,v("isOpen",!0))}function h(){B.isVisible&&(B.popover.css({display:"none"}),B.isVisible=!1,v("isOpen",!1))}function C(){B.isVisible?h():g(),n.$apply()}function x(t){!B.isVisible||B.popover[0].contains(t.target)||e[0].contains(t.target)||(h(),n.$apply())}var B=this;B.defaults=f,B.$attrs=i;var y=c.has("$uibPosition")?"$uibPosition":"$position",T=c.get(y),w=i.templateUrl||f.templateUrl,P=t.$new(!0);P.vm=B,u(w).then(function(n){B.popover=o.element(n),B.popover.css("display","none"),s(B.popover)(P),r.find("body").append(B.popover)}),B.isVisible=!1,B.showPopover=g,B.hidePopover=h,B.togglePopover=C,B.onConfirm=function(n){d(i.onConfirm,null,n)},B.onCancel=function(n){d(i.onCancel,null,n)},n.$watch(i.isOpen,function(n){l(function(){n?g():h()})}),e.bind("click",C),a.addEventListener("resize",b),r.bind("click",x),r.bind("touchend",x),n.$on("$destroy",function(){B.popover.remove(),e.unbind("click",C),a.removeEventListener("resize",b),r.unbind("click",x),r.unbind("touchend",x),P.$destroy()})}]).directive("mwlConfirm",function(){return{restrict:"A",controller:"PopoverConfirmCtrl"}}).value("confirmationPopoverDefaults",{confirmText:"Confirm",cancelText:"Cancel",confirmButtonType:"success",cancelButtonType:"default",placement:"top",focusButton:null,templateUrl:s,hideConfirmButton:!1,hideCancelButton:!1}).name},function(t,e){t.exports=n},function(n,t){n.exports='<div\n class="popover"\n ng-class="[vm.$attrs.placement || vm.defaults.placement, \'popover-\' + (vm.$attrs.placement || vm.defaults.placement), vm.$attrs.popoverClass || vm.defaults.popoverClass]">\n <div class="popover-arrow arrow"></div>\n <h3 class="popover-title" ng-bind-html="vm.$attrs.title"></h3>\n <div class="popover-content">\n <p ng-bind-html="vm.$attrs.message"></p>\n <div class="row">\n <div\n class="col-xs-6"\n ng-if="!vm.$attrs.hideConfirmButton && !vm.defaults.hideConfirmButton"\n ng-class="{\'col-xs-offset-3\': vm.$attrs.hideCancelButton || vm.defaults.hideCancelButton}">\n <button\n class="btn btn-block confirm-button"\n ng-class="\'btn-\' + (vm.$attrs.confirmButtonType || vm.defaults.confirmButtonType)"\n ng-click="vm.onConfirm(); vm.hidePopover()"\n ng-bind-html="vm.$attrs.confirmText || vm.defaults.confirmText">\n </button>\n </div>\n <div\n class="col-xs-6"\n ng-if="!vm.$attrs.hideCancelButton && !vm.defaults.hideCancelButton"\n ng-class="{\'col-xs-offset-3\': vm.$attrs.hideConfirmButton || vm.defaults.hideConfirmButton}">\n <button\n class="btn btn-block cancel-button"\n ng-class="\'btn-\' + (vm.$attrs.cancelButtonType || vm.defaults.cancelButtonType)"\n ng-click="vm.onCancel(); vm.hidePopover()"\n ng-bind-html="vm.$attrs.cancelText || vm.defaults.cancelText">\n </button>\n </div>\n </div>\n </div>\n</div>\n'},function(n,e){n.exports=t}])}); | ||
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("angular"),require("angular-sanitize")):"function"==typeof define&&define.amd?define(["angular","angular-sanitize"],t):"object"==typeof exports?exports.angularBootstrapConfirmModuleName=t(require("angular"),require("angular-sanitize")):n.angularBootstrapConfirmModuleName=t(n.angular,n["angular-sanitize"])}(this,function(n,t){return function(n){function t(o){if(e[o])return e[o].exports;var i=e[o]={exports:{},id:o,loaded:!1};return n[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var e={};return t.m=n,t.c=e,t.p="",t(0)}([function(n,t,e){"use strict";var o=e(1),i=e(2);e(3),e(1);var s="angular-bootstrap-confirm.html";n.exports=o.module("mwl.confirm",["ngSanitize","ui.bootstrap.position"]).run(["$templateCache",function(n){n.put(s,i)}]).controller("PopoverConfirmCtrl",["$scope","$rootScope","$element","$attrs","$compile","$document","$window","$timeout","$injector","$templateRequest","$parse","$log","confirmationPopoverDefaults",function(n,t,e,i,s,a,r,l,c,u,f,m,p){function d(t,e){var s=i[t];o.isDefined(s)&&(f(s).assign?f(s).assign(n,e):m.warn("Could not set value of "+t+" to "+e+". This is normally because the value is not a variable."))}function v(t,e,i){return o.isDefined(t)?f(t)(n,i):e}function b(){k.then(function(n){var t=T.positionElements(e,n,i.placement||B.defaults.placement,!0);t.top+="px",t.left+="px",n.css(t)})}function h(){var n=i.focusButton||B.defaults.focusButton;n&&k.then(function(t){var e=n+"-button";t[0].getElementsByClassName(e)[0].focus()})}function g(){B.isVisible||v(i.isDisabled,!1)||k.then(function(n){n.css({display:"block"}),b(),h(),B.isVisible=!0,d("isOpen",!0)})}function $(){B.isVisible&&k.then(function(n){n.css({display:"none"}),B.isVisible=!1,d("isOpen",!1)})}function C(){B.isVisible?$():g()}function x(n){k.then(function(t){!B.isVisible||t[0].contains(n.target)||e[0].contains(n.target)||$()})}var B=this;B.defaults=p,B.$attrs=i;var y=c.has("$uibPosition")?"$uibPosition":"$position",T=c.get(y),w=i.templateUrl||p.templateUrl,P=t.$new(!0);P.vm=B;var k=u(w).then(function(n){var t=o.element(n);return t.css("display","none"),s(t)(P),a.find("body").append(t),t});B.isVisible=!1,B.showPopover=g,B.hidePopover=$,B.togglePopover=C,B.onConfirm=function(n){v(i.onConfirm,null,n)},B.onCancel=function(n){v(i.onCancel,null,n)},n.$watch(i.isOpen,function(n){l(function(){n?g():$()})}),e.bind("click",C),r.addEventListener("resize",b),a.bind("click",x),a.bind("touchend",x),n.$on("$destroy",function(){k.then(function(n){n.remove(),e.unbind("click",C),r.removeEventListener("resize",b),a.unbind("click",x),a.unbind("touchend",x),P.$destroy()})})}]).directive("mwlConfirm",function(){return{restrict:"A",controller:"PopoverConfirmCtrl"}}).value("confirmationPopoverDefaults",{confirmText:"Confirm",cancelText:"Cancel",confirmButtonType:"success",cancelButtonType:"default",placement:"top",focusButton:null,templateUrl:s,hideConfirmButton:!1,hideCancelButton:!1}).name},function(t,e){t.exports=n},function(n,t){n.exports='<div\n class="popover"\n ng-class="[vm.$attrs.placement || vm.defaults.placement, \'popover-\' + (vm.$attrs.placement || vm.defaults.placement), vm.$attrs.popoverClass || vm.defaults.popoverClass]">\n <div class="popover-arrow arrow"></div>\n <h3 class="popover-title" ng-bind-html="vm.$attrs.title"></h3>\n <div class="popover-content">\n <p ng-bind-html="vm.$attrs.message"></p>\n <div class="row">\n <div\n class="col-xs-6"\n ng-if="!vm.$attrs.hideConfirmButton && !vm.defaults.hideConfirmButton"\n ng-class="{\'col-xs-offset-3\': vm.$attrs.hideCancelButton || vm.defaults.hideCancelButton}">\n <button\n class="btn btn-block confirm-button"\n ng-class="\'btn-\' + (vm.$attrs.confirmButtonType || vm.defaults.confirmButtonType)"\n ng-click="vm.onConfirm(); vm.hidePopover()"\n ng-bind-html="vm.$attrs.confirmText || vm.defaults.confirmText">\n </button>\n </div>\n <div\n class="col-xs-6"\n ng-if="!vm.$attrs.hideCancelButton && !vm.defaults.hideCancelButton"\n ng-class="{\'col-xs-offset-3\': vm.$attrs.hideConfirmButton || vm.defaults.hideConfirmButton}">\n <button\n class="btn btn-block cancel-button"\n ng-class="\'btn-\' + (vm.$attrs.cancelButtonType || vm.defaults.cancelButtonType)"\n ng-click="vm.onCancel(); vm.hidePopover()"\n ng-bind-html="vm.$attrs.cancelText || vm.defaults.cancelText">\n </button>\n </div>\n </div>\n </div>\n</div>\n'},function(n,e){n.exports=t}])}); | ||
//# sourceMappingURL=angular-bootstrap-confirm.min.js.map |
{ | ||
"name": "angular-bootstrap-confirm", | ||
"version": "2.4.0", | ||
"version": "2.4.1", | ||
"description": "Displays a bootstrap confirmation popover when clicking the given element.", | ||
@@ -43,3 +43,3 @@ "browser": "dist/angular-bootstrap-confirm.js", | ||
"cz-conventional-changelog": "~1.2.0", | ||
"eslint": "~3.6.0", | ||
"eslint": "~3.7.1", | ||
"eslint-config-mwl": "~0.5.0", | ||
@@ -56,8 +56,8 @@ "eslint-loader": "~1.5.0", | ||
"karma-coveralls": "~1.1.0", | ||
"karma-mocha": "~1.1.1", | ||
"karma-mocha": "~1.2.0", | ||
"karma-phantomjs-launcher": "~1.0.0", | ||
"karma-sourcemap-loader": "~0.3.5", | ||
"karma-webpack": "~1.8.0", | ||
"mocha": "~3.0.2", | ||
"ng-annotate-loader": "~0.1.0", | ||
"mocha": "~3.1.0", | ||
"ng-annotate-loader": "~0.2.0", | ||
"open": "0.0.5", | ||
@@ -73,4 +73,3 @@ "phantomjs-prebuilt": "~2.1.7", | ||
"angular": ">=1.3.0", | ||
"angular-sanitize": ">=1.3.0", | ||
"bootstrap": "^3.3.6" | ||
"angular-sanitize": ">=1.3.0" | ||
}, | ||
@@ -77,0 +76,0 @@ "config": { |
@@ -50,7 +50,8 @@ 'use strict'; | ||
$templateRequest(templateUrl).then(function(template) { | ||
vm.popover = angular.element(template); | ||
vm.popover.css('display', 'none'); | ||
$compile(vm.popover)(popoverScope); | ||
$document.find('body').append(vm.popover); | ||
var popoverLoaded = $templateRequest(templateUrl).then(function(template) { | ||
var popover = angular.element(template); | ||
popover.css('display', 'none'); | ||
$compile(popover)(popoverScope); | ||
$document.find('body').append(popover); | ||
return popover; | ||
}); | ||
@@ -61,6 +62,8 @@ | ||
function positionPopover() { | ||
var position = positionService.positionElements($element, vm.popover, $attrs.placement || vm.defaults.placement, true); | ||
position.top += 'px'; | ||
position.left += 'px'; | ||
vm.popover.css(position); | ||
popoverLoaded.then(function(popover) { | ||
var position = positionService.positionElements($element, popover, $attrs.placement || vm.defaults.placement, true); | ||
position.top += 'px'; | ||
position.left += 'px'; | ||
popover.css(position); | ||
}); | ||
} | ||
@@ -71,4 +74,6 @@ | ||
if (buttonToFocus) { | ||
var targetButtonClass = buttonToFocus + '-button'; | ||
vm.popover[0].getElementsByClassName(targetButtonClass)[0].focus(); | ||
popoverLoaded.then(function(popover) { | ||
var targetButtonClass = buttonToFocus + '-button'; | ||
popover[0].getElementsByClassName(targetButtonClass)[0].focus(); | ||
}); | ||
} | ||
@@ -79,7 +84,9 @@ } | ||
if (!vm.isVisible && !evaluateOuterScopeValue($attrs.isDisabled, false)) { | ||
vm.popover.css({display: 'block'}); | ||
positionPopover(); | ||
applyFocus(); | ||
vm.isVisible = true; | ||
assignOuterScopeValue('isOpen', true); | ||
popoverLoaded.then(function(popover) { | ||
popover.css({display: 'block'}); | ||
positionPopover(); | ||
applyFocus(); | ||
vm.isVisible = true; | ||
assignOuterScopeValue('isOpen', true); | ||
}); | ||
} | ||
@@ -90,5 +97,7 @@ } | ||
if (vm.isVisible) { | ||
vm.popover.css({display: 'none'}); | ||
vm.isVisible = false; | ||
assignOuterScopeValue('isOpen', false); | ||
popoverLoaded.then(function(popover) { | ||
popover.css({display: 'none'}); | ||
vm.isVisible = false; | ||
assignOuterScopeValue('isOpen', false); | ||
}); | ||
} | ||
@@ -103,10 +112,10 @@ } | ||
} | ||
$scope.$apply(); | ||
} | ||
function documentClick(event) { | ||
if (vm.isVisible && !vm.popover[0].contains(event.target) && !$element[0].contains(event.target)) { | ||
hidePopover(); | ||
$scope.$apply(); | ||
} | ||
popoverLoaded.then(function(popover) { | ||
if (vm.isVisible && !popover[0].contains(event.target) && !$element[0].contains(event.target)) { | ||
hidePopover(); | ||
} | ||
}); | ||
} | ||
@@ -144,8 +153,10 @@ | ||
$scope.$on('$destroy', function() { | ||
vm.popover.remove(); | ||
$element.unbind('click', togglePopover); | ||
$window.removeEventListener('resize', positionPopover); | ||
$document.unbind('click', documentClick); | ||
$document.unbind('touchend', documentClick); | ||
popoverScope.$destroy(); | ||
popoverLoaded.then(function(popover) { | ||
popover.remove(); | ||
$element.unbind('click', togglePopover); | ||
$window.removeEventListener('resize', positionPopover); | ||
$document.unbind('click', documentClick); | ||
$document.unbind('touchend', documentClick); | ||
popoverScope.$destroy(); | ||
}); | ||
}); | ||
@@ -152,0 +163,0 @@ |
@@ -37,7 +37,8 @@ 'use strict'; | ||
var scope, element, popover, $injector, $controller, ctrl; | ||
var scope, element, popover, $injector, $controller, ctrl, $rootScope; | ||
beforeEach(inject(function(_$controller_, $rootScope, _$injector_) { | ||
beforeEach(inject(function(_$controller_, _$injector_, _$rootScope_) { | ||
$injector = _$injector_; | ||
$controller = _$controller_; | ||
$rootScope = _$rootScope_; | ||
var body = $('body'); | ||
@@ -54,3 +55,3 @@ scope = $rootScope.$new(); | ||
}); | ||
scope.$apply(); | ||
$rootScope.$apply(); | ||
popover = body.find('.popover:first'); | ||
@@ -62,2 +63,3 @@ | ||
scope.$destroy(); | ||
$rootScope.$apply(); | ||
}); | ||
@@ -80,4 +82,6 @@ | ||
it('should show the popover', function() { | ||
$rootScope.$apply(); | ||
expect(popover.is(':visible')).to.be.false; | ||
ctrl.showPopover(); | ||
$rootScope.$apply(); | ||
expect(popover.is(':visible')).to.be.true; | ||
@@ -90,2 +94,3 @@ }); | ||
ctrl.showPopover(); | ||
$rootScope.$apply(); | ||
expect(popover.is(':visible')).to.be.false; | ||
@@ -101,4 +106,6 @@ }); | ||
ctrl.showPopover(); | ||
$rootScope.$apply(); | ||
expect(popover.is(':visible')).to.be.true; | ||
ctrl.hidePopover(); | ||
$rootScope.$apply(); | ||
expect(popover.is(':visible')).to.be.false; | ||
@@ -114,2 +121,3 @@ }); | ||
ctrl.togglePopover(); | ||
$rootScope.$apply(); | ||
expect(popover.is(':visible')).to.be.true; | ||
@@ -120,4 +128,6 @@ }); | ||
ctrl.showPopover(); | ||
$rootScope.$apply(); | ||
expect(popover.is(':visible')).to.be.true; | ||
ctrl.togglePopover(); | ||
$rootScope.$apply(); | ||
expect(popover.is(':visible')).to.be.false; | ||
@@ -132,2 +142,3 @@ }); | ||
ctrl.showPopover(); | ||
$rootScope.$apply(); | ||
}); | ||
@@ -151,2 +162,3 @@ | ||
$(element).click(); | ||
$rootScope.$apply(); | ||
expect(popover.is(':visible')).to.be.true; | ||
@@ -157,4 +169,6 @@ }); | ||
ctrl.showPopover(); | ||
$rootScope.$apply(); | ||
expect(popover.is(':visible')).to.be.true; | ||
$(element).click(); | ||
$rootScope.$apply(); | ||
expect(popover.is(':visible')).to.be.false; | ||
@@ -169,2 +183,3 @@ }); | ||
scope.$destroy(); | ||
$rootScope.$apply(); | ||
expect($('body').find('.popover').length).to.equal(0); | ||
@@ -179,12 +194,14 @@ }); | ||
var element, scope, $compile, $timeout, $document, confirmationPopoverDefaults, $log, $templateCache; | ||
var element, scope, $compile, $timeout, $document, confirmationPopoverDefaults, $log, $templateCache, $rootScope; | ||
beforeEach(inject(function(_$compile_, $rootScope, _$timeout_, _$document_, _confirmationPopoverDefaults_, _$log_, _$templateCache_) { | ||
scope = $rootScope.$new(); | ||
beforeEach(inject(function(_$compile_, _$timeout_, _$document_, _$rootScope_, | ||
_confirmationPopoverDefaults_, _$log_, _$templateCache_) { | ||
$compile = _$compile_; | ||
$timeout = _$timeout_; | ||
$document = _$document_; | ||
$rootScope = _$rootScope_; | ||
confirmationPopoverDefaults = _confirmationPopoverDefaults_; | ||
$log = _$log_; | ||
$templateCache = _$templateCache_; | ||
scope = $rootScope.$new(); | ||
})); | ||
@@ -194,2 +211,3 @@ | ||
scope.$destroy(); | ||
$rootScope.$apply(); | ||
$('body').find('.popover').remove(); | ||
@@ -309,2 +327,3 @@ }); | ||
$(element).click(); | ||
$rootScope.$apply(); | ||
expect($(popover).is(':visible')).to.be.true; | ||
@@ -314,2 +333,3 @@ var otherButton = $('<button></button>'); | ||
otherButton.click(); | ||
$rootScope.$apply(); | ||
scope.$apply(); | ||
@@ -322,4 +342,6 @@ expect($(popover).is(':visible')).to.be.false; | ||
$(element).click(); | ||
$rootScope.$apply(); | ||
expect($(popover).is(':visible')).to.be.true; | ||
$(popover).find('.popover-title').click(); | ||
$rootScope.$apply(); | ||
scope.$apply(); | ||
@@ -332,4 +354,6 @@ expect($(popover).is(':visible')).to.be.true; | ||
$(element).click(); | ||
$rootScope.$apply(); | ||
expect($(popover).is(':visible')).to.be.true; | ||
getConfirmButton(popover).click(); | ||
$rootScope.$apply(); | ||
scope.$apply(); | ||
@@ -342,4 +366,6 @@ expect($(popover).is(':visible')).to.be.false; | ||
$(element).click(); | ||
$rootScope.$apply(); | ||
expect($(popover).is(':visible')).to.be.true; | ||
getCancelButton(popover).click(); | ||
$rootScope.$apply(); | ||
scope.$apply(); | ||
@@ -360,2 +386,3 @@ expect($(popover).is(':visible')).to.be.false; | ||
$(element).click(); | ||
$rootScope.$apply(); | ||
expect(scope.isOpen).to.be.true; | ||
@@ -376,2 +403,3 @@ }); | ||
$(element).click(); | ||
$rootScope.$apply(); | ||
expect(scope.isOpen).to.be.false; | ||
@@ -385,2 +413,3 @@ }); | ||
$(element).click(); | ||
$rootScope.$apply(); | ||
}).not.to.throw(); | ||
@@ -387,0 +416,0 @@ expect($log.warn).to.have.been.calledOnce; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
98838
2
1156