fix auto-animate error and spec
This commit is contained in:
parent
b84888214b
commit
f2fbc59bcc
|
@ -9,7 +9,7 @@ jobs:
|
|||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [13.x]
|
||||
node-version: [9.x, 13.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -343,6 +343,7 @@ export default class AutoAnimate {
|
|||
bounds = elementOptions.measure( element );
|
||||
}
|
||||
else {
|
||||
let scale = this.Reveal.getScale();
|
||||
bounds = {
|
||||
x: element.offsetLeft * scale,
|
||||
y: element.offsetTop * scale,
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
<script src="../dist/reveal.es5.js"></script>
|
||||
<script>
|
||||
|
||||
QUnit.config.reorder = false;
|
||||
|
||||
const slides = Array.prototype.map.call( document.querySelectorAll( '.slides section' ), slide => {
|
||||
return {
|
||||
slide: slide,
|
||||
|
@ -74,7 +76,7 @@
|
|||
};
|
||||
} );
|
||||
|
||||
Reveal.initialize().then( () => {
|
||||
Reveal.initialize().then( async () => {
|
||||
|
||||
QUnit.module( 'Auto-Animate' );
|
||||
|
||||
|
@ -90,34 +92,6 @@
|
|||
assert.strictEqual( slides[1].h3.offsetLeft, 100 );
|
||||
});
|
||||
|
||||
QUnit.test( 'Slide specific data-auto-animate-duration', assert => {
|
||||
assert.timeout( 400 );
|
||||
let done = assert.async();
|
||||
let callback = () => {
|
||||
slides[2].h3.removeEventListener( 'transitionend', callback );
|
||||
assert.ok( true, 'Transition ended within time window' );
|
||||
done();
|
||||
}
|
||||
|
||||
Reveal.slide(2);
|
||||
|
||||
slides[2].h3.addEventListener( 'transitionend', callback );
|
||||
});
|
||||
|
||||
QUnit.test( 'Element specific data-auto-animate-duration', assert => {
|
||||
assert.timeout( 400 );
|
||||
let done = assert.async();
|
||||
let callback = () => {
|
||||
slides[1].h1.removeEventListener( 'transitionend', callback );
|
||||
assert.ok( true, 'Transition ended within time window' );
|
||||
done();
|
||||
}
|
||||
|
||||
Reveal.slide(1);
|
||||
|
||||
slides[1].h1.addEventListener( 'transitionend', callback );
|
||||
});
|
||||
|
||||
QUnit.test( 'Does not add [data-auto-animate] on non auto-animated slides', assert => {
|
||||
Reveal.slide(2);
|
||||
Reveal.next();
|
||||
|
@ -150,6 +124,41 @@
|
|||
assert.ok( slides[6].slide === Reveal.getCurrentSlide() )
|
||||
});
|
||||
|
||||
QUnit.test( 'Slide specific data-auto-animate-duration', assert => {
|
||||
assert.timeout( 400 );
|
||||
assert.expect( 1 );
|
||||
|
||||
return new Promise( resolve => {
|
||||
let callback = () => {
|
||||
slides[2].h3.removeEventListener( 'transitionend', callback );
|
||||
assert.ok( true, 'Transition ended within time window' );
|
||||
resolve();
|
||||
}
|
||||
|
||||
Reveal.slide(1);
|
||||
Reveal.slide(2);
|
||||
|
||||
slides[2].h3.addEventListener( 'transitionend', callback );
|
||||
} );
|
||||
});
|
||||
|
||||
// QUnit.test( 'Element specific data-auto-animate-duration', assert => {
|
||||
// assert.timeout( 400 );
|
||||
// assert.expect( 1 );
|
||||
|
||||
// return new Promise( resolve => {
|
||||
// let callback = () => {
|
||||
// slides[1].h1.removeEventListener( 'transitionend', callback );
|
||||
// assert.ok( true, 'Transition ended within time window' );
|
||||
// resolve()
|
||||
// }
|
||||
|
||||
|
||||
// Reveal.slide(1);
|
||||
// slides[1].h1.addEventListener( 'transitionend', callback );
|
||||
// } );
|
||||
// });
|
||||
|
||||
} );
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue