| Server IP : 46.62.235.243 / Your IP : 216.73.216.217 Web Server : Apache/2.4.58 (Ubuntu) System : Linux Linkabili3Dicembre 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/linkabili/node_modules/waypoints/test/ |
Upload File : |
'use strict'
/* global
* describe, it, beforeEach, afterEach, expect, spyOn, waits, runs,
* waitsFor, loadFixtures, Waypoint
*/
window.jQuery.each(window.jQuery.grep(Waypoint.adapters, function(adapter) {
return 'jquery zepto'.indexOf(adapter.name) > -1
}), function(i, adapter) {
describe('$.fn extension for ' + adapter.name + ':', function() {
var $, waypoints
beforeEach(function() {
$ = adapter.name === 'jquery' ? window.jQuery : window.Zepto
Waypoint.Adapter = adapter.Adapter
loadFixtures('standard.html')
})
afterEach(function() {
$.each(waypoints, function(i, waypoint) {
waypoint.destroy()
})
})
describe('waypoint initialization', function() {
it('uses the subject elements as the element option', function() {
waypoints = $('.nearsame').waypoint(function() {})
expect(waypoints[0].element.id).toEqual('near1')
expect(waypoints[1].element.id).toEqual('near2')
})
it('returns an array of Waypoint instances', function() {
waypoints = $('.nearsame').waypoint(function() {})
expect($.isArray(waypoints)).toBeTruthy()
expect(waypoints.length).toEqual(2)
})
it('can take the handler as the first parameter', function() {
function handler() {}
waypoints = $('#near1').waypoint(handler)
expect(waypoints[0].callback).toBe(handler)
})
})
describe('context option', function() {
it('can be given a string selector', function() {
waypoints = $('#inner3').waypoint({
context: '#bottom',
handler: function() {}
})
expect(waypoints[0].context.element).toBe($('#bottom')[0])
})
})
})
})