Skip to content
This repository was archived by the owner on Mar 5, 2022. It is now read-only.

Commit 85e8e8c

Browse files
committed
fix: inject meta utf-8 into the document head
1 parent ca95d0a commit 85e8e8c

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

cypress/integration/hello-x-spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ describe('HelloX component', () => {
99
cy.mount(<HelloX name='SuperMan' />)
1010
cy.contains('Hello SuperMan!')
1111
})
12+
13+
it.only('renders Unicode', () => {
14+
cy.mount(<HelloX name='🌎' />)
15+
cy.contains('Hello 🌎!')
16+
})
1217
})
1318

1419
describe('HelloState component', () => {

lib/index.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,16 @@ Cypress.Commands.add('injectReactDOM', () => {
3131
// otherwise the component will NOT be able to dispatch any events
3232
// when it runs the second time
3333
// https://github.com/bahmutov/cypress-react-unit-test/issues/3
34-
var html = `<body>
35-
<div id="cypress-jsdom"></div>
36-
${scripts}
37-
</body>`
34+
35+
var html = `
36+
<head>
37+
<meta charset="utf-8">
38+
</head>
39+
<body>
40+
<div id="cypress-jsdom"></div>
41+
${scripts}
42+
</body>`
43+
3844
const document = cy.state('document')
3945
document.write(html)
4046
document.close()

0 commit comments

Comments
 (0)