Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
MUR Drupal
d3-library
Commits
99f6e657
Commit
99f6e657
authored
Jul 02, 2013
by
Mike Bostock
Browse files
Fix test and add symmetric test for append.
parent
2f4c228b
Changes
2
Hide whitespace changes
Inline
Side-by-side
test/selection/append-test.js
View file @
99f6e657
...
...
@@ -94,6 +94,24 @@ suite.addBatch({
}
});
suite
.
addBatch
({
"
enter-append
"
:
{
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
;
},
"
appends to the end of the parent
"
:
function
(
body
)
{
var
data
=
[
"
peach
"
,
"
apple
"
,
"
banana
"
,
"
orange
"
,
"
apricot
"
];
body
.
selectAll
(
"
div
"
).
data
(
data
,
String
).
enter
().
append
(
"
div
"
);
assert
.
deepEqual
(
body
.
selectAll
(
"
div
"
).
data
(),
[
"
apple
"
,
"
orange
"
,
"
peach
"
,
"
banana
"
,
"
apricot
"
]);
}
}
}
});
suite
.
addBatch
({
"
selectAll(div).data(…).enter()
"
:
{
topic
:
load
(
"
selection/selection
"
).
document
(),
...
...
test/selection/insert-test.js
View file @
99f6e657
...
...
@@ -111,7 +111,7 @@ suite.addBatch({
});
suite
.
addBatch
({
"
enter
insert
"
:
{
"
enter
-
insert
"
:
{
topic
:
load
(
"
selection/selection
"
).
document
(),
"
on a page with existing elements
"
:
{
topic
:
function
(
d3
)
{
...
...
@@ -121,7 +121,7 @@ suite.addBatch({
},
"
inserts before the following updating sibling
"
:
function
(
body
)
{
var
data
=
[
"
peach
"
,
"
apple
"
,
"
banana
"
,
"
orange
"
,
"
apricot
"
];
body
.
selectAll
(
"
div
"
).
data
(
data
).
enter
().
insert
(
"
div
"
);
body
.
selectAll
(
"
div
"
).
data
(
data
,
String
).
enter
().
insert
(
"
div
"
);
assert
.
deepEqual
(
body
.
selectAll
(
"
div
"
).
data
(),
data
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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