-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
61 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,26 @@ | ||
import '@testing-library/jest-dom'; | ||
import { render, screen, act } from '@testing-library/react'; | ||
import React from 'react'; | ||
import { render, screen, waitFor } from '@testing-library/react'; | ||
import React, { Fragment } from 'react'; | ||
import VueComponent from './2-getVNode' | ||
import {applyPureVueInReact, getVNode} from 'veaury' | ||
|
||
const ReactComponent = applyPureVueInReact(VueComponent) | ||
const ReactNode = <div>test getVNode</div> | ||
test('test getVNode', () => { | ||
render(<ReactComponent passingVNode={getVNode(ReactNode)}/>); | ||
const linkElement = screen.getByText(/test getVNode/); | ||
expect(linkElement).toBeInTheDocument(); | ||
function TempReactComponent() { | ||
return <div>TempReactComponent</div> | ||
} | ||
const ReactNode = <Fragment><div>test getVNode<TempReactComponent/></div></Fragment> | ||
test('test getVNode', async () => { | ||
let ref1 | ||
let ref2 = {current: null} | ||
render(<ReactComponent passingVNode={getVNode(() => ReactNode)}> | ||
<div data-testid="children1" ref={(r) => {ref1 = r}}>children1</div> | ||
<div data-testid="children2" ref={ref2}>children2</div> | ||
</ReactComponent>); | ||
await waitFor(() => { | ||
expect(screen.getByText(/test getVNode/)).toBeInTheDocument(); | ||
expect(screen.getByText(/TempReactComponent/)).toBeInTheDocument(); | ||
expect(!!ref1).toBe(true) | ||
expect(!!ref2.current).toBe(true) | ||
}) | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<template> | ||
<component :is="() => passingVNode"/> | ||
<slot/> | ||
</template> | ||
|
||
<script setup> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters