Skip to content
This repository was archived by the owner on Feb 17, 2021. It is now read-only.

Commit 4848df1

Browse files
committed
Merge pull request #87 from zimmi88/zindex
Fix blank z-index for value 0
2 parents 05fbd97 + 9d0c3cb commit 4848df1

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

src/js/hopscotch.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@
766766
}
767767

768768
// Set z-index and arrow placement
769-
el.style.zIndex = step.zindex || '';
769+
el.style.zIndex = (typeof step.zindex === 'number') ? step.zindex : 'auto';
770770
this._setArrow(step.placement);
771771

772772
// Set bubble positioning

test/js/test.hopscotch.js

+41
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,47 @@ describe('HopscotchBubble', function() {
856856
});
857857
});
858858

859+
describe('z-index', function(){
860+
var bubble;
861+
it('should set z-index if provided', function(){
862+
hopscotch.startTour({
863+
id: 'hopscotch-test-tour',
864+
steps: [ {
865+
target: 'shopping-list',
866+
orientation: 'left',
867+
title: 'Shopping List',
868+
content: 'It\'s a shopping list',
869+
zindex: 100
870+
},
871+
{
872+
target: 'shopping-list',
873+
orientation: 'left',
874+
title: 'Shopping List',
875+
content: 'It\'s a shopping list',
876+
zindex: 0
877+
},
878+
{
879+
target: 'shopping-list',
880+
orientation: 'left',
881+
title: 'Shopping List',
882+
content: 'It\'s a shopping list'
883+
}]
884+
});
885+
bubble = document.querySelector('.hopscotch-bubble');
886+
expect(bubble.style.zIndex).to.be('100');
887+
888+
hopscotch.nextStep();
889+
bubble = document.querySelector('.hopscotch-bubble');
890+
expect(bubble.style.zIndex).to.be('0');
891+
892+
hopscotch.nextStep();
893+
bubble = document.querySelector('.hopscotch-bubble');
894+
expect(bubble.style.zIndex).to.be('auto');
895+
896+
hopscotch.endTour();
897+
});
898+
});
899+
859900
describe('Buttons', function() {
860901
it('should show Skip button when specified', function() {
861902
var $nextBtnEl;

0 commit comments

Comments
 (0)