Skip to content

Commit

Permalink
Merge branch 'dev' into 'main'
Browse files Browse the repository at this point in the history
Dev + adding tests

See merge request ebi-biows/jdispatcher-viewers!4
  • Loading branch information
biomadeira committed Nov 6, 2024
2 parents 70d9058 + ee7fb36 commit c1bcee9
Show file tree
Hide file tree
Showing 23 changed files with 7,802 additions and 4,045 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ jobs:
- name: Check code format
run: npm run format
#----------------------------------------------
# Run tests with Jest
#----------------------------------------------
- name: Run tests with Jest
run: npm test
#----------------------------------------------
# Build Module
#----------------------------------------------
- name: Build module
Expand Down
8 changes: 7 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ before_script:

stages:
- check
# - test
- test
# - tag
# building the ES modules and node CLI (also ES module now, from commonJS)
- build
Expand Down Expand Up @@ -58,6 +58,12 @@ format:
- npm run format
allow_failure: false

test:
stage: test
script:
- npm test
allow_failure: false

build_module:
stage: build
script:
Expand Down
4 changes: 4 additions & 0 deletions bin/color-utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ export function getGradientSteps(minEvalue, maxEvalue, minEvalueNotZero, colorSc
* h, s, v
*/
export function HSVtoRGB(h, s, v) {
// Clamp input values to the expected range [0, 1]
h = Math.min(Math.max(h, 0), 1);
s = Math.min(Math.max(s, 0), 1);
v = Math.min(Math.max(v, 0), 1);
let r = 0;
let g = 0;
let b = 0;
Expand Down
2 changes: 1 addition & 1 deletion bin/drawing-utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ export function drawFooterText(renderOptions, topPadding) {
textObj.evented = true;
textObj.top = topPadding;
textObj.left = 225;
const copyright = `European Bioinformatics Institute 2006-2022. ` +
const copyright = `European Bioinformatics Institute 2006-2024. ` +
`EBI is an Outstation of the European Molecular Biology Laboratory.`;
const copyrightText = new fabric.Text(`${copyright}`, textObj);
return [copyrightText, textObj];
Expand Down
10 changes: 5 additions & 5 deletions bin/other-utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ export class ObjectCache {
}
}
}
function countDecimals(n) {
export function countDecimals(n) {
if (Math.floor(n) === n)
return 0;
return n.toString().split('.')[1].length || 0;
}
export function numberToString(n) {
if (Number.isInteger(n)) {
return n + '.0';
}
else if (n < 0.0001 || n > 10000) {
if (n < 0.0001 || n > 10000) {
return n.toExponential(2);
}
else if (Number.isInteger(n)) {
return n + '.0';
}
else if (countDecimals(n) > 3) {
return n.toFixed(3).toString();
}
Expand Down
2 changes: 2 additions & 0 deletions dist/jd_viewers_0.0.10.bundle.min.js

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions dist/jd_viewers_0.0.10.bundle.min.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/

/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */

/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */

/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */

/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */

/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/

/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/

/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
8 changes: 8 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
preset: 'ts-jest/presets/default-esm',
testEnvironment: 'node',
extensionsToTreatAsEsm: ['.ts'],
transform: {
'^.+\\.tsx?$': ['ts-jest', { useESM: true }],
},
};
2 changes: 2 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const { createCanvas } = require('canvas');
global.HTMLCanvasElement.prototype.getContext = () => createCanvas(1200, 800).getContext('2d');
Loading

0 comments on commit c1bcee9

Please sign in to comment.