De promotiewebsite die de reguliere site vervangt tijdens de Kick-In. https://join.harambee.utwente.nl
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
kick-in-promo-site/tests/unit/moveSectionDown.js

112 lines
5.3 KiB

QUnit.test('Testing moveSectionDown first section active with slides {css3:true, autoScrolling:true}', function(assert) {
var id = '#fullpage';
var FP = initFullpageNew(id, {css3: true, autoScrolling: true});
var windowHeight = $(window).height();
assert.equal($(id).find(SECTION_ACTIVE_SEL).index(), 0, 'We expect section 1 to be active');
assert.deepEqual(getTransform(FP.test.translate3d), ['0', '0', '0'], 'We expect sections transformation to be [0, 0, 0]');
FP.moveSectionDown();
assert.deepEqual(getTransform(FP.test.translate3d), ['0', `${-(windowHeight*1)}`, '0'], `We expect sections transformation to be [0, ${-(windowHeight*1)}, 0]`);
assert.equal($(id).find(SECTION_ACTIVE_SEL).index(), 1, 'We expect section 2 to be active');
FP.moveSectionDown();
assert.deepEqual(getTransform(FP.test.translate3d), ['0', `${-(windowHeight*2)}`, '0'], `We expect sections transformation to be [0, ${-(windowHeight*2)}, 0]`);
assert.equal($(id).find(SECTION_ACTIVE_SEL).index(), 2, 'We expect section 3 to be active');
FP.moveSectionDown();
});
QUnit.test('Testing moveSectionDown first section active with slides {css3:false, autoScrolling:true}', function(assert) {
var id = '#fullpage';
var FP = initFullpageNew(id, {css3: false, autoScrolling: true});
var windowHeight = $(window).height();
assert.equal($(id).find(SECTION_ACTIVE_SEL).index(), 0, 'We expect section 1 to be active');
assert.deepEqual(FP.test.top, '0px', 'We expect wrapper top property to be 0px');
FP.moveSectionDown();
assert.deepEqual(FP.test.top, -(windowHeight*1) +'px', `We expect wrapper top property to be -${(windowHeight*1)}px`);
assert.equal($(id).find(SECTION_ACTIVE_SEL).index(), 1, 'We expect section 2 to be active');
FP.moveSectionDown();
assert.deepEqual(FP.test.top, -(windowHeight*2) +'px', `We expect wrapper top property to be -${(windowHeight*2)}px`);
assert.equal($(id).find(SECTION_ACTIVE_SEL).index(), 2, 'We expect section 3 to be active');
});
QUnit.test('Testing moveSectionDown in fullpage-last-section-active {css3:true, autoScrolling:true}', function(assert) {
var id = '#fullpage-last-section-active';
var FP = initFullpageNew(id, {css3: true, autoScrolling: true});
var windowHeight = $(window).height();
assert.equal($(id).find(SECTION_ACTIVE_SEL).index(), 3, 'We expect section 4 to be active');
assert.deepEqual(getTransform(FP.test.translate3d), ['0', `${-(windowHeight*3)}`, '0'], `We expect sections transformation to be [0, ${-(windowHeight*3)}, 0]`);
FP.moveSectionDown();
assert.deepEqual(getTransform(FP.test.translate3d), ['0', `${-(windowHeight*3)}`, '0'], `We expect sections transformation to be [0, ${-(windowHeight*3)}, 0]`);
assert.equal($(id).find(SECTION_ACTIVE_SEL).index(), 3, 'We expect section 4 to be active');
});
QUnit.test('Testing moveSectionDown in fullpage-last-section-active {css3:false, autoScrolling:true}', function(assert) {
var id = '#fullpage-last-section-active';
var FP = initFullpageNew(id, {css3: false, animateAnchor: false,autoScrolling: true});
var windowHeight = $(window).height();
assert.equal($(id).find(SECTION_ACTIVE_SEL).index(), 3, 'We expect section 4 to be active');
assert.deepEqual(FP.test.top, -(windowHeight*3) +'px', `We expect wrapper top property to be -${(windowHeight*3)}px`);
FP.moveSectionDown();
assert.deepEqual(FP.test.top, -(windowHeight*3) +'px', `We expect wrapper top property to be -${(windowHeight*3)}px`);
assert.equal($(id).find(SECTION_ACTIVE_SEL).index(), 3, 'We expect section 4 to be active');
});
/* Not working! qunit doesn't allow the use of something like $('html,body').animate({scrollTop: 400})
QUnit.test('Testing moveSectionDown in fullpage-last-section-active {autoScrolling:false}', function(assert) {
var id = '#fullpage-last-section-active';
var FP = initFullpageNew(id, {autoScrolling: false, animateAnchor: false});
var windowHeight = $(window).height();
var done = assert.async(1);
$('html,body').scrollTop(400);
console.log( $(window).scrollTop() );
assert.equal($(id).find(SECTION_ACTIVE_SEL).index(), 3, 'We expect section 4 to be active');
assert.deepEqual(getWindowPosition(), 0, 'We expect window position to be 0');
FP.moveSectionDown();
setTimeout(function(){
assert.deepEqual(getWindowPosition(), 0, 'We expect window position to be 0');
assert.equal($(id).find(SECTION_ACTIVE_SEL).index(), 0, 'We expect section 1 to be active');
done();
}, 800);
});
/* Not working! qunit doesn't allow the use of something like $('html,body').animate({scrollTop: 400}) */
/*
QUnit.test('Testing moveSectionDown first section active with slides {autoScrolling:false}', function(assert) {
var id = '#fullpage';
var FP = initFullpageNew(id, {autoScrolling: false});
var done = assert.async(1);
assert.equal($(id).find(SECTION_ACTIVE_SEL).index(), 0, 'We expect section 1 to be active');
assert.deepEqual(getWindowPosition(), 0, 'We expect window position to be 0');
FP.moveSectionDown();
setTimeout(function(){
assert.deepEqual(getWindowPosition(), 0, 'We expect window position to be 0');
assert.equal($(id).find(SECTION_ACTIVE_SEL).index(), 0, 'We expect section 1 to be active');
done();
}, 800);
});
*/