Skip to content

Commit

Permalink
test:
Browse files Browse the repository at this point in the history
  • Loading branch information
army8735 committed Jul 13, 2023
1 parent d56a3ed commit c3165d1
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/group4/parse-animate-multi-after-dom/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=0"/>
<title>test</title>
</head>
<body>
<div id="test"></div>
<input id="base64" type="text" value=""/>
<script src="../../../index.js"></script>
<script src="script.js"></script>
</body>
</html>
70 changes: 70 additions & 0 deletions test/group4/parse-animate-multi-after-dom/script.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
const root = karas.render(
<canvas width={360} height={360}>
{
karas.parse({
tagName: 'div',
props: {
style: {
position: 'absolute',
left: 0,
top: 0,
width: 100,
height: 100,
background: '#F00'
}
},
animate: [{
value: [
{
translateX: 0,
},
{
translateX: 100,
}
],
options: {
duration: 100,
fill: 'both',
}
}]
})
}
</canvas>,
'#test'
);
setTimeout(function() {
root.appendChild(karas.parse({
tagName: 'div',
props: {
style: {
position: 'absolute',
left: 0,
top: 100,
width: 100,
height: 100,
background: '#00F'
}
},
animate: [{
value: [
{
translateX: 0,
},
{
translateX: 100,
}
],
options: {
duration: 100,
fill: 'both',
}
}]
}));
}, 200);

let count = 0;
root.children[0].animationList[0].on(karas.Event.FINISH, () => {
let canvas = document.querySelector('canvas');
let input = document.querySelector('input');
input.value = ++count;
});
13 changes: 13 additions & 0 deletions test/group4/parse-animate-multi-after-dom/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
let path = require('path');
let fs = require('fs');

module.exports = {
'init': function(browser) {
browser
.url('file://' + path.join(__dirname, 'index.html'))
.waitForElementVisible('body', 1000)
.pause(300)
.assert.value('input', '1')
.end();
}
};

0 comments on commit c3165d1

Please sign in to comment.