Skip to content

Commit

Permalink
Actually run the expectations.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhatib committed Apr 19, 2016
1 parent 05ce3a4 commit 6b999ad
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions extensions/amp-carousel/0.1/test/test-slides.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import * as sinon from 'sinon';
import * as tr from '../../../../src/transition';
import {AmpSlides} from '../slides';

import {Animation} from '../../../../src/animation';

describe('Slides functional', () => {

Expand Down Expand Up @@ -771,6 +771,12 @@ describe('Slides functional', () => {
slides.updateInViewport = sandbox.spy();
slides.schedulePause = sandbox.spy();
slides.schedulePreload = sandbox.spy();

Animation.animate = () => {
return {
thenAlways: cb => cb(),
};
};
});
afterEach(() => {
sandbox.restore();
Expand Down Expand Up @@ -837,22 +843,20 @@ describe('Slides functional', () => {
it('should preload slides in direction of navigation', () => {
expect(slide0.style.visibility).to.be.equal('visible');
expect(slide1.style.visibility).to.be.equal('hidden');
expect(slides.scheduleLayout.calledWith(slide0));
expect(slides.schedulePreload.calledWith(slide1));

slides.goCallback(1, /*animate*/ false);
slides.goCallback(1, /*animate*/ true);
expect(slide0.style.visibility).to.be.equal('hidden');
expect(slide1.style.visibility).to.be.equal('visible');
expect(slide2.style.visibility).to.be.equal('hidden');
expect(slides.scheduleLayout.calledWith(slide1));
expect(slides.schedulePreload.calledWith(slide2));
expect(slides.scheduleLayout.calledWith(slide1)).to.be.true;
expect(slides.schedulePreload.calledWith(slide2)).to.be.true;

slides.goCallback(-1, /*animate*/ false);
expect(slide0.style.visibility).to.be.equal('visible');
expect(slide1.style.visibility).to.be.equal('hidden');
expect(slide2.style.visibility).to.be.equal('hidden');
expect(slides.scheduleLayout.calledWith(slide0));
expect(slides.schedulePreload.calledWith(slide1));
expect(slides.scheduleLayout.calledWith(slide0)).to.be.true;
expect(slides.schedulePreload.calledWith(slide2)).to.be.true;
});
});
});
Expand Down

0 comments on commit 6b999ad

Please sign in to comment.