fix auto-animate error and spec
This commit is contained in:
parent
b84888214b
commit
f2fbc59bcc
|
@ -9,7 +9,7 @@ jobs:
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [13.x]
|
node-version: [9.x, 13.x]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- 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 );
|
bounds = elementOptions.measure( element );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
let scale = this.Reveal.getScale();
|
||||||
bounds = {
|
bounds = {
|
||||||
x: element.offsetLeft * scale,
|
x: element.offsetLeft * scale,
|
||||||
y: element.offsetTop * scale,
|
y: element.offsetTop * scale,
|
||||||
|
|
|
@ -65,6 +65,8 @@
|
||||||
<script src="../dist/reveal.es5.js"></script>
|
<script src="../dist/reveal.es5.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
QUnit.config.reorder = false;
|
||||||
|
|
||||||
const slides = Array.prototype.map.call( document.querySelectorAll( '.slides section' ), slide => {
|
const slides = Array.prototype.map.call( document.querySelectorAll( '.slides section' ), slide => {
|
||||||
return {
|
return {
|
||||||
slide: slide,
|
slide: slide,
|
||||||
|
@ -74,7 +76,7 @@
|
||||||
};
|
};
|
||||||
} );
|
} );
|
||||||
|
|
||||||
Reveal.initialize().then( () => {
|
Reveal.initialize().then( async () => {
|
||||||
|
|
||||||
QUnit.module( 'Auto-Animate' );
|
QUnit.module( 'Auto-Animate' );
|
||||||
|
|
||||||
|
@ -90,34 +92,6 @@
|
||||||
assert.strictEqual( slides[1].h3.offsetLeft, 100 );
|
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 => {
|
QUnit.test( 'Does not add [data-auto-animate] on non auto-animated slides', assert => {
|
||||||
Reveal.slide(2);
|
Reveal.slide(2);
|
||||||
Reveal.next();
|
Reveal.next();
|
||||||
|
@ -150,6 +124,41 @@
|
||||||
assert.ok( slides[6].slide === Reveal.getCurrentSlide() )
|
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>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue