@joystick.js/test-canary 0.0.0-canary.51 → 0.0.0-canary.53
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{parseHTML as
|
|
1
|
+
import{parseHTML as m}from"linkedom";import d from"@joystick.js/ui-canary";import s from"./event.js";import i from"../load/index.js";const p=()=>{const n=m(`
|
|
2
2
|
<html>
|
|
3
3
|
<head></head>
|
|
4
4
|
<body>
|
|
@@ -6,4 +6,4 @@ import{parseHTML as d}from"linkedom";import c from"@joystick.js/ui-canary";impor
|
|
|
6
6
|
<meta name="csrf" content="joystick_test" />
|
|
7
7
|
</body>
|
|
8
8
|
</html>
|
|
9
|
-
`),{window:r,document:
|
|
9
|
+
`),{window:r,document:t,Element:a,Event:e,HTMLElement:o}=n;return global.window=r,global.document=t,global.HTMLElement=o,global.Element=a,global.Event=e,global.console={log:console.log,warn:console.warn,error:console.error},n};var f=async(n="",r={})=>{const t=p();window.joystick={},window.__joystick_data__={},window.__joystick_req__={params:{},query:{},context:{user:{}}};const a=await i(n,{default:!0}),e=d.mount(a,r?.props||{},t?.document.querySelector("#app"));return{...t,component:e,test:{data:async()=>{try{await e?.data?.refetch()}catch(o){console.warn(o)}},method:(o="",...l)=>{const c=e?.methods[o];return c?c(...l):null},event:(o="",l="")=>s(o,l,t)}}};export{f as default};
|
package/package.json
CHANGED
package/src/helpers/dom/index.js
CHANGED
|
@@ -41,13 +41,17 @@ export default async (pathToComponent = '', options = {}) => {
|
|
|
41
41
|
// Joystick component files.
|
|
42
42
|
const Component = await load(pathToComponent, { default: true });
|
|
43
43
|
const component = joystick.mount(Component, options?.props || {}, dom?.document.querySelector('#app'));
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
return {
|
|
46
46
|
...dom,
|
|
47
47
|
component,
|
|
48
48
|
test: {
|
|
49
|
-
data: () => {
|
|
50
|
-
|
|
49
|
+
data: async () => {
|
|
50
|
+
try {
|
|
51
|
+
await component?.data?.refetch();
|
|
52
|
+
} catch (exception) {
|
|
53
|
+
console.warn(exception);
|
|
54
|
+
}
|
|
51
55
|
},
|
|
52
56
|
method: (methodName = '', ...methodArgs) => {
|
|
53
57
|
const methodToCall = component?.methods[methodName];
|