Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/ng-dialog/tests/unit/ngDialog_closeThisDialog.js')
-rw-r--r--node_modules/ng-dialog/tests/unit/ngDialog_closeThisDialog.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/node_modules/ng-dialog/tests/unit/ngDialog_closeThisDialog.js b/node_modules/ng-dialog/tests/unit/ngDialog_closeThisDialog.js
new file mode 100644
index 0000000000..ef5019e0c5
--- /dev/null
+++ b/node_modules/ng-dialog/tests/unit/ngDialog_closeThisDialog.js
@@ -0,0 +1,35 @@
+describe('ngDialog', function () {
+
+ beforeEach(module('ngDialog'));
+
+ var ngDialog;
+ var $timeout;
+ var $document;
+ var $rootScope;
+ beforeEach(inject(function (_ngDialog_, _$timeout_, _$document_, _$rootScope_) {
+ ngDialog = _ngDialog_;
+ $timeout = _$timeout_;
+ $document = _$document_;
+ $rootScope = _$rootScope_;
+ }));
+
+ describe('closeThisDialog on $dialog scope', function() {
+ it('should expose closeThisDialog on the dialog scope', function() {
+ var instance = ngDialog.open();
+
+ $timeout(angular.noop, 100);
+ $timeout.flush();
+
+ var element = angular.element($document[0].getElementById(instance.id));
+ expect(element.scope().closeThisDialog).toEqual(jasmine.any(Function));
+
+ $rootScope.$on('ngDialog.closed', function($event, $dialog) {
+ expect($dialog.attr('class').indexOf('inside-directive'));
+ });
+
+ expect(ngDialog.getOpenDialogs().length).toEqual(1);
+ element.scope().closeThisDialog();
+ expect(ngDialog.getOpenDialogs().length).toEqual(0);
+ });
+ });
+});