@joystick.js/test-canary 0.0.0-canary.45 → 0.0.0-canary.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/helpers/dom/index.js +2 -2
- package/package.json +1 -1
- package/src/helpers/dom/index.js +2 -2
- package/src/test.js +2 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{parseHTML as a}from"linkedom";import
|
|
1
|
+
import{parseHTML as a}from"linkedom";import c from"@joystick.js/ui-canary";import s from"./event.js";import i from"../load/index.js";const p=()=>{const e=a(`
|
|
2
2
|
<html>
|
|
3
3
|
<head></head>
|
|
4
4
|
<body>
|
|
5
5
|
<div id="app"></div>
|
|
6
6
|
</body>
|
|
7
7
|
</html>
|
|
8
|
-
`),{window:
|
|
8
|
+
`),{window:l,document:o,Element:r,Event:n,HTMLElement:t}=e;return global.window=l,global.document=o,global.HTMLElement=t,global.Element=r,global.Event=n,global.console={log:console.log,warn:console.warn,error:console.error},e};var f=async(e="",l={})=>{const o=p();window.joystick={};const r=await i(e,{default:!0}),n=c.mount(r,l?.props||{},o?.document.querySelector("#app"));return{...o,component:n,test:{method:(t="",...m)=>{const d=n?.methods[t];return d?d(...m):null},event:(t="",m="")=>s(t,m,o)}}};export{f as default};
|
package/package.json
CHANGED
package/src/helpers/dom/index.js
CHANGED
|
@@ -37,12 +37,13 @@ export default async (pathToComponent = '', options = {}) => {
|
|
|
37
37
|
// NOTE: Force default to true as that's the prescribed pattern for
|
|
38
38
|
// Joystick component files.
|
|
39
39
|
const Component = await load(pathToComponent, { default: true });
|
|
40
|
+
const component = joystick.mount(Component, options?.props || {}, dom?.document.querySelector('#app'));
|
|
40
41
|
|
|
41
42
|
return {
|
|
42
43
|
...dom,
|
|
44
|
+
component,
|
|
43
45
|
test: {
|
|
44
46
|
method: (methodName = '', ...methodArgs) => {
|
|
45
|
-
const component = joystick.mount(Component, options?.props || {}, dom?.document.querySelector('#app'));
|
|
46
47
|
const methodToCall = component?.methods[methodName];
|
|
47
48
|
|
|
48
49
|
if (!methodToCall) {
|
|
@@ -52,7 +53,6 @@ export default async (pathToComponent = '', options = {}) => {
|
|
|
52
53
|
return methodToCall(...methodArgs);
|
|
53
54
|
},
|
|
54
55
|
event: (eventType = '', eventTarget = '') => {
|
|
55
|
-
joystick.mount(Component, options?.props || {}, dom?.document.querySelector('#app'));
|
|
56
56
|
return event(eventType, eventTarget, dom);
|
|
57
57
|
},
|
|
58
58
|
},
|