-
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from NHDaly/content_api
Always call `evalscripts` in `fill`.
- Loading branch information
Showing
4 changed files
with
50 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using Blink | ||
using Base.Test | ||
|
||
@testset "content! Tests" begin | ||
w = Window(Blink.@d(:show => false)); sleep(5.0) | ||
body!(w, ""); sleep(1.0) # body! is not synchronous. | ||
@test (@js w document.querySelector("body").innerHTML) == "" | ||
|
||
# Test reloading body and a selector element. | ||
html = """<div id="a">hi world</div><div id="b">bye</div>""" | ||
body!(w, html); sleep(1.0) | ||
@test (@js w document.getElementById("a").innerHTML) == "hi world" | ||
@test (@js w document.getElementById("b").innerHTML) == "bye" | ||
content!(w, "div", "hello world"); sleep(1.0) | ||
@test (@js w document.getElementById("a").innerHTML) == "hello world" | ||
# TODO(nhdaly): Is this right? Should content!(w,"div",...) change _all_ divs? | ||
@test (@js w document.getElementById("b").innerHTML) == "bye" | ||
|
||
# Test `fade` parameter and scripts: | ||
fadeTestHtml = """<script>var testJS = "test";</script><div id="d">hi world</div>""" | ||
@testset "Fade True" begin | ||
# Must create a new window to ensure javascript is reset. | ||
w = Window(Blink.@d(:show => false)); sleep(5.0) | ||
|
||
body!(w, fadeTestHtml; fade=true); sleep(1.0) | ||
@test (@js w testJS) == "test" | ||
end | ||
@testset "Fade False" begin | ||
# Must create a new window to ensure javascript is reset. | ||
w = Window(Blink.@d(:show => false)); sleep(5.0) | ||
|
||
body!(w, fadeTestHtml; fade=false); sleep(1.0) | ||
@test (@js w testJS) == "test" | ||
end | ||
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