mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-11 23:17:48 +00:00
Make product modal show close button only if there is a scroll bar
This commit is contained in:
@@ -16,3 +16,24 @@ describe "ProductNodeCtrl", ->
|
||||
|
||||
it "puts a reference to supplier in the scope", ->
|
||||
expect(scope.enterprise).toBe product.supplier
|
||||
|
||||
describe "#hasVerticalScrollBar", ->
|
||||
it "returns false if modal element is not found", ->
|
||||
spyOn(angular, 'element').and.returnValue([])
|
||||
|
||||
expect(scope.hasVerticalScrollBar()).toBe false
|
||||
|
||||
it "returns false if scrollHeight is equal to clientHeight", ->
|
||||
spyOn(angular, 'element').and.returnValue([{ scrollHeight: 100, clientHeight: 100 }])
|
||||
|
||||
expect(scope.hasVerticalScrollBar()).toBe false
|
||||
|
||||
it "returns false if scrollHeight is smaller than clientHeight", ->
|
||||
spyOn(angular, 'element').and.returnValue([{ scrollHeight: 50, clientHeight: 100 }])
|
||||
|
||||
expect(scope.hasVerticalScrollBar()).toBe false
|
||||
|
||||
it "returns true if scrollHeight is bigger than clientHeight", ->
|
||||
spyOn(angular, 'element').and.returnValue([{ scrollHeight: 100, clientHeight: 50 }])
|
||||
|
||||
expect(scope.hasVerticalScrollBar()).toBe true
|
||||
|
||||
Reference in New Issue
Block a user