diff options
author | Phil Hughes <me@iamphill.com> | 2017-07-19 12:36:08 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-07-19 12:36:08 +0300 |
commit | 7505417478011e489e011c3cabf71c11a75e5da2 (patch) | |
tree | b0d1f8493c81f41c9c73aa5240e513ce7b71d926 /spec/javascripts/fly_out_nav_spec.js | |
parent | ad633afdec35b4f972706b71e50fad652f65d112 (diff) |
moved JS & only run when new_nav cookie exists
Diffstat (limited to 'spec/javascripts/fly_out_nav_spec.js')
-rw-r--r-- | spec/javascripts/fly_out_nav_spec.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/javascripts/fly_out_nav_spec.js b/spec/javascripts/fly_out_nav_spec.js new file mode 100644 index 00000000000..bbf3eb6f582 --- /dev/null +++ b/spec/javascripts/fly_out_nav_spec.js @@ -0,0 +1,37 @@ +import { calculateTop, createArrowStyles } from '~/fly_out_nav'; + +describe('Fly out sidebar navigation', () => { + describe('calculateTop', () => { + it('returns boundingRect top', () => { + const boundingRect = { + top: 100, + }; + + expect( + calculateTop(boundingRect, 100), + ).toBe(100); + }); + + it('returns boundingRect - bottomOverflow', () => { + const boundingRect = { + top: window.innerHeight, + }; + + expect( + calculateTop(boundingRect, 100), + ).toBe(window.innerHeight - 100); + }); + }); + + describe('createArrowStyles', () => { + it('returns translate3d styles', () => { + const boundingRect = { + top: 100, + }; + + expect( + createArrowStyles(boundingRect, 50), + ).toContain('translate3d(0, 50px, 0)'); + }); + }); +}); |