Skip to content

Commit

Permalink
test: 适配 button 编译默认添加 hoverclass="button-hover"
Browse files Browse the repository at this point in the history
  • Loading branch information
Otto-J committed Aug 30, 2024
1 parent 0d57296 commit 0adceac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions packages/runtime-core/__tests__/hmr.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ describe('hot module replacement', () => {
}

render(h(Parent), root)
expect(serializeInner(root)).toBe(`<button></button><div>0</div>`)
expect(serializeInner(root)).toBe(
`<button hoverClass="button-hover"></button><div>0</div>`,
)

reload(childId, {
__hmrId: childId,
Expand Down Expand Up @@ -252,7 +254,9 @@ describe('hot module replacement', () => {
}

render(h(Parent), root)
expect(serializeInner(root)).toBe(`<button></button><div>0</div>`)
expect(serializeInner(root)).toBe(
`<button hoverClass="button-hover"></button><div>0</div>`,
)

reload(childId, {
__hmrId: childId,
Expand Down Expand Up @@ -330,7 +334,9 @@ describe('hot module replacement', () => {
}

render(h(Parent), root)
expect(serializeInner(root)).toBe(`<button></button><div>0</div>`)
expect(serializeInner(root)).toBe(
`<button hoverClass="button-hover"></button><div>0</div>`,
)

reload(childId, {
__hmrId: childId,
Expand Down Expand Up @@ -437,14 +443,14 @@ describe('hot module replacement', () => {

render(h(Comp), root)
expect(serializeInner(root)).toBe(
`<div><div>0</div><button>++</button></div>`,
`<div><div>0</div><button hoverClass="button-hover">++</button></div>`,
)

// 1. click to trigger update
triggerEvent((root as any).children[0].children[1], 'click')
await nextTick()
expect(serializeInner(root)).toBe(
`<div><div>1</div><button>++</button></div>`,
`<div><div>1</div><button hoverClass="button-hover">++</button></div>`,
)

// 2. trigger HMR
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-core/__tests__/hydration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ describe('SSR hydration', () => {
serverResolve(Comp)
const html = await htmlPromise
expect(html).toMatchInlineSnapshot(

Check failure on line 775 in packages/runtime-core/__tests__/hydration.spec.ts

View workflow job for this annotation

GitHub Actions / unit-test

packages/runtime-core/__tests__/hydration.spec.ts > SSR hydration > async component

Error: Snapshot `SSR hydration > async component 1` mismatched - Expected + Received - "<!--[-->hello<button hoverClass="button-hover">hello!</button>world<!--]-->" + "<!--[-->hello<button hoverclass="button-hover">hello!</button>world<!--]-->" ❯ packages/runtime-core/__tests__/hydration.spec.ts:775:18
`"<!--[-->hello<button>hello!</button>world<!--]-->"`,
`"<!--[-->hello<button hoverClass="button-hover">hello!</button>world<!--]-->"`,
)

// hydration
Expand Down

0 comments on commit 0adceac

Please sign in to comment.