Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
MUR Drupal
d3-library
Commits
51d4d0ac
Commit
51d4d0ac
authored
Jul 02, 2013
by
Mike Bostock
Browse files
Add test for enter-insert.
parent
d1f8082a
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/selection/insert-test.js
View file @
51d4d0ac
...
...
@@ -110,6 +110,28 @@ suite.addBatch({
}
});
suite
.
addBatch
({
"
enter insert
"
:
{
topic
:
load
(
"
selection/selection
"
).
document
(),
"
on a page with existing elements
"
:
{
topic
:
function
(
d3
)
{
var
body
=
d3
.
select
(
"
body
"
);
body
.
selectAll
(
"
div
"
).
data
([
"
apple
"
,
"
orange
"
]).
enter
().
append
(
"
div
"
);
return
body
;
},
"
inserts before the following updating sibling
"
:
function
(
body
)
{
body
.
selectAll
(
"
div
"
).
data
([
"
peach
"
,
"
apple
"
,
"
banana
"
,
"
orange
"
,
"
apricot
"
]).
enter
().
insert
(
"
div
"
);
var
div
=
body
.
selectAll
(
"
div
"
);
assert
.
equal
(
div
[
0
][
0
].
__data__
,
"
peach
"
);
assert
.
equal
(
div
[
0
][
1
].
__data__
,
"
apple
"
);
assert
.
equal
(
div
[
0
][
2
].
__data__
,
"
banana
"
);
assert
.
equal
(
div
[
0
][
3
].
__data__
,
"
orange
"
);
assert
.
equal
(
div
[
0
][
4
].
__data__
,
"
apricot
"
);
}
}
}
});
suite
.
addBatch
({
"
selectAll(div).data(…).enter()
"
:
{
topic
:
load
(
"
selection/selection
"
).
document
(),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment