mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
58 lines
1.7 KiB
JavaScript
58 lines
1.7 KiB
JavaScript
describe('Ionic Header Bar', function() {
|
|
var el, rootScope, compile;
|
|
|
|
beforeEach(module('ionic'));
|
|
|
|
beforeEach(inject(function($compile, $rootScope) {
|
|
compile = $compile;
|
|
rootScope = $rootScope;
|
|
}));
|
|
|
|
it('Should not add title-left or title-right classes when align-title=center', function() {
|
|
runs(function(){
|
|
el = compile('<ion-header-bar align-title="center"></ion-header-bar>')(rootScope);
|
|
});
|
|
|
|
//wait for headerBar View to align() the title
|
|
waits(500);
|
|
|
|
runs(function(){
|
|
var headerView = el.isolateScope().headerBarView;
|
|
var title = angular.element(headerView.el.querySelector('.title'));
|
|
expect(title.hasClass('title-left')).not.toEqual(true);
|
|
expect(title.hasClass('title-right')).not.toEqual(true);
|
|
});
|
|
});
|
|
|
|
it('Should add title-left class when align-title=left', function() {
|
|
runs(function(){
|
|
el = compile('<ion-header-bar align-title="left"></ion-header-bar>')(rootScope);
|
|
});
|
|
|
|
//wait for headerBar View to align() the title
|
|
waits(500);
|
|
|
|
runs(function(){
|
|
var headerView = el.isolateScope().headerBarView;
|
|
var title = angular.element(headerView.el.querySelector('.title'));
|
|
expect(title.hasClass('title-left')).toEqual(true);
|
|
});
|
|
});
|
|
|
|
it('Should add title-right class when align-title=right', function() {
|
|
runs(function(){
|
|
el = compile('<ion-header-bar align-title="right"></ion-header-bar>')(rootScope);
|
|
});
|
|
|
|
//wait for headerBar View to align() the title
|
|
waits(500);
|
|
|
|
runs(function(){
|
|
var headerView = el.isolateScope().headerBarView;
|
|
var title = angular.element(headerView.el.querySelector('.title'));
|
|
expect(title.hasClass('title-right')).toEqual(true);
|
|
});
|
|
});
|
|
|
|
});
|