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/displayWarnings.js

240 lines
7.5 KiB

var oldConsole = console;
var warnFired = false;
var errorFired = false;
function mockConsole(){
console = {};
console.warn = function(e){
warnFired = true;
};
console.error = function(e){
errorFired = true;
}
}
function isWarnFired(){
if(warnFired){
warnFired = false;
return true;
}
return false;
}
function isErrorFired(){
if(errorFired){
errorFired = false;
return true;
}
return false;
}
//loopTop & continuousVertical
QUnit.test('Testing warnings for loopTop:false with continuousVertical:true', function(assert) {
var id = '#fullpage';
warnFired = false;
mockConsole();
var FP = initFullpageNew(id, {loopTop: false, loopBottom: false, continuousVertical:true});
assert.equal(isWarnFired(), false, 'We expect console.warn not to be fired');
});
QUnit.test('Testing warnings for loopTop:true with continuousVertical:true', function(assert) {
var id = '#fullpage';
warnFired = false;
mockConsole();
var FP = initFullpageNew(id, {loopTop: true, continuousVertical:true});
assert.equal(isWarnFired(), true, 'We expect console.warn to be fired');
});
//loopBottom & continuousVertical
QUnit.test('Testing warnings for loopBottom:false with continuousVertical:true', function(assert) {
var id = '#fullpage';
warnFired = false;
mockConsole();
var FP = initFullpageNew(id, {loopBottom: false, loopBottom: false, continuousVertical:true});
assert.equal(isWarnFired(), false, 'We expect console.warn not to be fired');
});
QUnit.test('Testing warnings for loopBottom:true with continuousVertical:true', function(assert) {
var id = '#fullpage';
warnFired = false;
mockConsole();
var FP = initFullpageNew(id, {loopBottom: true, continuousVertical:true});
assert.equal(isWarnFired(), true, 'We expect console.warn to be fired');
});
//scrollBar & continuousVertical
QUnit.test('Testing warnings for scrollBar:false with continuousVertical:true', function(assert) {
var id = '#fullpage';
warnFired = false;
mockConsole();
var FP = initFullpageNew(id, {scrollBar: false, autoScrolling:true, continuousVertical:true});
assert.equal(isWarnFired(), false, 'We expect console.warn not to be fired');
});
QUnit.test('Testing warnings for scrollBar:true with continuousVertical:true', function(assert) {
var id = '#fullpage';
warnFired = false;
mockConsole();
var FP = initFullpageNew(id, {scrollBar: true, autoScrolling:true, continuousVertical:true});
assert.equal(isWarnFired(), true, 'We expect console.warn to be fired');
});
//autoScrolling & continuousVertical
QUnit.test('Testing warnings for autoScrolling:true with continuousVertical:true', function(assert) {
var id = '#fullpage';
warnFired = false;
mockConsole();
var FP = initFullpageNew(id, {autoScrolling: true, continuousVertical:true});
assert.equal(isWarnFired(), false, 'We expect console.warn not to be fired');
});
QUnit.test('Testing warnings for autoScrolling:false with continuousVertical:true', function(assert) {
var id = '#fullpage';
warnFired = false;
mockConsole();
var FP = initFullpageNew(id, {autoScrolling: false, continuousVertical:true});
assert.equal(isWarnFired(), true, 'We expect console.warn to be fired');
});
//scrollOverflow must exist
QUnit.test('Testing warnings for scrollOverflow:true with no vendor file', function(assert) {
var id = '#fullpage';
errorFired = false;
mockConsole();
var FP = initFullpageNew(id, {scrollOverflow: true, scrollOverflowHandler: null});
assert.equal(isErrorFired(), true, 'We expect console.warn to be fired');
});
//scrollOverflow must exist
QUnit.test('Testing warnings for scrollOverflow:true with vendor file', function(assert) {
var id = '#fullpage';
errorFired = false;
mockConsole();
var FP = initFullpageNew(id, {scrollOverflow: true, scrollOverflowHandler: {init: function(){}, remove: function(){}}});
assert.equal(isErrorFired(), false, 'We expect console.warn not to be fired');
});
//extension file must exist
QUnit.test('Testing warnings for parallax:true', function(assert) {
var id = '#fullpage';
warnFired = false;
mockConsole();
var FP = initFullpageNew(id, {parallax: true});
assert.equal(isWarnFired(), true, 'We expect console.warn to be fired');
});
QUnit.test('Testing warnings for scrollOverflowReset:true', function(assert) {
var id = '#fullpage';
warnFired = false;
mockConsole();
var FP = initFullpageNew(id, {scrollOverflowReset: true});
assert.equal(isWarnFired(), true, 'We expect console.warn to be fired');
});
QUnit.test('Testing warnings for dragAndMove:true', function(assert) {
var id = '#fullpage';
warnFired = false;
mockConsole();
var FP = initFullpageNew(id, {dragAndMove: true});
assert.equal(isWarnFired(), true, 'We expect console.warn to be fired');
});
QUnit.test('Testing warnings for offsetSections:true', function(assert) {
var id = '#fullpage';
warnFired = false;
mockConsole();
var FP = initFullpageNew(id, {offsetSections: true});
assert.equal(isWarnFired(), true, 'We expect console.warn to be fired');
});
QUnit.test('Testing warnings for fadingEffect:true', function(assert) {
var id = '#fullpage';
warnFired = false;
mockConsole();
var FP = initFullpageNew(id, {fadingEffect: true});
assert.equal(isWarnFired(), true, 'We expect console.warn to be fired');
});
QUnit.test('Testing warnings for responsiveSlides:true', function(assert) {
var id = '#fullpage';
warnFired = false;
mockConsole();
var FP = initFullpageNew(id, {responsiveSlides: true});
assert.equal(isWarnFired(), true, 'We expect console.warn to be fired');
});
QUnit.test('Testing warnings for continuousHorizontal:true', function(assert) {
var id = '#fullpage';
warnFired = false;
mockConsole();
var FP = initFullpageNew(id, {continuousHorizontal: true});
assert.equal(isWarnFired(), true, 'We expect console.warn to be fired');
});
QUnit.test('Testing warnings for interlockedSlides:true', function(assert) {
var id = '#fullpage';
warnFired = false;
mockConsole();
var FP = initFullpageNew(id, {interlockedSlides: true});
assert.equal(isWarnFired(), true, 'We expect console.warn to be fired');
});
QUnit.test('Testing warnings for scrollHorizontally:true', function(assert) {
var id = '#fullpage';
warnFired = false;
mockConsole();
var FP = initFullpageNew(id, {scrollHorizontally: true});
assert.equal(isWarnFired(), true, 'We expect console.warn to be fired');
});
QUnit.test('Testing warnings for resetSliders:true', function(assert) {
var id = '#fullpage';
warnFired = false;
mockConsole();
var FP = initFullpageNew(id, {resetSliders: true});
assert.equal(isWarnFired(), true, 'We expect console.warn to be fired');
});
//name element?
QUnit.test('Testing warnings for name element same as anchor?', function(assert) {
var id = '#fullpage-with-name-element';
errorFired = false;
mockConsole();
var FP = initFullpageNew(id, {anchors: ['anchor-as-name', 'test2', 'test3', 'test4']});
assert.equal(isErrorFired(), true, 'We expect console.warn to be fired');
});
//id element?
QUnit.test('Testing warnings for id element same as anchor?', function(assert) {
var id = '#fullpage-with-name-element';
errorFired = false;
mockConsole();
var FP = initFullpageNew(id, {anchors: ['anchor-as-id', 'test2', 'test3', 'test4']});
assert.equal(isErrorFired(), true, 'We expect console.warn to be fired');
});