'
+ });
+
+ topModal = $uibModalStack.getTop();
+
+ expect(topModal.value.modalDomEl.find('#test').length).toEqual(0);
+ expect(angular.element('#test').length).toEqual(0);
+
+ $rootScope.$digest();
+
+ expect(topModal.value.modalDomEl.find('#test').text()).toEqual(expectedText);
+ expect(angular.element('#test').text()).toEqual(expectedText);
+
+ $animate.flush();
+
+ close(modalInstance, 'closing in test', true);
+ });
+
it('should not throw an exception on a second dismiss', function() {
var modal = open({template: '
Content
'});
@@ -364,7 +408,6 @@ describe('$uibModal', function () {
expect(document.activeElement.tagName).toBe('A');
var modal = open({template: '
Content
'});
- $animate.flush();
$rootScope.$digest();
expect(document.activeElement.tagName).toBe('DIV');
expect($document).toHaveModalsOpen(1);
@@ -389,7 +432,6 @@ describe('$uibModal', function () {
expect(document.activeElement.tagName).toBe('A');
var modal = open({template: '
Content
'});
- $animate.flush();
$rootScope.$digest();
expect(document.activeElement.tagName).toBe('DIV');
expect($document).toHaveModalsOpen(1);
@@ -468,7 +510,6 @@ describe('$uibModal', function () {
it('should focus on the element that has autofocus attribute when the modal is open/reopen and the animations have finished', function() {
function openAndCloseModalWithAutofocusElement() {
var modal = open({template: ''});
- $animate.flush();
$rootScope.$digest();
expect(angular.element('#auto-focus-element')).toHaveFocus();
@@ -485,7 +526,6 @@ describe('$uibModal', function () {
function openAndCloseModalWithAutofocusElement() {
var modal = open({template: ''});
- $animate.flush();
$rootScope.$digest();
expect(angular.element('#auto-focus-element')).not.toHaveFocus();
expect(angular.element('#pre-focus-element')).toHaveFocus();
@@ -501,11 +541,11 @@ describe('$uibModal', function () {
it('should wait until the in animation is finished before attempting to focus the modal or autofocus element', function() {
function openAndCloseModalWithAutofocusElement() {
- var modal = open({template: ''});
+ var modal = open({template: ''}, true, true);
expect(angular.element('#auto-focus-element')).not.toHaveFocus();
- $animate.flush();
$rootScope.$digest();
+ $animate.flush();
expect(angular.element('#auto-focus-element')).toHaveFocus();
@@ -521,11 +561,11 @@ describe('$uibModal', function () {
element.focus();
expect(document.activeElement.tagName).toBe('A');
- var modal = open({template: ''});
+ var modal = open({template: ''}, true, true);
expect(document.activeElement.tagName).toBe('A');
- $animate.flush();
$rootScope.$digest();
+ $animate.flush();
expect(document.activeElement.tagName).toBe('DIV');
@@ -788,7 +828,6 @@ describe('$uibModal', function () {
expect($document).toHaveModalsOpen(0);
$timeout.flush();
- $animate.flush();
expect($document).toHaveModalOpenWithContent('Promise', 'div');
});
@@ -886,14 +925,12 @@ describe('$uibModal', function () {
it('should contain backdrop in classes on each modal opening', function() {
var modal = open({ template: '