Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add more tests

  • Loading branch information...
commit 63020866a787dc05fa1a1aef8a8cbf9f6ca6cab8 1 parent 78f996d
@kristerkari kristerkari authored
Showing with 120 additions and 2 deletions.
  1. +44 −0 tests/coffeescripts/nano-spec.coffee
  2. +76 −2 tests/spec/nano-spec.js
View
44 tests/coffeescripts/nano-spec.coffee
@@ -81,6 +81,28 @@ describe "nanoScroller (with CSS: 'width: 200px, height 200px' set to .content)"
it "should have added CSS class .flashed to .pane", ->
expect($pane).toHaveClass('flashed')
+ describe "calling $('.nano').nanoScroller({ sliderMinHeight: 120 })", ->
+ beforeEach ->
+ $nano.nanoScroller({ sliderMinHeight: 120 })
+ $slider = $nano.find('.slider')
+ it "should have set slider height to at least 120px", ->
+ expect($slider.height()).toBeGreaterThan(119)
+
+ describe "calling $('.nano').nanoScroller({ sliderMaxHeight: 21 })", ->
+ beforeEach ->
+ $nano.nanoScroller({ sliderMaxHeight: 21 })
+ $slider = $nano.find('.slider')
+ it "should not have set slider height to more than 21px", ->
+ expect($slider.height()).toBeLessThan(22)
+
+ describe "calling $('.nano').nanoScroller({ sliderMinHeight: 120, sliderMaxHeight: 120 })", ->
+ beforeEach ->
+ $nano.nanoScroller({ sliderMinHeight: 120, sliderMaxHeight: 120 })
+ $slider = $nano.find('.slider')
+ it "should have set slider height to 120px", ->
+ expect($slider).toHaveCss({ height: '120px' })
+ expect($slider.height()).toBe(120)
+
describe "when the plugin is called without any options and there is no content", ->
beforeEach ->
loadFixtures('nano-no-content.html')
@@ -152,3 +174,25 @@ describe "nanoScroller (with CSS: 'width: 200px, height 200px' set to .content)"
$pane = $nano.find('.pane')
it "should not have added CSS class .flashed to .pane", ->
expect($pane).not.toHaveClass('flashed')
+
+ describe "calling $('.nano').nanoScroller({ sliderMinHeight: 120 })", ->
+ beforeEach ->
+ $nano.nanoScroller({ sliderMinHeight: 120 })
+ $slider = $nano.find('.slider')
+ it "should have set slider height to at least 120px", ->
+ expect($slider.height()).toBeGreaterThan(119)
+
+ describe "calling $('.nano').nanoScroller({ sliderMaxHeight: 21 })", ->
+ beforeEach ->
+ $nano.nanoScroller({ sliderMaxHeight: 21 })
+ $slider = $nano.find('.slider')
+ it "should not have set slider height to more than 21px", ->
+ expect($slider.height()).toBeLessThan(22)
+
+ describe "calling $('.nano').nanoScroller({ sliderMinHeight: 120, sliderMaxHeight: 120 })", ->
+ beforeEach ->
+ $nano.nanoScroller({ sliderMinHeight: 120, sliderMaxHeight: 120 })
+ $slider = $nano.find('.slider')
+ it "should have set slider height to 120px", ->
+ expect($slider).toHaveCss({ height: '120px' })
+ expect($slider.height()).toBe(120)
View
78 tests/spec/nano-spec.js
@@ -104,7 +104,7 @@ describe("nanoScroller (with CSS: 'width: 200px, height 200px' set to .content)"
return expect($pane.css('display')).toEqual('none');
});
});
- return describe("calling $('.nano').nanoScroller({ flash: true })", function() {
+ describe("calling $('.nano').nanoScroller({ flash: true })", function() {
beforeEach(function() {
$nano.nanoScroller({
flash: true
@@ -115,6 +115,43 @@ describe("nanoScroller (with CSS: 'width: 200px, height 200px' set to .content)"
return expect($pane).toHaveClass('flashed');
});
});
+ describe("calling $('.nano').nanoScroller({ sliderMinHeight: 120 })", function() {
+ beforeEach(function() {
+ $nano.nanoScroller({
+ sliderMinHeight: 120
+ });
+ return $slider = $nano.find('.slider');
+ });
+ return it("should have set slider height to at least 120px", function() {
+ return expect($slider.height()).toBeGreaterThan(119);
+ });
+ });
+ describe("calling $('.nano').nanoScroller({ sliderMaxHeight: 21 })", function() {
+ beforeEach(function() {
+ $nano.nanoScroller({
+ sliderMaxHeight: 21
+ });
+ return $slider = $nano.find('.slider');
+ });
+ return it("should not have set slider height to more than 21px", function() {
+ return expect($slider.height()).toBeLessThan(22);
+ });
+ });
+ return describe("calling $('.nano').nanoScroller({ sliderMinHeight: 120, sliderMaxHeight: 120 })", function() {
+ beforeEach(function() {
+ $nano.nanoScroller({
+ sliderMinHeight: 120,
+ sliderMaxHeight: 120
+ });
+ return $slider = $nano.find('.slider');
+ });
+ return it("should have set slider height to 120px", function() {
+ expect($slider).toHaveCss({
+ height: '120px'
+ });
+ return expect($slider.height()).toBe(120);
+ });
+ });
});
return describe("when the plugin is called without any options and there is no content", function() {
beforeEach(function() {
@@ -207,7 +244,7 @@ describe("nanoScroller (with CSS: 'width: 200px, height 200px' set to .content)"
return expect($pane.css('display')).toEqual('none');
});
});
- return describe("calling $('.nano').nanoScroller({ flash: true })", function() {
+ describe("calling $('.nano').nanoScroller({ flash: true })", function() {
beforeEach(function() {
$nano.nanoScroller({
flash: true
@@ -218,5 +255,42 @@ describe("nanoScroller (with CSS: 'width: 200px, height 200px' set to .content)"
return expect($pane).not.toHaveClass('flashed');
});
});
+ describe("calling $('.nano').nanoScroller({ sliderMinHeight: 120 })", function() {
+ beforeEach(function() {
+ $nano.nanoScroller({
+ sliderMinHeight: 120
+ });
+ return $slider = $nano.find('.slider');
+ });
+ return it("should have set slider height to at least 120px", function() {
+ return expect($slider.height()).toBeGreaterThan(119);
+ });
+ });
+ describe("calling $('.nano').nanoScroller({ sliderMaxHeight: 21 })", function() {
+ beforeEach(function() {
+ $nano.nanoScroller({
+ sliderMaxHeight: 21
+ });
+ return $slider = $nano.find('.slider');
+ });
+ return it("should not have set slider height to more than 21px", function() {
+ return expect($slider.height()).toBeLessThan(22);
+ });
+ });
+ return describe("calling $('.nano').nanoScroller({ sliderMinHeight: 120, sliderMaxHeight: 120 })", function() {
+ beforeEach(function() {
+ $nano.nanoScroller({
+ sliderMinHeight: 120,
+ sliderMaxHeight: 120
+ });
+ return $slider = $nano.find('.slider');
+ });
+ return it("should have set slider height to 120px", function() {
+ expect($slider).toHaveCss({
+ height: '120px'
+ });
+ return expect($slider.height()).toBe(120);
+ });
+ });
});
});
Please sign in to comment.
Something went wrong with that request. Please try again.