redo main/register page

This commit is contained in:
SowinskiBraeden committed 2022-04-13 13:12:19 -07:00
1 parent eaa2febbf2
commit 1ad5eb654b
400 files changed
+93168 -323

No files matched your search

@@ -0,0 +1,86 @@
module('Autoplay tests');
function FakeClock() {
// Instantiate a new controllable clock which overrides the built in Date
// class on construction.
var value = 1;
this.tick = function(duration) {
value += duration;
};
// TODO: This is broken and has to be fixed in the near future
this.Date = function() {
this.getTime = function() {
return value;
}
}
}
function change_timeout(autoplay, first, second, wait) {
var clock = new FakeClock();
// This is a helper function to test multiple consecutive play calls with
// different timeout values. Four steps will be completed by this function:
// 1. The autoplay will be played in a stopped state with the first timeout.
autoplay.stop();
autoplay.play(first);
// 2. Time will be forwarded a given wait time.
clock.tick(wait);
// 3. The autoplay will be paused.
autoplay.pause();
// 4. The autoplay will be played with the second timeout.
autoplay.play(second);
}
// test('stopping the autoplay timer', function() {
// expect(2);
//
// var clock = new FakeClock();
//
// var carousel = $('#simple').owlCarousel().data('owl.carousel');
// var autoplay = carousel._plugins.autoplay;
//
// clock.tick(1);
//
// autoplay.stop();
// autoplay.play();
//
// equal(autoplay.read(), 0);
//
// autoplay.pause();
// autoplay.play();
//
// equal(autoplay.read(), 0);
// });
// TODO: See todo above, seems to be broken since a while as we are trying to assign the global const Date to a new function
// test('changing autoplay timeout values', function() {
// expect(4);
//
// var carousel = $('#simple').owlCarousel().data('owl.carousel');
// var autoplay = carousel._plugins.autoplay;
//
// // Changing the timeout from 2000 to 3000 after 3000 ticks should maintain
// // the elapsed time (1000) since the last transition.
// change_timeout(autoplay, 2000, 3000, 3000);
// equal(autoplay.read() % 3000, 1000);
//
// // Changing the timeout from 4000 to 5000 after 12000 ticks should maintain
// // the elapsed time (0) since the last transition.
// change_timeout(autoplay, 4000, 5000, 12000);
// equal(autoplay.read() % 5000, 0);
//
// // Changing the timeout from 5000 to 4000 after 12000 ticks should maintain
// // the elapsed time (2000) since the last transition.
// change_timeout(autoplay, 5000, 4000, 12000);
// equal(autoplay.read() % 4000, 2000);
//
// // Changing the timeout from 11000 to 6000 after 19000 ticks should reset
// // the elapsed timer value (7000) since the last transition to 0, because
// // it is larger than the timeout value.
// change_timeout(autoplay, 11000, 6000, 19000);
// equal(autoplay.read() % 6000, 0);
// });
@@ -0,0 +1,140 @@
module('Core tests');
test('replace with loop', function() {
expect(1);
before_and_after_replace({ loop: true });
});
test('replace without loop', function() {
expect(1);
before_and_after_replace({ loop: false });
});
function before_and_after_replace(options) {
var simple = $('#simple'),
replacement = simple.html(),
expected = null;
simple.owlCarousel(options);
expected = simple.html();
simple.trigger('replace.owl.carousel', [ replacement ]);
simple.trigger('refresh.owl.carousel');
equal(simple.html(), expected, 'Inner HTML before and after replace equals.');
}
test('remove with loop', function() {
expect(3);
before_and_after_remove({ loop: true });
});
test('remove without loop', function() {
expect(3);
before_and_after_remove({ loop: false });
});
function before_and_after_remove(options) {
var simple = $('#simple'),
one = simple.clone().removeAttr('id').insertAfter('#simple'),
two = one.clone().insertAfter(one),
all = two.clone().insertAfter(two);
one.children(':eq(0)').remove();
two.children(':eq(0),:eq(2)').remove();
all.children().remove();
simple.owlCarousel(options);
one.owlCarousel(options);
two.owlCarousel(options);
all.owlCarousel(options);
simple.trigger('remove.owl.carousel', [ 0 ]);
simple.trigger('refresh.owl.carousel');
equal(simple.html(), one.html(), 'Inner HTML before and after remove one equals.');
simple.trigger('remove.owl.carousel', [ 1 ]);
simple.trigger('refresh.owl.carousel');
equal(simple.html(), two.html(), 'Inner HTML before and after remove two equals.');
simple.trigger('remove.owl.carousel', [ 0 ]);
simple.trigger('refresh.owl.carousel');
equal(simple.html(), all.html(), 'Inner HTML before and after remove all equals.');
}
test('remove and add with loop', function() {
expect(1);
before_and_after_remove_add({ loop: true });
});
test('remove and add without loop', function() {
expect(1);
before_and_after_remove_add({ loop: false });
});
function before_and_after_remove_add(options) {
var simple = $('#simple'),
simpleClone = $('#simple').clone().removeAttr('id').insertAfter('#simple');
//move the text along as 'add' adds the new element to the add as expected.
simpleClone.children(':eq(0)').text('2');
simpleClone.children(':eq(1)').text('3');
simpleClone.children(':eq(2)').text('1');
simple.owlCarousel(options);
simpleClone.owlCarousel(options);
simple.trigger('remove.owl.carousel', [ 0 ]);
simple.trigger('add.owl.carousel', [ '<li>1</li>' ]);
simple.trigger('refresh.owl.carousel');
equal(simple.html(), simpleClone.html(), 'Inner HTML before and after `remove()` and `add()` equals.');
}
test('invalidate', function() {
expect(6);
var carousel = $('#simple').owlCarousel().data('owl.carousel');
deepEqual(carousel.invalidate(), [], 'No invalid parts after initializing.');
carousel.invalidate('first');
deepEqual(carousel.invalidate(), [ 'first' ], 'One invalid part after invalidating one.');
carousel.invalidate('second');
deepEqual(carousel.invalidate(), [ 'first', 'second' ], 'Two invalid parts after invalidating a second one.');
carousel.invalidate('second');
deepEqual(carousel.invalidate(), [ 'first', 'second' ], 'Two invalid parts after invalidating a part twice.');
carousel.update();
deepEqual(carousel.invalidate(), [], 'No invalid parts after updating.');
deepEqual(carousel.invalidate('first'), [ 'first' ], 'Invalidating one part returns it directly.');
});
test('destroy', function() {
expect(1);
var simple = $('#simple'),
expected = simple.get(0).outerHTML.replace(/\s{2,}/g, '');
simple.owlCarousel().owlCarousel('destroy');
equal(simple.get(0).outerHTML.replace(/\s{2,}/g, ''), expected, 'Outer HTML before create and after destroy is equal.');
});
start();