Skip to content

Commit 67fb44a

Browse files
author
Ryan Patrick Kyle
committed
🚨 add tests
1 parent 253e8be commit 67fb44a

File tree

2 files changed

+55
-2
lines changed

2 files changed

+55
-2
lines changed

R/utils.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,10 +610,10 @@ generate_js_dist_html <- function(href,
610610
generate_meta_tags <- function(metas) {
611611
has_ie_compat <- any(vapply(metas, function(x)
612612
x$name == "http-equiv" && x$content == "X-UA-Compatible",
613-
logical(1)))
613+
logical(1)), na.rm=TRUE)
614614
has_charset <- any(vapply(metas, function(x)
615615
"charset" %in% names(x),
616-
logical(1)))
616+
logical(1)), na.rm=TRUE)
617617

618618
# allow arbitrary tags with varying numbers of keys
619619
tags <- vapply(metas,

tests/integration/test_meta.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
from selenium.webdriver.support.select import Select
2+
import time, os
3+
4+
5+
app = """
6+
library(dash)
7+
library(dashHtmlComponents)
8+
9+
app <- Dash$new(meta_tags = list(list(name = "description", content = "some content")))
10+
11+
app$layout(
12+
htmlDiv(children = "Hello world!",
13+
id = "hello-div"
14+
)
15+
)
16+
17+
app$run_server()
18+
"""
19+
20+
21+
def test_rstm001_test_meta(dashr):
22+
dashr.start_server(app)
23+
dashr.wait_for_text_to_equal(
24+
"#hello-div",
25+
"Hello world!"
26+
)
27+
assert dashr.find_element("meta[name='description']").get_attribute("content") == "some content"
28+
29+
30+
app2 = """
31+
library(dash)
32+
library(dashHtmlComponents)
33+
34+
app <- Dash$new(meta_tags = list(list(charset = "ISO-8859-1"), list(name = "keywords", content = "dash,pleasant,productive")))
35+
36+
app$layout(
37+
htmlDiv(children = "Hello world!",
38+
id = "hello-div"
39+
)
40+
)
41+
42+
app$run_server()
43+
"""
44+
45+
46+
def test_rstm002_test_meta(dashr):
47+
dashr.start_server(app2)
48+
dashr.wait_for_text_to_equal(
49+
"#hello-div",
50+
"Hello world!"
51+
)
52+
assert dashr.find_element("meta[charset='ISO-8859-1']")
53+
assert dashr.find_element("meta[name='keywords']").get_attribute("content") == "dash,pleasant,productive"

0 commit comments

Comments
 (0)