From 5e66f1f160a6f2c20b2d38522b87a20f0aa7c300 Mon Sep 17 00:00:00 2001 From: Matias Arriola Date: Wed, 22 Dec 2021 11:22:08 -0300 Subject: [PATCH 1/3] Fix textarea not showing after eslint fixes (eqeqeq) --- packages/web2d/src/components/peer/svg/Font.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/web2d/src/components/peer/svg/Font.js b/packages/web2d/src/components/peer/svg/Font.js index a9ee7ca2..3d503d97 100644 --- a/packages/web2d/src/components/peer/svg/Font.js +++ b/packages/web2d/src/components/peer/svg/Font.js @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { $defined } from '@wisemapping/core-js'; +import { $assert, $defined } from '@wisemapping/core-js'; class Font { constructor() { @@ -68,7 +68,9 @@ class Font { return this._weight; } - setSize(size) { + setSize(value) { + const size = parseInt(value, 10); + $assert(!Number.isNaN(size), 'size must be a valid integer'); this._size = size; } From 86780ed0e933c5bca96a2e58ce25a246d244ebad Mon Sep 17 00:00:00 2001 From: Matias Arriola Date: Wed, 22 Dec 2021 12:23:42 -0300 Subject: [PATCH 2/3] Set threshold for cypress-image-snapshot --- packages/mindplot/cypress/support/commands.js | 5 ++++- packages/web2d/cypress/support/commands.js | 5 ++++- packages/webapp/cypress/support/commands.ts | 7 ++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/mindplot/cypress/support/commands.js b/packages/mindplot/cypress/support/commands.js index bcb624c8..85cef3a6 100644 --- a/packages/mindplot/cypress/support/commands.js +++ b/packages/mindplot/cypress/support/commands.js @@ -3,7 +3,10 @@ import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command'; // make matchImageSnapshot() call the real implementation only if CYPRESS_imageSnaphots is set // otherwise it calls a noop if (Cypress.env('imageSnaphots')) { - addMatchImageSnapshotCommand(); + addMatchImageSnapshotCommand({ + failureThreshold: 0.001, + failureThresholdType: 'percent', + }); } else { Cypress.Commands.add( 'matchImageSnapshot', diff --git a/packages/web2d/cypress/support/commands.js b/packages/web2d/cypress/support/commands.js index cf3e92fd..77d192ad 100644 --- a/packages/web2d/cypress/support/commands.js +++ b/packages/web2d/cypress/support/commands.js @@ -3,7 +3,10 @@ import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command'; // make matchImageSnapshot() call the real implementation only if CYPRESS_imageSnaphots is set // otherwise it calls a noop if (Cypress.env('imageSnaphots')) { - addMatchImageSnapshotCommand(); + addMatchImageSnapshotCommand({ + failureThreshold: 0.001, + failureThresholdType: 'percent', + }); } else { Cypress.Commands.add( 'matchImageSnapshot', diff --git a/packages/webapp/cypress/support/commands.ts b/packages/webapp/cypress/support/commands.ts index 5a2a7981..4f1ceb2d 100644 --- a/packages/webapp/cypress/support/commands.ts +++ b/packages/webapp/cypress/support/commands.ts @@ -1,12 +1,13 @@ import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command'; import '@testing-library/cypress/add-commands'; -addMatchImageSnapshotCommand(); - // make matchImageSnapshot() call the real implementation only if CYPRESS_imageSnaphots is set // otherwise it calls a noop if (Cypress.env('imageSnaphots')) { - addMatchImageSnapshotCommand(); + addMatchImageSnapshotCommand({ + failureThreshold: 0.001, + failureThresholdType: 'percent', + }); } else { Cypress.Commands.add( 'matchImageSnapshot', From 33967db04b00d905d562beb287620b6aa694176a Mon Sep 17 00:00:00 2001 From: Paulo Veiga Date: Wed, 22 Dec 2021 16:51:42 +0000 Subject: [PATCH 3/3] Fix number validation --- packages/web2d/src/components/peer/svg/Font.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/web2d/src/components/peer/svg/Font.js b/packages/web2d/src/components/peer/svg/Font.js index 3d503d97..31ee1740 100644 --- a/packages/web2d/src/components/peer/svg/Font.js +++ b/packages/web2d/src/components/peer/svg/Font.js @@ -26,7 +26,7 @@ class Font { init(args) { if ($defined(args.size)) { - this._size = parseInt(args.size, 10); + this._size = Number.parseInt(args.size, 10); } if ($defined(args.style)) { this._style = args.style; @@ -69,8 +69,8 @@ class Font { } setSize(value) { - const size = parseInt(value, 10); - $assert(!Number.isNaN(size), 'size must be a valid integer'); + const size = Number.parseInt(value, 10); + $assert(!Number.isFinite(size), 'size must be a valid integer'); this._size = size; }