Skip to content

Commit bbc9205

Browse files
committed
fix: test runner showing stray buttons due to hot corners
1 parent 98f5e2a commit bbc9205

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/LiveDevelopment/BrowserScripts/RemoteFunctions.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
* exported functions.
3030
*/
3131
function RemoteFunctions(config = {}) {
32-
32+
// we load this file in unit test window and dont want it to do anything unexpected in the unit test runner context
33+
const isUnitTestWindow = window.Phoenix && window.Phoenix.isTestWindow;
3334
const GLOBALS = {
3435
// given to internal elements like info box, options box, image gallery and all other phcode internal elements
3536
// to distinguish between phoenix internal vs user created elements
@@ -5626,15 +5627,15 @@ function RemoteFunctions(config = {}) {
56265627
// init the hot corner after the DOM is ready
56275628
if (document.readyState === 'loading') {
56285629
document.addEventListener('DOMContentLoaded', () => {
5629-
if (!_hotCorner) {
5630+
if (!_hotCorner && !isUnitTestWindow) {
56305631
_hotCorner = new HotCorner();
56315632
_hotCorner.updateState(config.mode === 'preview');
56325633
}
56335634
});
56345635
} else {
56355636
// or if the DOM is already ready then init directly
56365637
setTimeout(() => {
5637-
if (!_hotCorner) {
5638+
if (!_hotCorner && !isUnitTestWindow) {
56385639
_hotCorner = new HotCorner();
56395640
_hotCorner.updateState(config.mode === 'preview');
56405641
}

0 commit comments

Comments
 (0)