From 3395aceac5b8e9faed6e5d9cebc75771e01c2515 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Fri, 20 Sep 2013 15:11:56 -0500 Subject: [PATCH] Side menu controller with tests --- hacking/SideMenu.js | 22 ++++++++++++++++++++++ hacking/SideMenu.unit.js | 16 ++++++++++++++++ hacking/sideMenu.html | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 hacking/SideMenu.js create mode 100644 hacking/SideMenu.unit.js create mode 100644 hacking/sideMenu.html diff --git a/hacking/SideMenu.js b/hacking/SideMenu.js new file mode 100644 index 0000000000..c6d56312d2 --- /dev/null +++ b/hacking/SideMenu.js @@ -0,0 +1,22 @@ +(function(window, document, ionic) { + SideMenu = function(opts) { + this.el = opts.el; + this.width = opts.width; + this.isEnabled = opts.isEnabled || true; + }; + + SideMenu.prototype = { + getFullWidth: function() { + return this.width; + }, + setIsEnabled: function(isEnabled) { + this.isEnabled = isEnabled; + }, + bringUp: function() { + this.el.style.zIndex = 0; + }, + pushDown: function() { + this.el.style.zIndex = -1; + } + }; +})(this, document, ion = this.ionic || {}); diff --git a/hacking/SideMenu.unit.js b/hacking/SideMenu.unit.js new file mode 100644 index 0000000000..b077bb6d1b --- /dev/null +++ b/hacking/SideMenu.unit.js @@ -0,0 +1,16 @@ +describe('SideMenu', function() { + var menu; + + beforeEach(function() { + var d = document.createElement('div'); + menu = new SideMenu({ + el: d, + width: 270 + }); + }); + + it('Should init', function() { + expect(menu.width).toEqual(270); + expect(menu.isEnabled).toEqual(true); + }); +}); diff --git a/hacking/sideMenu.html b/hacking/sideMenu.html new file mode 100644 index 0000000000..e08c549aea --- /dev/null +++ b/hacking/sideMenu.html @@ -0,0 +1,32 @@ + + + + Side Menu + + + + + + + + +
+ +
+ +

Tab Bars

+
+ +
+

Swipe me, side to side

+
+
+ + + + + + + +