From 912b0b90d5f43ff16f3391fe71b47717bf2cea8d Mon Sep 17 00:00:00 2001 From: Jarek Danielak Date: Thu, 31 Oct 2024 17:30:59 +0100 Subject: [PATCH] chore: PhantomJS clean up --- lib/features/preview-support/PreviewSupport.js | 8 +++----- test/spec/core/CanvasSpec.js | 6 +----- .../features/interaction-events/InteractionEventsSpec.js | 4 +--- test/spec/features/palette/PaletteSpec.js | 8 ++------ 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/lib/features/preview-support/PreviewSupport.js b/lib/features/preview-support/PreviewSupport.js index b8151ca6c..83cae77fc 100644 --- a/lib/features/preview-support/PreviewSupport.js +++ b/lib/features/preview-support/PreviewSupport.js @@ -146,12 +146,10 @@ PreviewSupport.prototype._cloneMarkers = function(gfx, className = 'djs-dragger' if (gfx.childNodes) { - // TODO: use forEach once we drop PhantomJS - for (var i = 0; i < gfx.childNodes.length; i++) { + gfx.childNodes.forEach((childNode) => { + self._cloneMarkers(childNode, className, rootGfx); + }); - // recursively clone markers of child nodes - self._cloneMarkers(gfx.childNodes[ i ], className, rootGfx); - } } if (!canHaveMarker(gfx)) { diff --git a/test/spec/core/CanvasSpec.js b/test/spec/core/CanvasSpec.js index 8f0448ec6..e26379eb7 100644 --- a/test/spec/core/CanvasSpec.js +++ b/test/spec/core/CanvasSpec.js @@ -119,7 +119,7 @@ describe('Canvas', function() { })); - (isPhantomJS() ? it.skip : it)('should not scroll on focus', inject(function(canvas, eventBus) { + it('should not scroll on focus', inject(function(canvas, eventBus) { // given var svg = container.querySelector('svg'); @@ -2750,7 +2750,3 @@ function expectChildren(parent, children) { } - -function isPhantomJS() { - return /PhantomJS/.test(window.navigator.userAgent); -} \ No newline at end of file diff --git a/test/spec/features/interaction-events/InteractionEventsSpec.js b/test/spec/features/interaction-events/InteractionEventsSpec.js index 4c1de7a5d..0fa08872b 100755 --- a/test/spec/features/interaction-events/InteractionEventsSpec.js +++ b/test/spec/features/interaction-events/InteractionEventsSpec.js @@ -295,9 +295,7 @@ describe('features/interaction-events', function() { describe('api', function() { function getHits(gfx) { - - // TODO(nikku): remove filter when we drop PhantomJS - return filter(domQueryAll('.djs-hit', gfx), function(hit) { return typeof hit !== 'number'; }); + return domQueryAll('.djs-hit', gfx); } diff --git a/test/spec/features/palette/PaletteSpec.js b/test/spec/features/palette/PaletteSpec.js index c989853b1..1c20e50b5 100755 --- a/test/spec/features/palette/PaletteSpec.js +++ b/test/spec/features/palette/PaletteSpec.js @@ -613,7 +613,7 @@ describe('features/palette', function() { })); - (isPhantomJS() ? it.skip : it)('should update tool highlight', inject(function(eventBus, palette) { + it('should update tool highlight', inject(function(eventBus, palette) { // given var toolName = 'entryA'; @@ -629,7 +629,7 @@ describe('features/palette', function() { })); - (isPhantomJS() ? it.skip : it)('should unset tool highlight', inject(function(eventBus, palette) { + it('should unset tool highlight', inject(function(eventBus, palette) { // given var toolName = 'entryA'; @@ -876,7 +876,3 @@ function expectContainerCls(marker, expectedActive) { function getEntryNode(action, container) { return domQuery('.entry[data-action="' + action + '"]', container); } - -function isPhantomJS() { - return /PhantomJS/.test(window.navigator.userAgent); -} \ No newline at end of file