/** * Test the side menu directive. For more test coverage of the side menu, * see the core Ionic sideMenu controller tests. */ describe('Ionic Angular Slide Box', function() { var el, delegate, compile, rootScope, timeout; beforeEach(module('ionic')); beforeEach(inject(function($compile, $rootScope, $timeout, $ionicSlideBoxDelegate) { delegate = $ionicSlideBoxDelegate; timeout = $timeout; rootScope = $rootScope; compile = $compile; el = $compile('\ \
\

BLUE {{slideBox.slideIndex}}

\
\
\ \
\

YELLOW {{slideBox.slideIndex}}

\
\
\ \

PINK {{slideBox.slideIndex}}

\
\
')($rootScope); })); it('Should init', function() { var scope = el.scope(); expect(scope.slideBox).not.toBe(undefined); }); it('Should update with delegate', function() { var scope = el.scope(); var slideBox = scope.slideBox; spyOn(slideBox, 'setup'); delegate.update(); timeout.flush(); expect(slideBox.setup).toHaveBeenCalled(); }); it('Should set initial active slide', function() { el = compile('\ \
\

BLUE {{slideBox.slideIndex}}

\
\
\ \
\

YELLOW {{slideBox.slideIndex}}

\
\
\ \

PINK {{slideBox.slideIndex}}

\
\
')(rootScope); var scope = el.scope(); expect(scope.slideBox.currentIndex()).toBe(2); }); });