Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
test(modal): added unit tests for aside and modal z-index values
Browse files Browse the repository at this point in the history
  • Loading branch information
Dale Alexander Webb authored and mgcrea committed Nov 11, 2015
1 parent abedaa4 commit 166d3f9
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/aside/test/aside.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,28 @@ describe('aside', function () {
expect(bodyEl.find('.aside-backdrop').length).toBe(0);
});

it('should show backdrop above a previous aside dialog using the z-index value', function() {
var elm1 = compileDirective('default');
var elm2 = compileDirective('default');

expect(bodyEl.find('.aside-backdrop').length).toBe(0);

angular.element(elm1[0]).triggerHandler('click');
expect(bodyEl.find('.aside-backdrop').length).toBe(1);
var backdrop1 = bodyEl.find('.aside-backdrop')[0];
var aside1 = bodyEl.find('.aside')[0];

angular.element(elm2[0]).triggerHandler('click');
expect(bodyEl.find('.aside-backdrop').length).toBe(2);
var backdrop2 = bodyEl.find('.aside-backdrop')[0];
var aside2 = bodyEl.find('.aside')[1];

expect(angular.element(backdrop1).css('z-index')).toBe('1040');
expect(angular.element(aside1).css('z-index')).toBe('1050');
expect(angular.element(backdrop2).css('z-index')).toBe('1060');
expect(angular.element(aside2).css('z-index')).toBe('1070');
});

});

describe('keyboard', function() {
Expand Down
22 changes: 22 additions & 0 deletions src/modal/test/modal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,28 @@ describe('modal', function() {
expect(bodyEl.find('.modal-backdrop').length).toBe(0);
});

it('should show backdrop above a previous modal dialog using the z-index value', function() {
var elm1 = compileDirective('default');
var elm2 = compileDirective('default');

expect(bodyEl.find('.modal-backdrop').length).toBe(0);

angular.element(elm1[0]).triggerHandler('click');
expect(bodyEl.find('.modal-backdrop').length).toBe(1);
var backdrop1 = bodyEl.find('.modal-backdrop')[0];
var modal1 = bodyEl.find('.modal')[0];

angular.element(elm2[0]).triggerHandler('click');
expect(bodyEl.find('.modal-backdrop').length).toBe(2);
var backdrop2 = bodyEl.find('.modal-backdrop')[0];
var modal2 = bodyEl.find('.modal')[1];

expect(angular.element(backdrop1).css('z-index')).toBe('1040');
expect(angular.element(modal1).css('z-index')).toBe('1050');
expect(angular.element(backdrop2).css('z-index')).toBe('1060');
expect(angular.element(modal2).css('z-index')).toBe('1070');
});

});


Expand Down

0 comments on commit 166d3f9

Please sign in to comment.