cypress-ct-octane-js 0.1.30 → 0.1.32

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.
Files changed (2) hide show
  1. package/dist/index.js +16 -6
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,12 +1,22 @@
1
- import { getContainerEl } from "@cypress/mount-utils";
1
+ import { getContainerEl, setupHooks } from "@cypress/mount-utils";
2
2
  import { createRoot } from "octane";
3
+ let dispose;
4
+ function cleanup() {
5
+ Cypress.log({
6
+ name: "unmount",
7
+ message: "Unmounted component",
8
+ });
9
+ dispose === null || dispose === void 0 ? void 0 : dispose();
10
+ }
3
11
  export function mount(component, options = {}) {
4
- const root = getContainerEl();
5
- if (!root) {
12
+ const container = getContainerEl();
13
+ if (!container) {
6
14
  throw new Error("'root' element not found");
7
15
  }
8
- createRoot(root).render(component);
9
- // dispose = render(component, root);
16
+ console.log(container.innerHTML);
17
+ const root = createRoot(container);
18
+ dispose = root.unmount;
19
+ root.render(component);
10
20
  return cy.wait(0, { log: false }).then(() => {
11
21
  if (options.log !== false) {
12
22
  Cypress.log({
@@ -16,4 +26,4 @@ export function mount(component, options = {}) {
16
26
  }
17
27
  });
18
28
  }
19
- // setupHooks(cleanup);
29
+ setupHooks(cleanup);
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "cypress-ct-octane-js",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "description": "Octane framework definition and mount adapter for Cypress component testing",
5
5
  "keywords": [
6
- "octane",
7
6
  "cypress",
7
+ "octane",
8
8
  "testing"
9
9
  ],
10
10
  "license": "MIT",