test: update e2e testing for @idraw/core

This commit is contained in:
chenshenhai 2021-08-20 12:30:16 +08:00
parent 8141f4ab12
commit ce9b328491
4 changed files with 133 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 KiB

After

Width:  |  Height:  |  Size: 386 KiB

View file

@ -61,6 +61,15 @@
<div class="box" id="mount-6">
<div class="title">HTML</div>
</div>
<div class="box" id="mount-7">
<div class="title">Element: click selected</div>
</div>
<div class="box" id="mount-8">
<div class="title">Element: lock</div>
</div>
<div class="box" id="mount-9">
<div class="title">Element: invisible</div>
</div>
</div>
<script src="./../../dist/index.global.js"></script>
@ -373,5 +382,126 @@
});
})();
</script>
<script type="module">
import event from './../../../../scripts/browser/event.js';
(function() {
const mount = document.querySelector('#mount-7');
const core = new Core(mount, opts, config);
core.addElement({
name: "rect-001",
x: 20,
y: 20,
w: 200,
h: 60,
type: "rect",
desc: {
color: "#c6e0f5",
borderRadius: 8,
borderWidth: 2,
borderColor: "#2196f3",
},
})
core.addElement({
name: "rect-002",
x: 50,
y: 100,
w: 200,
h: 80,
type: "rect",
desc: {
color: "#c6e0f5",
borderRadius: 8,
borderWidth: 2,
borderColor: "#2196f3",
},
});
setTimeout(() => {
event.mouseDown({ x: 100, y: 560 })
}, 100);
})();
</script>
<script type="module">
import event from './../../../../scripts/browser/event.js';
(function() {
const mount = document.querySelector('#mount-8');
const core = new Core(mount, opts, config);
core.addElement({
name: "rect-001",
x: 20,
y: 20,
w: 200,
h: 60,
lock: true,
type: "rect",
desc: {
color: "#c6e0f5",
borderRadius: 8,
borderWidth: 2,
borderColor: "#2196f3",
},
})
core.addElement({
name: "rect-002",
x: 50,
y: 100,
w: 200,
h: 80,
type: "rect",
desc: {
color: "#c6e0f5",
borderRadius: 8,
borderWidth: 2,
borderColor: "#2196f3",
},
});
setTimeout(() => {
event.mouseDown({ x: 340, y: 560 })
}, 100);
})();
</script>
<script type="module">
import event from './../../../../scripts/browser/event.js';
(function() {
const mount = document.querySelector('#mount-9');
const core = new Core(mount, opts, config);
core.addElement({
name: "rect-001",
x: 20,
y: 20,
w: 200,
h: 60,
invisible: true,
type: "rect",
desc: {
color: "#c6e0f5",
borderRadius: 8,
borderWidth: 2,
borderColor: "#2196f3",
},
})
core.addElement({
name: "rect-002",
x: 50,
y: 100,
w: 200,
h: 80,
type: "rect",
desc: {
color: "#c6e0f5",
borderRadius: 8,
borderWidth: 2,
borderColor: "#2196f3",
},
});
setTimeout(() => {
event.mouseDown({ x: 340, y: 560 })
}, 100);
})();
</script>
</body>
</html>

View file

@ -295,7 +295,7 @@ class Core {
this[_tempData].set('selectedUUID', uuid);
} else {
const [index, uuid] = this[_element].isPointInElement(point, this[_data]);
if (index >= 0) {
if (index >= 0 && this[_data].elements[index]?.invisible !== true) {
// Controll Element
this.selectElementByIndex(index, { useMode: true });
if (typeof uuid === 'string' && this[_coreEvent].has('screenSelectElement')) {

View file

@ -3,8 +3,8 @@ const pageList = [
{ path: 'board/examples/test/scale.html', w: 930, h: 540, delay: 500 },
{ path: 'board/examples/test/scroll.html', w: 620, h: 270, delay: 500 },
{ path: 'board/examples/test/event.html', w: 620, h: 270, delay: 500 },
{ path: 'core/examples/test/elements.html', w: 930, h: 540, delay: 500 },
{ path: 'core/examples/test/api.html', w: 930, h: 1300, delay: 1000 },
{ path: 'core/examples/test/elements.html', w: 930, h: 820, delay: 800 },
{ path: 'core/examples/test/api.html', w: 930, h: 1300, delay: 800 },
]
module.exports = {