first commit

This commit is contained in:
2026-01-16 14:13:44 +08:00
commit 903ff8d495
34603 changed files with 8585054 additions and 0 deletions

View File

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Backstretch Test Suite</title>
<!-- Load local jQuery. This can be overridden with a ?jquery=___ param. -->
<script src="../libs/jquery-loader.js"></script>
<!-- Load local QUnit (grunt requires v1.0.0 or newer). -->
<link rel="stylesheet" href="../libs/qunit/qunit.css" media="screen">
<script src="../libs/qunit/qunit.js"></script>
<!-- Load local lib and tests. -->
<script src="../src/jquery.backstretch.js"></script>
<script src="backstretch_test.js"></script>
<!-- Removing access to jQuery and $. But it'll still be available as _$, if
you REALLY want to mess around with jQuery in the console. REMEMBER WE
ARE TESTING YOUR PLUGIN HERE -->
<script>window._$ = jQuery.noConflict(true);</script>
</head>
<body>
<h1 id="qunit-header">Backstretch Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">
<span>lame test markup</span>
<span>normal test markup</span>
<span>awesome test markup</span>
</div>
</body>
</html>

View File

@ -0,0 +1,98 @@
/*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/
/*global start:false, stop:false ok:false, equal:false, notEqual:false, deepEqual:false*/
/*global notDeepEqual:false, strictEqual:false, notStrictEqual:false, raises:false*/
(function($) {
/*
======== A Handy Little QUnit Reference ========
http://docs.jquery.com/QUnit
Test methods:
expect(numAssertions)
stop(increment)
start(decrement)
Test assertions:
ok(value, [message])
equal(actual, expected, [message])
notEqual(actual, expected, [message])
deepEqual(actual, expected, [message])
notDeepEqual(actual, expected, [message])
strictEqual(actual, expected, [message])
notStrictEqual(actual, expected, [message])
raises(block, [expected], [message])
*/
var global = {
elems: $('#qunit-fixture').children()
, img1: 'image1.jpg'
, img2: 'image2.jpg'
, imgs: ['image1.jpg', 'image2.jpg']
, destroy: function () {
try {
$(':backstretch').data('backstretch').destroy();
} catch(err) { /* Do nothing */ }
}
};
/* Backstretch tests
* ========================= */
module('Backstretch', {
teardown: global.destroy
});
test('instantiation', function () {
strictEqual(global.elems.backstretch(global.img1), global.elems, 'chaninable when executed on elements');
strictEqual($.backstretch(global.img1).constructor, Object, 'returns Backstretch object');
});
test('images', function () {
raises(function() { $.backstretch(); }, 'raise an error when no image is supplied');
raises(function() { $.backstretch([]); }, 'raise an error when an empty image array is supplied');
});
test('options', function () {
// Make sure previous instances are destroyed
global.destroy();
var duration = 999999
, start = 1
, lazyload = false
, paused = true
, instance = $.backstretch(global.imgs, {duration: duration,lazyload:lazyload,start:start,paused:paused});
// Test to make sure the options are being set
strictEqual(instance.options.duration, duration, 'passed options are being set');
strictEqual(instance.options.lazyload, lazyload, 'passed options are being set');
strictEqual(instance.options.start, start, 'passed options are being set');
strictEqual(instance.options.paused, paused, 'passed options are being set');
});
test('optionValidation', function() {
var instance = null;
//Out of bounds
instance = $.backstretch(global.imgs,{start: 100});
strictEqual(instance.options.start, global.imgs.length - 1, 'start-option is validated correctly');
//Negative Index
instance = $.backstretch(global.imgs, {start: -12});
strictEqual(instance.options.start, 0, 'start-option is validated correctly');
});
test('resize event', function() {
// Make sure previous instances are destroyed
global.destroy();
var duration = 999999
, instance = $('body').backstretch(global.img1, {duration: duration})
, onResize = function() {
resized = true;
}
, resized = false;
instance.on('backstretch.resize', onResize);
$(window).trigger('resize');
strictEqual(resized, true, 'passed resize event being called');
});
}(jQuery));

BIN
WebRoot/node_modules/jquery-backstretch/test/image1.jpg generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 675 KiB

BIN
WebRoot/node_modules/jquery-backstretch/test/image2.jpg generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 KiB