Skip to content

Commit

Permalink
Test font option
Browse files Browse the repository at this point in the history
  • Loading branch information
eweitz committed May 8, 2021
1 parent ce1d29f commit 24391a7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion examples/vanilla/related-genes.html
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ <h1>Related genes | Ideogram</h1>
chrHeight: 100,
chrLabelSize: 12,
annotationHeight: 7,
fontFamily: "'Montserrat', sans-serif",
// fontFamily: "'Montserrat', sans-serif",
onLoad: plotGeneFromUrl,
onPlotRelatedGenes: reportRelatedGenes,
showAnnotLabels: true,
Expand Down
8 changes: 1 addition & 7 deletions src/js/kit/related-genes.js
Original file line number Diff line number Diff line change
Expand Up @@ -737,10 +737,8 @@ function decorateRelatedGene(annot) {

const shape = 'triangle';

let fontFamily;

const legendHeaderStyle =
`font-size: 14px; font-weight: bold; font-color: #333; ${fontFamily}`;
`font-size: 14px; font-weight: bold; font-color: #333;`;
const relatedLegend = [{
name: `
<div style="position: relative; left: -15px; padding-bottom: 10px;">
Expand Down Expand Up @@ -790,8 +788,6 @@ function _initRelatedGenes(config, annotsInList) {
annotsInList = annotsInList.map(name => name.toLowerCase());
}

fontFamily = (config.fontFamily) ? config.fontFamily : '';

const kitDefaults = {
showFullyBanded: false,
rotatable: false,
Expand Down Expand Up @@ -887,8 +883,6 @@ function _initGeneHints(config, annotsInList) {
annotsInList = annotsInList.map(name => name.toLowerCase());
}

fontFamily = (config.fontFamily) ? config.fontFamily : '';

const annotsPath =
getDir('annotations/gene-cache/homo-sapiens-top-genes.tsv');

Expand Down
1 change: 0 additions & 1 deletion test/offline/core.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -783,5 +783,4 @@ describe('Ideogram', function() {

var ideogram = new Ideogram(config);
});

});
14 changes: 11 additions & 3 deletions test/online/related-genes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ describe('Ideogram related genes kit', function() {
d3.selectAll('div').remove();
});

it('handles searched gene and annotation click', done => {
function getFontFamily(selector) {
const element = document.querySelector(selector);
return window.getComputedStyle(element).getPropertyValue('font-family');
}

it('handles searched gene, annotation click, and font', done => {

async function callback() {
await ideogram.plotRelatedGenes('RAD51');
Expand Down Expand Up @@ -45,7 +50,9 @@ describe('Ideogram related genes kit', function() {
}

function onPlotRelatedGenes() {
// pass through
const legendFontFamily = getFontFamily('#_ideogramLegend');
assert.equal(legendFontFamily, 'serif');
assert.equal(getFontFamily('.chrLabel'), 'serif');
}

function onWillShowAnnotTooltip(annot) {
Expand All @@ -65,7 +72,8 @@ describe('Ideogram related genes kit', function() {
dataDir: '/dist/data/bands/native/',
onClickAnnot,
onPlotRelatedGenes,
onWillShowAnnotTooltip
onWillShowAnnotTooltip,
fontFamily: 'serif'
};

const ideogram = Ideogram.initRelatedGenes(config);
Expand Down

0 comments on commit 24391a7

Please sign in to comment.