Skip to content

Commit

Permalink
test: fix the 1px diff issue while testing in playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
arianrhodsandlot committed Jan 23, 2025
1 parent e8d7ae0 commit f287b0c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
5 changes: 5 additions & 0 deletions playground/activate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ const handlers = {
})
document.body.append(image)
},

exit() {
nostalgist.exit()
},
}

export function activate(mod: typeof Nostalgist_) {
const nostalgistConfig = {
style: {
Expand Down
17 changes: 17 additions & 0 deletions playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,28 @@
<style>
body {
text-align: center;
line-height: normal;
}

h1 {
display: flex;
justify-content: center;
align-items: center;
gap: 10px;
margin: 32px auto 0 auto;
}

h3 {
margin: 10px auto;
}

button {
line-height: normal;
cursor: pointer;
}

button:disabled {
cursor: wait;
}
</style>
</head>
Expand Down Expand Up @@ -47,6 +63,7 @@ <h3>Instance Methods</h3>
<button type="button">pressA</button>
<button type="button">pressStart</button>
<button type="button">screenshot</button>
<button type="button">exit</button>
</div>

<script type="module">
Expand Down
8 changes: 4 additions & 4 deletions src/classes/emulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ export class Emulator {
}

exit(statusCode = 0) {
const { emscripten } = this
if (emscripten) {
try {
const { exit, JSEvents } = this.getEmscripten()
exit(statusCode)
this.fs.dispose()
JSEvents.removeAllEventListeners()
}
} catch {}

this.fs.dispose()
}

getEmscripten() {
Expand Down

0 comments on commit f287b0c

Please sign in to comment.