From 166d3f9afdcc720e704ba138d63825ed10e40364 Mon Sep 17 00:00:00 2001 From: Dale Alexander Webb Date: Fri, 6 Nov 2015 11:28:30 +0000 Subject: [PATCH] test(modal): added unit tests for aside and modal z-index values --- src/aside/test/aside.spec.js | 22 ++++++++++++++++++++++ src/modal/test/modal.spec.js | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/src/aside/test/aside.spec.js b/src/aside/test/aside.spec.js index 882758939..ee69baa58 100644 --- a/src/aside/test/aside.spec.js +++ b/src/aside/test/aside.spec.js @@ -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() { diff --git a/src/modal/test/modal.spec.js b/src/modal/test/modal.spec.js index 3aa4dc82c..a0c175eac 100644 --- a/src/modal/test/modal.spec.js +++ b/src/modal/test/modal.spec.js @@ -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'); + }); + });