File size: 1,716 Bytes
5893f8f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
jasmine.getFixtures().fixturesPath = '../tests/fixtures';
jasmine.getStyleFixtures().fixturesPath = '../dist/css';
jasmine.getJSONFixtures().fixturesPath = '../tests/fixtures/json';

describe("Height", function() {

	var data;
	var fixtures;
	var slider;
	var wrapper;
	var track;
	var slides;
	var arrows;
	var arrowsWrapper;
	var bullets;
	var bulletsWrapper;
	var api;

	beforeEach(function () {

		loadFixtures('base.html');
		loadStyleFixtures('glide.theme.css');
		loadStyleFixtures('glide.core.css');

		data = getJSONFixture('data.json');
		fixtures = loadJSONFixtures('data.json');
		data = fixtures['data.json'];

		slider = $(data.base);
		wrapper = slider.find(data.wrapper);
		track = wrapper.find(data.track);
		slides = track.children();
		arrowsWrapper = slider.find(data.arrows);
		arrows = arrowsWrapper.children();
		bulletsWrapper = slider.find(data.bullets);
		bullets = bulletsWrapper.children();

		options = {
			autoheight: true,
			animationDuration: 20
		};

		slides.eq(0).find('div').height(111);
		slides.eq(1).find('div').height(222);
		slides.eq(2).find('div').height(333);
		slides.eq(3).find('div').height(444);

		api = slider.glide(options).data('glide_api');

	});


	it("On init wrapper should have height of first slide", function(done) {

		setTimeout(function(){
			expect(wrapper.height()).toEqual(111);
			done();
		}, options.animationDuration*5);

	});


	it("On slide change wrapper should have height of current slide", function(done) {

		setTimeout(function(){
			arrows.filter(data.arrowNext).click();
			setTimeout(function(){
				expect(wrapper.height()).toEqual(222);
				done();
			}, options.animationDuration*5);
		}, options.animationDuration*5);

	});


});