Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
fixed iframe frameborder, height
Browse files Browse the repository at this point in the history
  • Loading branch information
nachocab committed Jul 27, 2013
1 parent ac302c2 commit 4dc5f7c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions R/Chart-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ Chart$methods(

# I can use Mike Bostock's lazy iframes trick by setting "data-src" instead of "src"
iframe = function(width = params$width + params$padding$right + params$padding$left,
height = params$height + params$padding$top + params$padding$bottom + 4,
height = params$height + params$padding$top + params$padding$bottom + 40,
data_src = "src",
frameborder = 0,
relative_path = NULL){

url <- get_relative_url(relative_path)

iframe <- gettextf("<iframe width = \"%d\" height = \"%d\" %s=\"%s\"> </iframe>\n",
iframe <- gettextf("<iframe width=\"%d\" height=\"%d\" %s=\"%s\" frameborder=%s> </iframe>\n",
width,
height,
data_src,
url)
url,
frameborder)

cat(iframe)
.self
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-Chart-helpers.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
context("Chart-data")
context("Chart-helpers")

test_chart_path <- file.path(getOption("clickme_templates_path"), "TestChart")
unlink(test_chart_path, recursive = TRUE)
Expand Down Expand Up @@ -27,10 +27,10 @@ test_that("iframe", {
test_chart$get_urls()

iframe <- capture.output(test_chart$iframe()$hide())
expect_equal(iframe, '<iframe width = "1000" height = "724" src="temp-TestChart.html"> </iframe>')
expect_equal(iframe, '<iframe width="1000" height="745" src="temp-TestChart.html" frameborder=0> </iframe>')

iframe <- capture.output(test_chart$iframe(relative_path = "clickme")$hide())
expect_equal(iframe, '<iframe width = "1000" height = "724" src="clickme/temp-TestChart.html"> </iframe>')
expect_equal(iframe, '<iframe width="1000" height="745" src="clickme/temp-TestChart.html" frameborder=0> </iframe>')
})

test_that("link", {
Expand Down

0 comments on commit 4dc5f7c

Please sign in to comment.