From 0f5cb0d3d4e3c66f4002af65ba749daf90581b2d Mon Sep 17 00:00:00 2001 From: Kristofer Krause Date: Thu, 6 Apr 2017 17:13:01 -0400 Subject: [PATCH] start of Box unit tests --- test/javascript/util/box.js | 51 +++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 test/javascript/util/box.js diff --git a/test/javascript/util/box.js b/test/javascript/util/box.js new file mode 100644 index 000000000..d9947db70 --- /dev/null +++ b/test/javascript/util/box.js @@ -0,0 +1,51 @@ +describe('Foundation box', function () { + var $html; + + afterEach(function () { + if ($html) { + $html.remove(); + } + }); + + describe('GetDimensions()', function () { + it('should be unable to get dimensions for window', function(done) { + try { + Foundation.Box.GetDimensions($("window")); + + should.fail(); + } catch (err) { + done(); + } + }); + + it('should be unable to get dimensions for document', function(done) { + try { + Foundation.Box.GetDimensions($("document")); + + should.fail(); + } catch (err) { + done(); + } + }); + + it('height and width of element', function () { + $html = $('
').appendTo('body'); + + var dims = Foundation.Box.GetDimensions($("#rect-test")); + + dims.width.should.equal(200); + dims.height.should.equal(100); + }); + + it('parent height of element', function () { + $html = $('
').appendTo('body'); + + var dims = Foundation.Box.GetDimensions($("#rect-test-parent")); + + dims.width.should.equal(200); + dims.height.should.equal(100); + + dims.parentDims.height.should.equal(200); + }); + }); +}); \ No newline at end of file -- 2.47.2