Skip to content

Commit 0a1cbaa

Browse files
committed
use d3.selectAll().size() to count number of items
1 parent 4576014 commit 0a1cbaa

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

test/jasmine/tests/plot_interact_test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ describe('Test plot structure', function() {
2121

2222
it('has one *subplot xy* node', function() {
2323
var nodes = d3.selectAll('g.subplot.xy');
24-
expect(nodes[0].length).toEqual(1);
24+
expect(nodes.size()).toEqual(1);
2525
});
2626

2727
it('has one *scatterlayer* node', function() {
2828
var nodes = d3.selectAll('g.scatterlayer');
29-
expect(nodes[0].length).toEqual(1);
29+
expect(nodes.size()).toEqual(1);
3030
});
3131

3232
it('has as many *trace scatter* nodes as there are traces', function() {
3333
var nodes = d3.selectAll('g.trace.scatter');
34-
expect(nodes[0].length).toEqual(mock.data.length);
34+
expect(nodes.size()).toEqual(mock.data.length);
3535
});
3636

3737
it('has as many *point* nodes as there are traces', function() {
@@ -42,7 +42,7 @@ describe('Test plot structure', function() {
4242
Npts += trace.x.length;
4343
});
4444

45-
expect(nodes[0].length).toEqual(Npts);
45+
expect(nodes.size()).toEqual(Npts);
4646
});
4747
});
4848

@@ -61,7 +61,7 @@ describe('Test plot structure', function() {
6161
Npts += trace.values.length;
6262
});
6363

64-
expect(nodes[0].length).toEqual(Npts);
64+
expect(nodes.size()).toEqual(Npts);
6565
});
6666
});
6767
});
@@ -82,7 +82,7 @@ describe('Test plot structure', function() {
8282
if(items) Npts += items.length;
8383
});
8484

85-
expect(nodes[0].length).toEqual(Npts);
85+
expect(nodes.size()).toEqual(Npts);
8686
});
8787

8888
it('has as many *point* nodes as there are marker points', function() {
@@ -94,7 +94,7 @@ describe('Test plot structure', function() {
9494
if(items) Npts += items.length;
9595
});
9696

97-
expect(nodes[0].length).toEqual(Npts);
97+
expect(nodes.size()).toEqual(Npts);
9898
});
9999
});
100100

@@ -113,7 +113,7 @@ describe('Test plot structure', function() {
113113
Npts += trace.r.length;
114114
});
115115

116-
expect(nodes[0].length).toEqual(Npts);
116+
expect(nodes.size()).toEqual(Npts);
117117
});
118118
});
119119
});

0 commit comments

Comments
 (0)