Created
June 7, 2012 22:52
-
-
Save roykolak/2892185 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/public/coffeescripts/views/thumbs/thumbs.coffee b/public/coffeescripts/views/thumbs/thumbs.coffee | |
index f861575..2cffbea 100644 | |
--- a/public/coffeescripts/views/thumbs/thumbs.coffee | |
+++ b/public/coffeescripts/views/thumbs/thumbs.coffee | |
@@ -55,6 +55,7 @@ class App.Views.Thumbs.Thumbs extends Backbone.View | |
hoverOn: (event) -> | |
return if @thumbClickInProgress | |
+ @_hideAllTooltips() | |
$(event.currentTarget).addClass('hover') | |
@infoTooltipShow(event) | |
diff --git a/public/javascripts/views/thumbs/thumbs.js b/public/javascripts/views/thumbs/thumbs.js | |
index 1d87e78..9704898 100644 | |
--- a/public/javascripts/views/thumbs/thumbs.js | |
+++ b/public/javascripts/views/thumbs/thumbs.js | |
@@ -81,6 +81,7 @@ | |
if (this.thumbClickInProgress) { | |
return; | |
} | |
+ this._hideAllTooltips(); | |
$(event.currentTarget).addClass('hover'); | |
return this.infoTooltipShow(event); | |
}; | |
diff --git a/spec/coffeescripts/views/thumbs/thumbs_spec.coffee b/spec/coffeescripts/views/thumbs/thumbs_spec.coffee | |
index 8f1b358..298bc41 100644 | |
--- a/spec/coffeescripts/views/thumbs/thumbs_spec.coffee | |
+++ b/spec/coffeescripts/views/thumbs/thumbs_spec.coffee | |
@@ -117,6 +117,12 @@ describe "App.Views.Thumbs.Thumbs", -> | |
up.trigger 'mouseenter' | |
expect(up.hasClass('hover')).toBeFalsy() | |
+ it "hides all other tooltips on hover", -> | |
+ $("#jasmine_content").append('<div id="another_tooltip" class="tooltip"></div>') | |
+ $('#another_tooltip').show() # Make sure | |
+ up.trigger 'mouseenter' | |
+ expect($('#another_tooltip')).toBeHidden() | |
+ | |
describe "when reasons are enabled", -> | |
beforeEach -> | |
collection = new App.Collections.Thumbs.Thumbs [], | |
diff --git a/spec/javascripts/views/thumbs/thumbs_spec.js b/spec/javascripts/views/thumbs/thumbs_spec.js | |
index 74e0553..d6f9127 100644 | |
--- a/spec/javascripts/views/thumbs/thumbs_spec.js | |
+++ b/spec/javascripts/views/thumbs/thumbs_spec.js | |
@@ -126,11 +126,17 @@ | |
up.trigger('mouseleave'); | |
return expect(up.hasClass('hover')).toBeFalsy(); | |
}); | |
- return it("does not hover when a thumb submit request is in progress", function() { | |
+ it("does not hover when a thumb submit request is in progress", function() { | |
up.click(); | |
up.trigger('mouseenter'); | |
return expect(up.hasClass('hover')).toBeFalsy(); | |
}); | |
+ return it("hides all other tooltips on hover", function() { | |
+ $("#jasmine_content").append('<div id="another_tooltip" class="tooltip"></div>'); | |
+ $('#another_tooltip').show(); | |
+ up.trigger('mouseenter'); | |
+ return expect($('#another_tooltip')).toBeHidden(); | |
+ }); | |
}); | |
}); | |
return describe("when reasons are enabled", function() { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment