-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also, tests for transition.remove. #20
- Loading branch information
Showing
8 changed files
with
81 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
var tape = require("tape"), | ||
jsdom = require("jsdom"), | ||
d3_timer = require("d3-timer"), | ||
d3_selection = require("d3-selection"); | ||
|
||
require("../../"); | ||
|
||
tape("transition.remove() creates an end listener to remove the element", function(test) { | ||
var document = jsdom.jsdom(), | ||
root = document.documentElement, | ||
body = document.body, | ||
selection = d3_selection.select(body), | ||
transition = selection.transition().remove().on("start", started).on("end", ended); | ||
|
||
function started() { | ||
test.equal(body.parentNode, root); | ||
} | ||
|
||
function ended() { | ||
test.equal(body.parentNode, null); | ||
test.end(); | ||
} | ||
|
||
d3_timer.timeout(function(elapsed) { | ||
test.equal(body.parentNode, root); | ||
}); | ||
}); | ||
|
||
tape("transition.remove() creates an end listener named end.remove", function(test) { | ||
var document = jsdom.jsdom(), | ||
root = document.documentElement, | ||
body = document.body, | ||
selection = d3_selection.select(body), | ||
transition = selection.transition().remove().on("start", started).on("end", ended); | ||
|
||
transition.on("end.remove").call(body); | ||
test.equal(body.parentNode, null); | ||
transition.on("end.remove", null); | ||
root.appendChild(body); | ||
|
||
function started() { | ||
test.equal(body.parentNode, root); | ||
} | ||
|
||
function ended() { | ||
test.equal(body.parentNode, root); | ||
test.end(); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters