mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
Started header bar view
This commit is contained in:
22
dist/ionic.js
vendored
22
dist/ionic.js
vendored
@ -1692,7 +1692,27 @@ if ( document.readyState === "complete" ) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
})(window.ionic);
|
})(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) {
|
ionic.views.NavBar = function(opts) {
|
||||||
this.el = opts.el;
|
this.el = opts.el;
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
13
test/js/views/headerBar.unit.js
Normal file
13
test/js/views/headerBar.unit.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
describe('HeaderBar View', function() {
|
||||||
|
beforeEach(function() {
|
||||||
|
var h = document.createElement('header');
|
||||||
|
h.innerHTML = '<a class="button">Click</a><h2 class="title">What what what</h2>';
|
||||||
|
h.appendChild('h1');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should init', function() {
|
||||||
|
var bar = new ionic.views.HeaderBar({
|
||||||
|
el: h
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user