11acontext(" geom text color" )
22library(animint2 )
3-
43df <- data.frame (x = 1 ,y = " foo" )
54viz <- animint(
65 text = ggplot()+
@@ -9,20 +8,25 @@ viz <- animint(
98 scale_color_manual(values = c(foo = " blue" ))+
109 geom_text(aes(x , 2 , label = y ), color = " red" , data = df )+
1110 geom_text(aes(x , 1 , label = y ), color = " black" , color_off = " pink" , clickSelects = " y" , data = df ))
11+
1212info <- animint2HTML(viz )
1313test_that(" geom_text color rendered as fill style" , {
1414 fill <- getStyleValue(info $ html , ' //text[@class="geom"]' , " fill" )
1515 expect_color(fill , c(" black" , " blue" ," red" ," black" ))
1616 opacity <- getStyleValue(info $ html , ' //text[@class="geom"]' , " opacity" )
1717 expect_identical(opacity , c(" 1" ," 1" ," 1" ," 1" ))
1818})
19+
1920clickID(" plot_text_y_variable_foo_svg" )# or foo_label?
2021after.html <- getHTML()
2122test_that(" geom_text color rendered as fill style" , {
2223 fill <- getStyleValue(after.html , ' //text[@class="geom"]' , " fill" )
2324 print(fill )
2425 expect_color(fill , c(" black" , " red" ," pink" ))
26+ })
27+
28+ test_that(" default text alpha_off correct" , {
2529 opacity <- getStyleValue(after.html , ' //text[@class="geom"]' , " opacity" )
2630 print(opacity )
27- expect_identical(opacity , c(" 0.5" ," 1" ," 1 " ))
31+ expect_identical(opacity , c(" 0.5" ," 1" ," 0.5 " ))
2832})
0 commit comments