Skip to content

Commit

Permalink
Fix #245 and add regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
danvk committed Oct 15, 2015
1 parent 3c48816 commit 09b36f4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare module "underscore" {
declare function find<T>(list: T[], predicate: (val: T)=>boolean): ?T;
declare function findWhere<T>(list: Array<T>, properties: {}): ?T;
declare function findWhere<T>(list: Array<T>, properties: {[key:string]: any}): ?T;
declare function clone<T>(obj: T): T;

declare function isEqual<S, T>(a: S, b: T): boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/main/pileup.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type PileupParams = {
}

function findReference(tracks: VisualizedTrack[]): ?VisualizedTrack {
return _.findWhere(tracks, t => t.track.isReference);
return _.find(tracks, t => !!t.track.isReference);
}

function create(elOrId: string|Element, params: PileupParams): Pileup {
Expand Down
1 change: 1 addition & 0 deletions src/main/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type Track = {
data: Object; // This is a DataSource object
name?: string;
cssClass?: string;
isReference?: boolean
}

export type VisualizedTrack = {
Expand Down
20 changes: 10 additions & 10 deletions src/test/components-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ var pileup = require('../main/pileup'),

describe('pileup', function() {
var tracks = [
{
viz: pileup.viz.scale(),
data: pileup.formats.empty(),
name: 'Scale'
},
{
viz: pileup.viz.location(),
data: pileup.formats.empty(),
name: 'Location'
},
{
viz: pileup.viz.genome(),
isReference: true,
Expand All @@ -33,16 +43,6 @@ describe('pileup', function() {
}),
cssClass: 'c'
},
{
viz: pileup.viz.scale(),
data: pileup.formats.empty(),
name: 'Scale'
},
{
viz: pileup.viz.location(),
data: pileup.formats.empty(),
name: 'Location'
},
{
viz: pileup.viz.pileup(),
data: pileup.formats.bam({
Expand Down

0 comments on commit 09b36f4

Please sign in to comment.