Skip to content

Commit

Permalink
(unhcr#613) - ABSY and ICMY tests for selected
Browse files Browse the repository at this point in the history
  • Loading branch information
benrudolph committed Sep 22, 2014
1 parent f500982 commit 89f62fd
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/javascripts/bmy_figure_test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test 'render', ->

strictEqual $(@figure.el).find('.budget-line').length, 3, 'Should have drawn 3 budget lines'

test 'select', ->
test 'active', ->
@figure.isExport = true
@figure.subscribe()
@figure.modelFn @d
Expand All @@ -68,3 +68,20 @@ test 'select', ->

$.publish("active.#{@figure.figureId()}.figure", [@figure.filtered(@d)[i], i])
strictEqual d3.select(@figure.el).selectAll('.active').size(), 0, 'Should have no active elements'

test 'selected', ->

@figure.modelFn @d
@figure.render()

filtered = @figure.filtered @d

@figure.onMouseclickVoronoi { point: filtered[0][0] }, filtered

strictEqual d3.select(@figure.el).selectAll('.budget-point-selected').size(), filtered.length
strictEqual @figure.selectedDatum, filtered[0][0]

@figure.onMouseclickVoronoi { point: filtered[0][0] }, filtered

strictEqual d3.select(@figure.el).selectAll('.budget-point-selected').size(), 0
strictEqual @figure.selectedDatum, null
16 changes: 16 additions & 0 deletions test/javascripts/icmy_figure_test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,19 @@ test 'render', ->

strictEqual @figure.$el.find('.ic-line').length, 4

test 'selected', ->

@figure.collectionFn @outputs
@figure.render()

filtered = @figure.filtered @outputs

@figure.onMouseclickVoronoi { point: filtered[0][0] }, filtered

strictEqual d3.select(@figure.el).selectAll('.icmy-point-selected').size(), filtered.length
strictEqual @figure.selectedDatum, filtered[0][0]

@figure.onMouseclickVoronoi { point: filtered[0][0] }, filtered

strictEqual d3.select(@figure.el).selectAll('.icmy-point-selected').size(), 0
strictEqual @figure.selectedDatum, null

0 comments on commit 89f62fd

Please sign in to comment.