describe('ionNavButtons directive', function() {
var outputEle;
beforeEach(module('ionic', function($compileProvider) {
$compileProvider.directive('needsScroll', function() {
return {
//Test if the buttons are 'children of ionScroll' when compiled
require: '^$ionicScroll',
link: function(scope, element, attrs, ctrl) {
element.data('scrollCtrl', ctrl);
}
};
});
}));
function setup(side, content) {
var el;
inject(function($compile, $rootScope) {
el = angular.element(''+(content||'')+'');
el.data('$ionNavBarController', {
navElement: function(buttonType, buttonHtml) {
outputEle = angular.element(buttonHtml);
}
});
el = $compile(el)($rootScope.$new());
$rootScope.$apply();
});
return el;
}
it('should error without a parent ionNavBar', inject(function($compile, $rootScope) {
expect(function() {
$compile('')($rootScope);
}).toThrow();
}));
it('should hide and empty its original self', function() {
var el = setup();
expect(el.hasClass('hide')).toBe(true);
expect(el.html()).toBe('');
});
it('should default to left-buttons class and add inner element', function() {
var el = setup(null, '