"use strict";describe("angular-inview",function(){var $rootScope,$compile,$q;beforeEach(function(){module("angular-inview");inject(function(_$rootScope_,_$compile_,_$q_){$rootScope=_$rootScope_;$compile=_$compile_;$q=_$q_})});describe("in-view directive",function(){it("should trigger in-view expression with `$inview` local",function(done){makeTestForHtml('
').then(function(test){expect(test.spy.calls.count()).toBe(1);expect(test.spy).toHaveBeenCalledWith(true)}).then(done)});it("should not trigger in-view expression if out of viewport",function(done){makeTestForHtml('').then(function(test){expect(test.spy.calls.count()).toBe(0)}).then(done)});it("should change inview status when scrolling out of view",function(done){makeTestForHtml(''+'').then(lazyScrollTo(100)).then(function(test){expect(test.spy.calls.count()).toBe(2);expect(test.spy).toHaveBeenCalledWith(true);expect(test.spy).toHaveBeenCalledWith(false)}).then(done)});describe("informations object",function(){it("should return an info object with relative informations",function(done){makeTestForHtml('').then(function(test){expect(test.spy.calls.count()).toBe(1);var info=test.spy.calls.mostRecent().args[0];expect(info.inView).toEqual(true);expect(info.parts).toEqual({top:true,left:true,bottom:true,right:true})}).then(done)});it("should return proper `parts` informations",function(done){makeTestForHtml(''+'').then(function(test){expect(test.spy.calls.count()).toBe(1);var info=test.spy.calls.argsFor(0)[0];expect(info.parts).toEqual({top:true,left:true,bottom:true,right:true});return test}).then(lazyScrollTo([400,400])).then(function(test){var info=test.spy.calls.argsFor(1)[0];expect(test.spy.calls.count()).toBe(2);expect(info.parts).toEqual(undefined);return test}).then(lazyScrollTo([100,100])).then(function(test){var info=test.spy.calls.argsFor(2)[0];expect(test.spy.calls.count()).toBe(3);expect(info.parts).toEqual({top:false,left:false,bottom:true,right:true});return test}).then(lazyScrollTo([0,0])).then(function(test){var info=test.spy.calls.argsFor(3)[0];expect(test.spy.calls.count()).toBe(4);expect(info.parts).toEqual({top:true,left:true,bottom:true,right:true})}).then(done)});it("should return proper `direction` informations",function(done){makeTestForHtml(''+'').then(function(test){var info=test.spy.calls.argsFor(0)[0];expect(info.direction).toEqual(undefined);return test}).then(lazyScrollTo([100,100])).then(function(test){var info=test.spy.calls.argsFor(1)[0];expect(info.direction).toEqual({horizontal:-100,vertical:-100});return test}).then(lazyScrollTo([50,50])).then(function(test){var info=test.spy.calls.argsFor(2)[0];expect(info.direction).toEqual({horizontal:50,vertical:50})}).then(done)})});describe("offset options",function(){it("should consider element offset option",function(done){makeTestForHtml(''+'').then(function(test){var info=test.spy.calls.argsFor(0)[0];expect(info.inView).toEqual(true);expect(info.parts).toEqual({top:false,left:true,bottom:true,right:true});return test}).then(done)});it("should consider negative offsets",function(done){makeTestForHtml(''+'').then(function(test){var info=test.spy.calls.argsFor(0)[0];expect(info.parts).toEqual({top:true,left:true,bottom:true,right:true});return test}).then(lazyScrollTo(100)).then(function(test){var info=test.spy.calls.argsFor(1)[0];expect(info.parts).toEqual({top:false,left:true,bottom:true,right:true});return test}).then(lazyScrollTo(50)).then(function(test){var info=test.spy.calls.argsFor(2)[0];expect(info.parts).toEqual({top:true,left:true,bottom:true,right:true});return test}).then(done)});it("should consider viewport offset options",function(done){makeTestForHtml(''+'').then(function(test){var info=test.spy.calls.argsFor(0)[0];expect(info.parts).toEqual({top:true,left:true,bottom:true,right:true});return test}).then(lazyScrollTo(200)).then(function(test){var info=test.spy.calls.argsFor(1)[0];expect(info.parts).toEqual({top:false,left:true,bottom:true,right:true});return test}).then(done)})});it("should accept a `throttle` option",function(done){makeTestForHtml(''+'').then(function(test){expect(test.spy.calls.count()).toBe(0);return test}).then(lazyWait(200)).then(function(test){expect(test.spy.calls.count()).toBe(1);expect(test.spy).toHaveBeenCalledWith(true);return test}).then(done)})});describe("in-view-container directive",function(){it("should trigger in-view when scrolling a container",function(done){makeTestForHtml('