@joystick.js/test-canary 0.0.0-canary.59 → 0.0.0-canary.60
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 d}from"linkedom";import m from"@joystick.js/ui-canary";import i from"node-fetch";import p from"./event.js";import w from"../load/index.js";const u=()=>{const n=d(`
|
|
2
2
|
<html>
|
|
3
3
|
<head></head>
|
|
4
4
|
<body>
|
|
@@ -6,4 +6,4 @@ import{parseHTML as m}from"linkedom";import d from"@joystick.js/ui-canary";impor
|
|
|
6
6
|
<meta name="csrf" content="joystick_test" />
|
|
7
7
|
</body>
|
|
8
8
|
</html>
|
|
9
|
-
`),{window:r,document:e,Element:a,Event:
|
|
9
|
+
`),{window:r,document:e,Element:a,Event:l,HTMLElement:t}=n;return global.window=r,global.document=e,global.HTMLElement=t,global.Element=a,global.Event=l,global.console={log:console.log,warn:console.warn,error:console.error},n};var b=async(n="",r={})=>{const e=u();window.fetch=i,window.location={origin:`http://localhost:${process.env.PORT}`};const a=await i(`${window?.location?.origin}/api/_test/bootstrap`).then(async o=>o.json());console.log({bootstrap:a}),window.joystick={},window.__joystick_data__={},window.__joystick_req__={params:{},query:{},context:{user:{}}};const l=await w(n,{default:!0}),t=m.mount(l,r?.props||{},e?.document.querySelector("#app"));return t.isTest=!0,{dom:e,instance:t,test:{data:async(o={})=>t?.data?.refetch(o),method:(o="",...s)=>{const c=t?.methods[o];return c?c(...s):null},event:(o="",s="")=>p(o,s,e)}}};export{b as default};
|
package/package.json
CHANGED
|
@@ -39,10 +39,10 @@ export default async (pathToComponent = '', options = {}) => {
|
|
|
39
39
|
origin: `http://localhost:${process.env.PORT}`,
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
const bootstrap = await fetch(`${origin}/api/_test/bootstrap`).then(async (response) => response.json());
|
|
42
|
+
const bootstrap = await fetch(`${window?.location?.origin}/api/_test/bootstrap`).then(async (response) => response.json());
|
|
43
43
|
|
|
44
44
|
console.log({ bootstrap });
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
// TODO: This needs to be more heavily leveraged vis a vis the settings file.
|
|
47
47
|
// Basically, w/o a server we need to be able to pipe in certain data. I *can*
|
|
48
48
|
// technically fetch data internally here and set it (may need some internal
|