Commit d3ee61db authored by Valentin Hervieu's avatar Valentin Hervieu

test: improve test about classes and attributes

parent 4747ab12
...@@ -81,6 +81,7 @@ describe('rzslider - ', function() { ...@@ -81,6 +81,7 @@ describe('rzslider - ', function() {
expect(element.find('span')).to.have.length(11); expect(element.find('span')).to.have.length(11);
expect(slider.range).to.be.false; expect(slider.range).to.be.false;
expect(slider.valueRange).to.equal(100); expect(slider.valueRange).to.equal(100);
expect(slider.maxH.css('display')).to.equal('none');
}); });
it('should watch rzSliderModel and reflow the slider accordingly', function() { it('should watch rzSliderModel and reflow the slider accordingly', function() {
...@@ -169,6 +170,7 @@ describe('rzslider - ', function() { ...@@ -169,6 +170,7 @@ describe('rzslider - ', function() {
expect(element.find('span')).to.have.length(11); expect(element.find('span')).to.have.length(11);
expect(slider.range).to.be.true; expect(slider.range).to.be.true;
expect(slider.valueRange).to.equal(100); expect(slider.valueRange).to.equal(100);
expect(slider.maxH.css('display')).to.equal('');
}); });
it('should watch rzSliderHigh and reflow the slider accordingly', function() { it('should watch rzSliderHigh and reflow the slider accordingly', function() {
...@@ -288,6 +290,7 @@ describe('rzslider - ', function() { ...@@ -288,6 +290,7 @@ describe('rzslider - ', function() {
expect(element[0].getBoundingClientRect().width).to.equal(1000); expect(element[0].getBoundingClientRect().width).to.equal(1000);
expect(slider.positionProperty).to.equal('left'); expect(slider.positionProperty).to.equal('left');
expect(slider.dimensionProperty).to.equal('width'); expect(slider.dimensionProperty).to.equal('width');
expect(slider.sliderElem.hasClass('vertical')).to.be.false;
}); });
it('vertical slider should take the full height and get correct position/dimension properties', function() { it('vertical slider should take the full height and get correct position/dimension properties', function() {
...@@ -297,6 +300,7 @@ describe('rzslider - ', function() { ...@@ -297,6 +300,7 @@ describe('rzslider - ', function() {
expect(element[0].getBoundingClientRect().height).to.equal(1000); expect(element[0].getBoundingClientRect().height).to.equal(1000);
expect(slider.positionProperty).to.equal('bottom'); expect(slider.positionProperty).to.equal('bottom');
expect(slider.dimensionProperty).to.equal('height'); expect(slider.dimensionProperty).to.equal('height');
expect(slider.sliderElem.hasClass('vertical')).to.be.true;
}); });
it('should prevent invalid step', function() { it('should prevent invalid step', function() {
...@@ -409,10 +413,17 @@ describe('rzslider - ', function() { ...@@ -409,10 +413,17 @@ describe('rzslider - ', function() {
createRangeSlider(sliderConf); createRangeSlider(sliderConf);
}); });
it('should set the correct class to true when draggableRange is true', function() {
scope.slider.options.draggableRange = true;
scope.$digest();
expect(slider.selBar.hasClass('rz-draggable')).to.be.true;
});
it('should set draggableRange to true when draggableRangeOnly is true', function() { it('should set draggableRange to true when draggableRangeOnly is true', function() {
scope.slider.options.draggableRangeOnly = true; scope.slider.options.draggableRangeOnly = true;
scope.$digest(); scope.$digest();
expect(slider.options.draggableRange).to.be.true; expect(slider.options.draggableRange).to.be.true;
expect(slider.selBar.hasClass('rz-draggable')).to.be.true;
}); });
it('should sanitize rzSliderModel and rzSliderHigh between floor and ceil', function() { it('should sanitize rzSliderModel and rzSliderHigh between floor and ceil', function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment