Skip to content

Commit 8e67f19

Browse files
committed
Switch from using opacity to visibility to show/hide elements
1 parent eff2f53 commit 8e67f19

File tree

5 files changed

+31
-31
lines changed

5 files changed

+31
-31
lines changed

dist/rzslider.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*! angularjs-slider - v5.0.0 -
22
(c) Rafal Zajac <[email protected]>, Valentin Hervieu <[email protected]>, Jussi Saarivirta <[email protected]>, Angelin Sirbu <[email protected]> -
33
https://github.com/angular-slider/angularjs-slider -
4-
2016-06-30 */
4+
2016-07-01 */
55
/*jslint unparam: true */
66
/*global angular: false, console: false, define, module */
77
(function(root, factory) {
@@ -1287,7 +1287,7 @@
12871287
*/
12881288
hideEl: function(element) {
12891289
return element.css({
1290-
opacity: 0
1290+
visibility: 'hidden'
12911291
});
12921292
},
12931293

@@ -1303,7 +1303,7 @@
13031303
}
13041304

13051305
return element.css({
1306-
opacity: 1
1306+
visibility: 'visible'
13071307
});
13081308
},
13091309

dist/rzslider.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rzslider.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,7 +1291,7 @@
12911291
*/
12921292
hideEl: function(element) {
12931293
return element.css({
1294-
opacity: 0
1294+
visibility: 'hidden'
12951295
});
12961296
},
12971297

@@ -1307,7 +1307,7 @@
13071307
}
13081308

13091309
return element.css({
1310-
opacity: 1
1310+
visibility: 'visible'
13111311
});
13121312
},
13131313

tests/specs/helper-functions-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,22 +130,22 @@
130130
it('should have a valid hideEl', function() {
131131
var el = angular.element('<div></div>');
132132
helper.slider.hideEl(el);
133-
expect(el.css('opacity')).to.equal('0');
133+
expect(el.css('visibility')).to.equal('hidden');
134134
});
135135

136136
it('should have a valid showEl when not rzAlwaysHide', function() {
137137
var el = angular.element('<div></div>');
138138
helper.slider.showEl(el);
139-
expect(el.css('opacity')).to.equal('1');
139+
expect(el.css('visibility')).to.equal('visible');
140140
});
141141

142142
it('should have a valid showEl when rzAlwaysHide', function() {
143143
var el = angular.element('<div></div>');
144-
el.css('opacity', 0);
144+
el.css('visibility', 'hidden');
145145
el.rzAlwaysHide = true;
146146

147147
helper.slider.showEl(el);
148-
expect(el.css('opacity')).to.equal('0');
148+
expect(el.css('visibility')).to.equal('hidden');
149149
});
150150

151151
it('should have a valid setPosition for horizontal sliders', function() {

tests/specs/labels-test.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
}
3030
};
3131
helper.createSlider(sliderConf);
32-
expect(helper.slider.flrLab.css('opacity')).to.equal('1');
33-
expect(helper.slider.ceilLab.css('opacity')).to.equal('1');
32+
expect(helper.slider.flrLab.css('visibility')).to.equal('visible');
33+
expect(helper.slider.ceilLab.css('visibility')).to.equal('visible');
3434
});
3535

3636
it('should hide floor and display ceil labels when handle is at min', function() {
@@ -42,8 +42,8 @@
4242
}
4343
};
4444
helper.createSlider(sliderConf);
45-
expect(helper.slider.flrLab.css('opacity')).to.equal('0');
46-
expect(helper.slider.ceilLab.css('opacity')).to.equal('1');
45+
expect(helper.slider.flrLab.css('visibility')).to.equal('hidden');
46+
expect(helper.slider.ceilLab.css('visibility')).to.equal('visible');
4747
});
4848

4949
it('should show floor and hide ceil labels when handle is at max', function() {
@@ -55,8 +55,8 @@
5555
}
5656
};
5757
helper.createSlider(sliderConf);
58-
expect(helper.slider.flrLab.css('opacity')).to.equal('1');
59-
expect(helper.slider.ceilLab.css('opacity')).to.equal('0');
58+
expect(helper.slider.flrLab.css('visibility')).to.equal('visible');
59+
expect(helper.slider.ceilLab.css('visibility')).to.equal('hidden');
6060
});
6161

