/
githubmirror
/
fullPage.js
Обзор
Документация
Войти
/
githubmirror
/
fullPage.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tests/unit/lockAnchors.js
41 строка
1 KB
Alvaro Trigo López
- Improving tests
16 мар 2022, 21:05
16 мар 2022, 21:05
0998df3
Код
Авторство
О чём код?
QUnit.test('Testing lockAnchors:true', function(assert) { var id = '#fullpage'; var FP = initFullpageNew(id, Object.assign({}, allBasicOptions, {lockAnchors: true})); var done = assert.async(1); //scrolling down won't change the anchor FP.moveSectionDown(); assert.equal('', window.location.hash, 'Anchor link should be an empty string'); assert.ok($(id).find(SECTION_SEL).eq(1).hasClass(ACTIVE), 'We expect section 2 to be active'); //changing the URL won't scroll to the given section window.location.hash = '#page3'; setTimeout(function() { assert.ok(!$(id).find(SECTION_SEL).eq(2).hasClass(ACTIVE), 'We dont expect section 3 to be active'); done(); }, 100); }); QUnit.test('Testing lockAnchors:false', function(assert) { var id = '#fullpage'; var FP = initFullpageNew(id, Object.assign({}, allBasicOptions, {lockAnchors: false})); var done = assert.async(1); //scrolling down will change the anchor FP.moveSectionDown(); assert.equal('#page2', window.location.hash, 'Anchor link should not be an empty'); assert.ok($(id).find(SECTION_SEL).eq(1).hasClass(ACTIVE), 'We expect section 2 to be active'); //changing the URL will scroll to the given section window.location.hash = '#page3'; setTimeout(function() { console.log($(id).find(SECTION_SEL).eq(2)); assert.ok($(id).find(SECTION_SEL).eq(2).hasClass(ACTIVE), 'We expect section 3 to be active'); done(); }, 100); });