From 7b792d7d496a4bebf731bb51250ef2bb5c2f9390 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 26 Sep 2013 22:38:25 -0500 Subject: [PATCH] Started header bar view --- dist/ionic.js | 22 +++++++++++++++++++++- js/views/headerBar.js | 20 ++++++++++++++++++++ test/js/views/headerBar.unit.js | 13 +++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 test/js/views/headerBar.unit.js diff --git a/dist/ionic.js b/dist/ionic.js index 41481e7a7a..f136fbe948 100644 --- a/dist/ionic.js +++ b/dist/ionic.js @@ -1692,7 +1692,27 @@ if ( document.readyState === "complete" ) { } }; })(window.ionic); -;;(function(ionic) { +;(function(ionic) { + +ionic.views.HeaderBar = function(opts) { + this.el = opts.el; + + this._titleEl = this.el.querySelector('.title'); +}; + +ionic.views.NavBar.prototype = { + resizeTitle: function() { + var e, + children = this.el.children, + index = Array.prototype.indexOf.call(children, this.el); + + for(var i = 0; i < index; i++) { + e = children[i]; + } + } +}; +})(window.ionic); +;(function(ionic) { ionic.views.NavBar = function(opts) { this.el = opts.el; diff --git a/js/views/headerBar.js b/js/views/headerBar.js index e69de29bb2..36894867ac 100644 --- a/js/views/headerBar.js +++ b/js/views/headerBar.js @@ -0,0 +1,20 @@ +(function(ionic) { + +ionic.views.HeaderBar = function(opts) { + this.el = opts.el; + + this._titleEl = this.el.querySelector('.title'); +}; + +ionic.views.NavBar.prototype = { + resizeTitle: function() { + var e, + children = this.el.children, + index = Array.prototype.indexOf.call(children, this.el); + + for(var i = 0; i < index; i++) { + e = children[i]; + } + } +}; +})(window.ionic); diff --git a/test/js/views/headerBar.unit.js b/test/js/views/headerBar.unit.js new file mode 100644 index 0000000000..26197860d8 --- /dev/null +++ b/test/js/views/headerBar.unit.js @@ -0,0 +1,13 @@ +describe('HeaderBar View', function() { + beforeEach(function() { + var h = document.createElement('header'); + h.innerHTML = 'Click

What what what

'; + h.appendChild('h1'); + }); + + it('Should init', function() { + var bar = new ionic.views.HeaderBar({ + el: h + }); + }); +});