6262
it('should display floor and ceil labels when handle is at the middle for RTL slider', function() {
@@ -69,8 +69,8 @@
6969
}
7070
};
7171
helper.createSlider(sliderConf);
72-
expect(helper.slider.flrLab.css('opacity')).to.equal('1');
73-
expect(helper.slider.ceilLab.css('opacity')).to.equal('1');
72+
expect(helper.slider.flrLab.css('visibility')).to.equal('visible');
73+
expect(helper.slider.ceilLab.css('visibility')).to.equal('visible');
7474
});
7575

7676
it('should hide floor and display ceil labels when handle is at min for RTL slider', function() {
@@ -83,8 +83,8 @@
8383
}
8484
};
8585
helper.createSlider(sliderConf);
86-
expect(helper.slider.flrLab.css('opacity')).to.equal('0');
87-
expect(helper.slider.ceilLab.css('opacity')).to.equal('1');
86+
expect(helper.slider.flrLab.css('visibility')).to.equal('hidden');
87+
expect(helper.slider.ceilLab.css('visibility')).to.equal('visible');
8888
});
8989

9090
it('should show floor and hide ceil labels when handle is at max for RTL slider', function() {
@@ -97,8 +97,8 @@
9797
}
9898
};
9999
helper.createSlider(sliderConf);
100-
expect(helper.slider.flrLab.css('opacity')).to.equal('1');
101-
expect(helper.slider.ceilLab.css('opacity')).to.equal('0');
100+
expect(helper.slider.flrLab.css('visibility')).to.equal('visible');
101+
expect(helper.slider.ceilLab.css('visibility')).to.equal('hidden');
102102
});
103103

104104
it('should hide floor and ceil labels when minHandle is at min and maxHandle at max for range slider', function() {
@@ -111,8 +111,8 @@
111111
}
112112
};
113113
helper.createRangeSlider(sliderConf);
114-
expect(helper.slider.flrLab.css('opacity')).to.equal('0');
115-
expect(helper.slider.ceilLab.css('opacity')).to.equal('0');
114+
expect(helper.slider.flrLab.css('visibility')).to.equal('hidden');
115+
expect(helper.slider.ceilLab.css('visibility')).to.equal('hidden');
116116
});
117117

118118
it('should hide floor and ceil labels when minHandle is at min and maxHandle at max for range RTL slider', function() {
@@ -126,8 +126,8 @@
126126
}
127127
};
128128
helper.createRangeSlider(sliderConf);
129-
expect(helper.slider.flrLab.css('opacity')).to.equal('0');
130-
expect(helper.slider.ceilLab.css('opacity')).to.equal('0');
129+
expect(helper.slider.flrLab.css('visibility')).to.equal('hidden');
130+
expect(helper.slider.ceilLab.css('visibility')).to.equal('hidden');
131131
});
132132

133133
it('should hide floor and ceil labels when cmb label is overlapping, for range slider', function() {
@@ -145,8 +145,8 @@
145145
};
146146

147147
helper.createRangeSlider(sliderConf);
148-
expect(helper.slider.flrLab.css('opacity')).to.equal('0');
149-
expect(helper.slider.ceilLab.css('opacity')).to.equal('0');
148+
expect(helper.slider.flrLab.css('visibility')).to.equal('hidden');
149+
expect(helper.slider.ceilLab.css('visibility')).to.equal('hidden');
150150
});
151151

152152
it('should hide floor and ceil labels when cmb label is overlapping, for range RTL slider', function() {
@@ -164,8 +164,8 @@
164164
rightToLeft: true
165165
};
166166
helper.createRangeSlider(sliderConf);
167-
expect(helper.slider.flrLab.css('opacity')).to.equal('0');
168-
expect(helper.slider.ceilLab.css('opacity')).to.equal('0');
167+
expect(helper.slider.flrLab.css('visibility')).to.equal('hidden');
168+
expect(helper.slider.ceilLab.css('visibility')).to.equal('hidden');
169169
});
170170

171171

0 commit comments

Comments
 (0)